Apama 10.15.4 | 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\epl\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 as described in Setting up the environment using the Apama Command Prompt.
2. Change to the samples/epl/concurrency-theory directory of your Apama installation.
3. Invoke the following:
pysys run --mode=mode
where mode can be Race, Deadlock, CompareSwap or ALL, according to which sample monitors you want the test 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).