[cpp-threads] Yet another visibility question
Peter Dimov
pdimov at mmltd.net
Thu Dec 14 15:03:22 GMT 2006
Boehm, Hans wrote:
> "A synchronization operation is either an acquire operation or a
> release operation, or both, on one or more memory locations."
> ==>
> "A synchronization operation MAY BE either an acquire operation or a
> release operation, or both."
It might be better to not use either/or (xor) here.
"A synchronization operation MAY BE an acquire operation, a
release operation, or both."
> 1.10p5:
> {Generalize the second condition for inter-thread-ordered-before
> to ordinary writes, but not reads:}
> "A is an unordered atomic read and B is an unordered atomic write, and
> either
> the value written by B varies depending on the value read by A, or the
> execution of B is conditioned on the value read by A."
> ==>
> "A is an unordered atomic read and B writes
> a value which depends on the value read by A, or the
> execution of B is conditioned on the value read by A."
You are going back to the "depends on" formulation, which has a problem with
things like r1-r1 depending on r1 before optimizations, but not after.
> "All modifications to a particular memory location L occur in some
> particular total order, referred to as the modification order for L.
I think that the examples I've given so far don't need as strong a
guarantee. They only require TSO for read-modify-writes. TSO for atomic
stores is nice to have since otherwise the model works in a very
counter-intuitive way, of course, so I'm not arguing one way or the other.
Lack of per-thread TSO (1, 2, 1 in example 1) would certainly seem
unnatural.
More information about the cpp-threads
mailing list