RE: JavaMemoryModel: Performing speculative writes ahead of

From: Sylvia Else (syljmm32@cryogenic.net)
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?

Sylvia.

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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