JavaMemoryModel: Re: Introduction, class author responsibilities (was: JavaMemoryModel: Idiom for safe, unsynchronized reads)

From: Bill Pugh (pugh@cs.umd.edu)
Date: Tue Jul 06 1999 - 08:50:02 EDT


At 2:01 PM +0000 7/5/99, David G. Wonnacott wrote:
>
> Date: Sun, 4 Jul 1999 17:37:19 -0400
> From: Bill Pugh <pugh@cs.umd.edu>
>
> > Do extra ordering
> >guarantees apply only for writes inside constructors or whether they
> >extend to all writes that occur prior to publishing?
>
> For initialization safety, the guarantee would be that all writes
> performed by the thread between the time the constructor was started
> until the time the constructor completes normally are made visible to
> all processors before any reference to that object, written after
> completion of the constructor, becomes visible.
>
>Giving guarantees for writes that occur "inside constructors" rather
>than "prior to publishing" seems to require that the author of a class
>anticipate what sort of safe unsynchronized reads are going to be
>needed when the class is used (since users of the class can't add
>constructors to it). It might be worth weighing this factor when
>making a choice between the two approaches.

The idea that Josh and I talked about, and is discussed in the
"getting the ball rolling" msg, is that there should be some
synchronization idiom that allows this semantics. Constructors would
offer this semantics without the need to use a special
synchronization idiom.

At 11:18 AM -0400 6/24/99, Bill Pugh wrote:
> - Provide a synchronization idiom that provides a safe way for a thread
> to construct an object, perform a series of updates on the object,
> and then publish the object (store a reference to the object in memory
> read by other threads). Other threads should then be able to read that
> reference and see an object that reflects all of the modifications.

See my comments to Sarita's comments for a possible idiom to make this work.

Bill

-------------------------------
This is the JavaMemoryModel mailing list, managed by Majordomo 1.94.4.

To send a message to the list, email JavaMemoryModel@cs.umd.edu
To send a request to the list, email majordomo@cs.umd.edu and put
your request in the body of the message (use the request "help" for help).
For more information, visit http://www.cs.umd.edu/~pugh/java/memoryModel



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