To: J3 09-179 From: John Reid Subject: Atomic subroutines Date: 2009 April 03 References: J3/09-007r1 Discussion This sentence, in para 2 of 13.1 specifies the effect of an atomic subroutine: "The effect of executing an atomic subroutine is as if the action on the ATOM argument occurs instantaneously, and thus does not interfere with other atomic actions that might occur asynchronously." This sentence has an unintended effect. Actions that occur instantaneously are ordered in time so the processor is required to model this. For a single variable, this is easy enough. The image holding the variable performs the actions in some order. The image that makes the call waits for confirmation that the action has occurred before doing anything else, which means that the effect for it is as if the action were done instantaneously. For variables on different images, this model does not work. Suppose the value of a[1] is altered from 1 to 2 just before a[2] is altered from 1 to 2. Suppose further that image 3 has better communication with image 2 than image 1. This would mean that these statements, executed by image 3 call atomic_ref(x,a[1]) call atomic_ref(y,a[2]) at about the same time might get 1 for x and 2 for y despite a[1] being altered first. To make the model work requires synchronization, which was not intended. An edit is provided to correct this. Edits to 09-007 [319:12-14] In 13.1, para 2, change the second sentence from "The effect of executing an atomic subroutine is as if the action on the ATOM argument occurs instantaneously, and thus does not interfere with other atomic actions that might occur asynchronously." to "The effect of any two atomic subroutine calls for a particular variable as the ATOM argument is as if one occurs before the other so that they do not interfere with each other."