Given a par statement and its corresponding synchronization graph, the next step is to generate an SPMD program, that will be executed by each of the threads of the statement, embedded with explicit message passing calls that implement the dependence arcs of the graph. We assume the following inter thread communication model (a specialization of the model provided by the message passing/simulation language Maisie[Bag94]):
.
<dest> specifies the destination thread number.
.
.
brecv mtype (<msgtype1>) st (<guard1>) {<code1>}This allows a thread to select and remove a message from its queue. The message that is selected, called the enabling message, must satisfy the conditions of the receive. Specifically, if the message is of type msgtype1, then its fields must satisfy <guard1>. If it is of type msgtype2 then its fields must satisfy <guard2> and so on. The guards are side-effect free boolean expressions involving program variables and message fields. If more than one message of different types satisfy the conditions of the receive, one type is selected non-deterministically. Within a particular type, if more than one message satisfies the conditions of the receive, the earliest message to be deposited in the queue is selected. If no message satisfies the conditions, the thread must wait until an enabling message arrives. Upon accepting an enabling message, a thread executes the corresponding code. Within this code, the fields of the enabling message can be referenced using the syntax
or mtype (<msgtype2>) st (<guard2>) {<code2>}...
.