Re: JavaMemoryModel: Race-proof mutable objects and synchronized constructors

From: David F. Bacon (dfb@watson.ibm.com)
Date: Sun Dec 03 2000 - 10:54:32 EST


I agree with Doug. The problem is rare, and if, as Josh suggests, the premium
is on minimizing language changes, I don't see why a language change is
necessary.

I think it is dangerous to throw in lots of extra synchronization in the hopes
that this will make some problems go away. While the obvious implementations
of object initialization would require a barrier on a weak memory model
machine, requiring the synchronization precludes optimizations that anyone
might come up with in the future.

Throwing an implicit barrier on every constructor is also counter to a
fundamental aspect of the Java design -- namely that the programmer gets to
choose where synchronization is applied and where it isn't. I don't think that
turned out to be a good approach, but given that it is what Java did, it seems
it ought to be applied uniformly.

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:29 EDT