Developing Apama Applications > Developing Apama Applications in EPL > Implementing Parallel Processing > Samples for implementing contexts > Running samples of common concurrency problems
Running samples of common concurrency problems
Sample applications in the samples\monitorscript\concurrency-theory directory illustrate a few common concurrency problems. There are three implementations of a simple deposit bank:
*Race — implements Get and Set events, and corresponding Response events, so that a teller can find the value of an account, perform some modification and then set the new account value.
*Deadlock — lets tellers lock an account.
*Compareswap — is similar to the Race implementation but it does not rely on locking and it does not compute values based on out-of-date information.
To run these samples:
1. Start an Apama command prompt.
*On Windows, select Start > Programs > Software AG > Apama 5.1 > Apama Command Prompt .
*On UNIX, source the apama_env file to set environment variables.
2. Change to the $APAMA_INSTALL_DIR/samples/monitorscript/concurrency-theory directory.
3. Invoke run_sample.bat (Windows) or run_sample.sh (UNIX) with an argument of race, deadlock or compareswap, according to which sample you want to run. The subsequent topics describe each sample.
The script starts a correlator on the default port (15903). Consequently, you should not have a correlator already running on the default port. If you do, the script causes the application to be injected into the running correlator and it also shuts the correlator down when the sample execution is complete. The script creates an event file in the Output directory (which it creates). The event file has the name of the sample with an evt file suffix (for example, race.evt, deadlock.evt or compareswap.evt.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.