Synchronous

From Mesham
Revision as of 17:56, 12 January 2013 by Polas (talk | contribs)
Jump to navigationJump to search

Syntax

synchronous[]

Semantics

By using this type, the send of P2P communication will only reach the finish state once the message has been received by the target processor.

Examples

var a:Int::allocated[single[on[1]]];
var b:Int::allocated[single[on[2]]] :: synchronous[] :: blocking[];
var c:Int::allocated[single[on[2]]] :: synchronous[] :: nonblocking[];
a:=b;
a:=c;

The send of assignment a:=b (and program execution on process 2) will only complete once process 1 has received the value of b. The send involved with the second assignment is synchronous nonblocking where program execution can continue between the start and finish state, the finish state only reached once process 1 has received the message (value of c.) Incidentally, as already mentioned, the blocking type of variable b would have been chosen by default if omitted (as in previous examples.)

var a:Int :: allocated[single[on[0]]; var b:Int :: allocated[single[on[1]]; a:=b; a:=(b :: synchronous[]);

The code example above demonstrates the programmer's ability to change the communication send mode just for a specific assignment. In the first assignment, process 1 issues a blocking standard send, however in the second assignment the communication mode type synchronous is coerced with the type of b to provide a blocking synchronous send just for this assignment only.