To: J3 09-201r1 From: Nick Maclaren Subject: Atomic Semantics (Proposal A) Date: 21 April 2009 References: There has been an inconclusive Email debate about the parallel semantics of ATOMIC variables, which has asked two questions: (a) what semantics should they have, and (b) what the current intent is. The debate has centred around Note 8.39. There is no disagreement that it will work on any system that can support any useful form of synchronisation using atomic operations. The problem is that it relies on semantics that are not explicitly specified by the normative text, but does not say so, and there is no agreement over whether they are an implication of the normative text. This proposal attempts to clarify the situation, by stating that the parallel ordering semantics are processor dependent but will work on almost all processors. A processor would be free to define extra semantics, and most vendors would. That is what we agreed in Tokyo. They would always provide the right semantics for trace variables, progress monitor variables, the implementation of user-defined reductions and so on, but would be useful for synchronisation only in some implementations. This is efficiently and scalably implementable even on commodity clusters, and would be usable even when it is essential not to distort the timing of an image's serial execution, or when maximal performance is critical. On a shared memory system, the compiler would need only to avoid reordering accesses, and otherwise would generate normal code. Edits to CD 1539-1 (J3/09-007r1) -------------------------------- [193:19+] In Note 8.39, replace "For example:" by "The following code is processor dependent, but will behave as expected on almost all processors." [319:16+] In 13.1, after paragraph 3, insert a new Note: "NOTE 13.x The order of accesses to atomic variables may appear to be inconsistent between different images or between different variables. The most reliable way to use these is for a single image to define a particular variable, repeatedly, and for another image to inspect its changes. However, even this use is processor dependent."