Apama 10.3 | Apama Documentation | 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 as described in Setting up the environment using the Apama Command Prompt.
2. Change to the samples/monitorscript/concurrency-theory directory of your Apama installation.
3. Invoke the following:
pysys run –X MODE=mode
where mode can be 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-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.