[cpp-threads] memory model

Peter Dimov pdimov at mmltd.net
Mon May 2 21:55:08 BST 2005


Doug Lea wrote:
>> I can think of no interesting cases where an optimizer can turn acq
>> into ddacq or ccacq.
>
> Oh, sorry. Now I get it. I was thinking in terms of Java atomics
> that refine/extend volatile semantics. C++ atomics
> don't do that, which does give more flexibility, but
> you are right that there are now a lot of potential modes.
>
> Not that I have any ideas about it at the moment, but
> I'd hope that there's a way to do this that reflects
> semantic constraints rather than serving so explicitly
> as barrier directives.

The various ccacq/ddhlb/ssb/... labels are explicit visibility/reordering 
semantic constraints, not barrier directives. The actual barriers can still 
be weakened or optimized out as described in your cookbook. They are still 
an abstract notation, just a different flavor.

One interesting difference (to me) is that the JMM says that volatile 
accesses _to the same variable_ are ordered, whereas Alexander's model 
doesn't take locations into account. I'm still not sure how this (coupled 
with the difference between the C++MM and JMM) manifests itself in practice 
(or in theory). 





More information about the cpp-threads mailing list