Onesided

From Mesham
Jump to navigationJump to search

Syntax

onesided[a,b]

Syntax

onesided[]

Semantics

Identical to the Channel type, but will perform onesided communication rather than p2p. This form of communication is less efficient than p2p, but there are no issues such as deadlock to consider. This type is connected to the sync keyword, which allows for the programmer to barrier synchronise for ensuring up to date values. The current memory model is Concurrent Read Concurrent Write (CRCW.)

Note: This is the default communication behaviour in the absence of further type information.

Example

function void main() {
   var i:Int::onesided::allocated[single[on[2]]];
   proc 0 {i:=34;};
   sync i;
};

In the above code example variable i is declared to be an Integer using onesided communication on process two only. In line two an assignment occurs on process zero which will write the value, from process zero into the memory held by process two. At line three barrier synchronisation will occur on variable i, which in this case will involve processes zero and two ensuring that the value has been written fully and is available.

Since: Version 0.5