Memory model

Doug Lea dl at cs.oswego.edu
Thu Jan 27 01:11:45 GMT 2005


> 
> To continue the previous point, this raises the question of degree of 
> conformance required for any memory model proposed. Is the model truly 
> general so that, in the limit with a single thread, it also specifies 
> conformance for existing C++ sequential code? Or is it an optional 
> extra, ie if there is more than a single thread active in the code then 
> a memory and execution model must conform to this newly standardised 
> behaviour?

The easiest way to deal with this is to ignore it.  One of the slogans
compiler optimization developers is "everything is legal if you can't
get caught".  How bad would it be if overwriting fields etc were legal
only for compilers doing whole-program analysis that can prove that
only a single thread is created (and thus, they will provably never be
caught)?  In some cases, less-than-whole-program analysis would
suffice.  Overwrites and the like are not all that important for
performance. I don't think many compiler folks will complain that they
can only do them in very restrictive circumstances.

-Doug











More information about the cpp-threads mailing list