Re: JavaMemoryModel: Problem on single processor

From: David Holmes (dholmes@dstc.edu.au)
Date: Thu May 25 2000 - 19:03:18 EDT


> I think the answers are that technically this is not a bug since the
> behavior is consistent with the JMM. There is nothing that says that
> reorderings of visibility can only take place on multiprocessors. So all
> code must be careful in how it synchronizes no matter what machine it will
> run on. These answers aren't very pleasant. Any other opinions?

This is one of the points that Doug Lea makes in his discussion of things
(http://gee.cs.oswego.edu/dl/cpj/jmm.html) The JMM allows compilers/JITs the
freedom to do things, even on uniprocessors.

It is a little surprising to see it actually in action but also good - it
makes it easy to demonstrate the fact that you must not access shared
(mutable) variables without synchronization.

The rules for "volatile", new rules for "final" and rules for static
initialization will allow some relaxations to the rule of always using
synchronization. Additionally the rules concerning thread start and
termination will also be clarified (basically the same as POSIX but that's
never been clearly stated). Other rules concerning word-tearing also need to
be made clear.

David

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



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