Difference between revisions of "Onesided"

From Mesham
Jump to navigationJump to search
(Semantics)
m
Line 21: Line 21:
  
 
[[Category:Type Library]]
 
[[Category:Type Library]]
[[Category:Composite Types]]
+
[[Category:Compound Types]]
 
[[Category:Primitive Communication Types]]
 
[[Category:Primitive Communication Types]]

Revision as of 17:53, 12 January 2013

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

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.