[cpp-threads] memory model

Doug Lea dl at cs.oswego.edu
Sat Apr 30 16:58:26 BST 2005


> Compilers convert between control and data dependence all the
> time, by converting conditionals to predicated instructions.

Further, in case anyone cares, if you explicitly tie semantics
to control or data dependencies, it is very unlikely that you'll ever
be able to coherently formalize the model. The POPL paper on the JMM
discusses this a bit. (Search "manson pugh adve java memory model"
at http://scholar.google.com/ to find a copy.)

For what it's worth, I think that you must rely on compilers
to be able to make optimizations based on platform-specific
interactions between barriers and dependencies. This will be
furstrating for some people because, most likely, most compilers
won't do as good a job at this as expert programmers can.

>
> I think there's a good case for the following order constraints:
> 
> 	acquire+release
> 	acquire	(load_acquire is cheap on IA64, very cheap on X86, SPARC
> TSO, and clearly useful)
> 	release	(similarly for store_release)
> 	acquire_for_later_loads (I think. If it makes a difference
> anywhere important.)
> 
> Everything else seems tricky to me.
> 

Right. Even the acquire_for_later_loads seems pretty marginal.



-Doug





More information about the cpp-threads mailing list