[concurrency-interest] Question about reordering and volatile

Jeremy Manson jmanson at cs.umd.edu
Tue Apr 1 18:37:50 EDT 2008


Joe Bowbeer wrote:
> Jeremy,
> 
> Is it wrong or misleading for the FAQ to say:
> 
> "Under the new memory model, accesses to volatile variables cannot be 
> reordered with each other or nonvolatile variable accesses."
> 
>   http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#volatile
> 
> I'd interpret that to mean that nothing can jump over a volatile access 
> in either direction...
> 
> By the way, the FAQ does later clarify that without a matching read, the 
> volatile write doesn't happen-before anything, which suggests that 
> unread volatile writes can be elided.

Let's go with "misleading" FTW.  That sentence was more intended to draw 
a contrast with the way things used to be.  The following sentence is 
the more accurate one.

I'll fix it.

					Jeremy


More information about the Concurrency-interest mailing list