[concurrency-interest] Clarification: volatile, final and atomic ops

Joe Bowbeer joe.bowbeer at gmail.com
Thu Jan 15 18:50:41 EST 2009


On Thu, Jan 15, 2009 at 3:23 PM, Ashwin Jayaprakash wrote:

> I know I sound obtuse, but I'm wondering how, without knowing whether the
> next instruction - in this case the if(..) block and hence the volatile
> field access is going to be executed or not, can the compiler or CPU go
> ahead and re-order instructions that logically come after the if(..) block?
>
> I mean, can the instructions after the if(..) get executed even before the
> if(..) is evaluated and then realize that the if(..) is true and so requires
> a fence..so all the re-ordering and execution will have to be discarded...Is
> that how it works?
>
> Ashwin.
>

In terms of how, this might be what you're looking for:

http://gee.cs.oswego.edu/dl/jmm/cookbook.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20090115/98219dfb/attachment.html>


More information about the Concurrency-interest mailing list