Re: JavaMemoryModel: Let them write race-free code (was: The property of "race-free implies SC")

From: Bill Pugh (pugh@cs.umd.edu)
Date: Tue Nov 11 2003 - 14:25:05 EST


At 10:00 PM -0800 11/10/03, Joseph Bowbeer wrote:
>
>
>The preface to the community review draft of the JMM states: "The proposed
>core semantics should not cause issues for existing JVM implementations".
>What, however, can we tell the users and maintainers of the existing code
>base about the impact of the proposed semantics?

With only a few obscure exceptions, the new spec doesn't change things so that
code that had reasonable and well defined semantics before now have
ill-defined semantics.

So I don't think that any programmers should feel "Because the spec
changed, I now have to change my code".

On the other hand, there is a lot of incorrectly synchronized code
out there. It was broken before, and it is still broken. It should
have been fixed before, but now the spec clearly implies that it
should be fixed.

The new model does allow for some new techniques (such as
double-checked locking on a volatile reference) for creating
correctly synchronized code.

So I don't think programmers really have much to worry about from the JSR.

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



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