[cpp-threads] Causality on more than two processors, write atomicity

Alexander Terekhov alexander.terekhov at gmail.com
Tue Sep 6 00:05:35 BST 2005


On 9/5/05, Doug Lea <dl at cs.oswego.edu> wrote:
[...]
> > And I just wonder how revised Java volatiles (which supposedly meant to
> > provide SC semantics)
> 
> The JMM doesn't promise this. 

Uhmm. This JSR-133 FAQ entry

http://www.cs.umd.edu/users/pugh/java/memoryModel/jsr-133-faq.html#volatile

<quote>

What does volatile do?

Volatile fields are special fields which are used for communicating 
state between threads. Each read of a volatile will see the last 
write to that volatile by any thread; in effect, they are designated 
by the programmer as fields for which it is never acceptable to see 
a "stale" value as a result of caching or reordering. ... They must 
also ensure that after they are written, they are flushed out of 
the cache to main memory, so they can immediately become visible to 
other threads. Similarly, before a volatile field is read, the cache 
must be invalidated so that the value in main memory, not the local 
processor cache, is the one seen.

</quote>

needs some (serious) patching, then.

regards,
alexander.




More information about the cpp-threads mailing list