|
Our version of the CGA software consists of approximately 2500 lines of concurrent code in JavaTriveni. The functionality of this software, comprised of the CGA Collection Software and multiple instances of the CGA Data Software, is depicted in Figures 7 and 8. (The structure of the CGA Data Software is relatively simple, and hence is depicted merely as pseudo-code). Arrows emanating from Triveni processes indicate events that are emitted or flags that are set by those Triveni processes; arrows pointing to Triveni processes indicate events that are received or flags that are read by those Triveni processes. Dotted arrows represent events to or from the outside world.
The CGA Collection Software receives summary requests from the outside world. In response, it first broadcasts a message to all the instances of the CGA Data Software to start collecting their data. It then sends requests to the multiple instances of the CGA Data Software; these instances are polled sequentially. The first request from the CGA Collection Software to a given instance of the CGA Data Software is represented by the FIRST_REQ_i events, and subsequent requests are represented by NEXT_REQ_i events. The given instance of the CGA Data Software responds to a FIRST_REQ_i event by collecting a threshold amount of data from the beginning of its databases, and sending CGA data to the CGA Collection Software via the CGA_DATA_i event. It then waits for a NEXT_REQ_i event, upon which it resumes searching for more data, from the point it left off in the corresponding databases. It again sends data via the CGA_DATA_i event. The LAST_DATA_i event signifies that all relevant CGA data has been sent by this instance of the CGA Data Software. The CGA Collection Software collects all the CGA data, reformats it, and sends it to the Human-Machine Interface for printing.
class DataSoft extends Expr {
DataSoft() {
Expr e = AWAIT FIRST_REQ ->
LOOP
// collect threshold amount of data
// from beginning of database
// emit CGA_DATA or LAST_DATA
DO
LOOP
AWAIT NEXT_REQ ->
// collect threshold amount of data
// data from rest of database
// emit CGA_DATA or LAST_DATA
WATCHING FIRST_REQ
become(e);
}}
|
The JavaTriveni design and implementation of the top-level CGA program, the CGA Data Software, and the CGA Collection Software utilize the principles underlying JavaTriveni. In particular:
The JavaTriveni design methodology is also evident at a ``micro'' level in the the following detailed description of the JavaTriveni implementation of the CGA Collection Software.