(j3.2006) (SC22WG5.4254) Question on locks

Reinhold Bader Reinhold.Bader
Wed Apr 21 17:18:23 EDT 2010


Aleksandar Donev schrieb:
[...]
> As a programmer, I hope that a SYNC MEMORY is not required when using 
> LOCKS. The latter is meant to be used for user-defined ordering, i.e., 
> in cases where the compiler cannot determine that some ordering might 
> occur. For LOCK/UNLOCK this is clearly spelled out and so compilers 
> cannot optimize in ways that break programs that conform to the segment 
> ordering rules.
>   
While I share this hope, the description of SYNC MEMORY together with 
the spin lock example
Note 8.41 appears to contradict this. From Note 8.41 I conclude that 
SYNC MEMORY serves two
purposes

(1) prevent code movement across the segment boundary
(2) reload coarrays from memory upon first reference after the new 
segment starts

and I have the feeling that (1) is addressed by the semantics of locks, 
but (2) isn't.

> Aleks
>
> On Wednesday 21 April 2010, Reinhold Bader wrote:
>   
>> Does this not imply that in certain situations it may be necessary to
>> explicitly execute a
>> SYNC MEMORY after successfully acquiring a lock? In particular, is
>> not such a statement
>> required immediately after the statement
>>
>> LOCK(queue_lock)  ! New segment A starts
>>
>> in Note 8.45 since otherwise a register-stored value of
>> work_queue_size might be used,
>> overlooking the update of its memory location by a remote image?
>>     
>
>
>   




More information about the J3 mailing list