RE: JavaMemoryModel: Performing speculative writes ahead of

From: Sylvia Else (
Date: Sun May 30 2004 - 20:43:20 EDT

At 10:08 AM 31/05/2004 +1000, David Holmes wrote:
>Sylvia Else wrote:
> > I don't see the problem.
>There isn't one, as long as the write to workerFinished is not moved to
>before the loop.
>My query is whether the JMM as it stands forbids that movement.

The JMM lets the system do whatever it likes as long as all of the actions
performed in the loop are seen by a thread that sees the write to the
volatile. In practical terms, it's difficult to imagine an implementation
that could hoist the volatile write and still comply with the requirement.

One scenario I can imagine is one where the compiler can prove that none of
the actions in the loop are observed by any other thread anyway. But in
that case the actions have no observable consequence, so what's the
objection to the reordering?


JavaMemoryModel mailing list -

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:08 EDT