[concurrency-interest] Relativity of guarantees provided by volatile

Boehm, Hans hans.boehm at hp.com
Mon Aug 20 14:53:12 EDT 2012


> From: Marko Topolnik [mailto:mtopolnik at inge-mark.hr]
> > Interestingly, JMM also defines r_i and w_j to be in a data race,
> even
> > though they are all volatile.
> 
> This a very nice catch. Isn't in fact any read in a data race with all
> writes by another thread following the write it observed? That would
> make it impossible to write a program free of data races. In other
> words this sounds like a loophole in the definition of a data race.
> 
That's a bug in the wording of the spec.  I have a vague recollection that it was pointed out before a couple of years ago, possibly even on this list.  It's one of these things that should really be fixed, but is waiting for a resolution of the harder Java memory model issues.

Hans



More information about the Concurrency-interest mailing list