(j3.2006) (SC22WG5.4253) Question on locks
Aleksandar Donev
adonev
Wed Apr 21 17:09:37 EDT 2010
Hi Reinhold,
I remember that we argued about this a lot (especially with someone on
the C++ committee that was urging us to eliminate the implicit sync
memory from locks, which was maybe when and why we did it), but I cannot
recollect the details without looking at paper trails (this happened at
the WG5 meeting in Vegas where we had long arguments about what sync
memory and atomics really mean...).
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.
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?
--
Aleksandar Donev, Ph.D.
Luis W. Alvarez Postdoctoral Fellow
Center for Computational Sciences and Engineering (https://ccse.lbl.gov)
Lawrence Berkeley National Laboratory (http://www.lbl.gov)
E-mail: adonev at lbl.gov
Phone: (510) 486-5782 Fax: (510) 486-6900
Address: MS 50A-1148, LBL, 1 Cyclotron Rd., Berkeley, CA 94720
Web: http://cims.nyu.edu/~donev/
More information about the J3
mailing list