[cpp-threads] Failed compare-and-swap
Peter Dimov
pdimov at mmltd.net
Wed Aug 1 20:37:04 BST 2007
Boehm, Hans wrote:
>> Why do you people keep claiming that acquire semantics
>> provide sequential consistency? I must be missing something.
> In my view, acquire semantics in the failure case are necessary to
> provide sequential consistency, if a failed CAS returns the value that
> was read. Such a CAS can clearly be used as an (expensive)
> replacement for a load. This a failed SC CAS has to provide at least
> the samantics of an SC load. Acquire semantics are clearly not
> sufficient, but they are necessary.
Yes, I was talking about the "not sufficient" part. A failed seq_cst CAS
must have seq_cst semantics and not merely acquire semantics if the program
is to remain SC. Conversely, a non-seq_cst CAS does not guarantee an SC
program under any semantics for the failure case.
That is why I think that using sequential consistency as an argument for
acquire semantics in the failed acquire case is not justified.
More information about the cpp-threads
mailing list