[cpp-threads] sequential consistency for race-free programs

Doug Lea dl at cs.oswego.edu
Fri Jul 15 20:59:13 BST 2005


Boehm, Hans wrote:
> I agree.  But I think the problem is that precisely defining what it 
> means for the compiler to speculate either requires the same complexity 
> as in the Java model treatment of causality, or we need to restrict 
> ourselves to sequential consistency in defining data races.  And the 
> latter doesn't handle the case in which a data race on ordinary 
> variables is possible only because of non-sequentially-consistent 
> behavior of atomics.
>  
> How about a compromise?  We insist that ordinary memory operations be 
> sequentially consistent in the data race definition, which I still think 
> (as of 18:22, 7/14/05) is technically OK, and makes things fully precise 
> for simple programs, and wave our hands and say "no speculative stores" 
> for atomics?  That's imprecise, but I think it limits the damage to 
> programs using the atomics library.  And as a practical matter, the 
> tricky optimization questions are far more likely to arise for ordinary 
> variables than for atomics.  We thus have some hope that the remaining 
> ambiguities will never need to be explored.
>  
> Does this sound reasonable?
>  

I can't think of anything better. It seems that in principle
"no speculative stores"  could someday be formalizable if someone
wants to put a lot of effort into it.

-Doug







More information about the cpp-threads mailing list