[concurrency-interest] Unsafe publication of new objects question

David Holmes davidcholmes at aapt.net.au
Fri Nov 12 17:16:12 EST 2010


Andy,

Andrew Trick writes:
>
> The JVM needs an effective store-store memory barrier between all
> stores that initialize a new object and any store that may publish a
> pointer to it. Not easy to do efficiently on all architectures.
> -Andy

The JVM would need this if it were to guarantee safe-publication, but it
doesn't guarantee that.

David Holmes

>
> On Wed, Oct 6, 2010 at 4:06 AM, David Holmes
> <davidcholmes at aapt.net.au> wrote:
> > Joseph Seigh writes:
> >>
> >>   How did the JVM get around to fixing the unsafe publication
> >> problem of new object state,  i.e. basic type safety for
> >> primative types?   Exploiting load dependency perhaps?
> >
> > Primitive types are type safe by definition. The only guarantee you have
> > regarding unsafe publication is that you can never see
> uninitialized state -
> > at a minimum you must see the default initialization values
> (which is easily
> > achieved by allocating out of pre-zeroed memory).
> >
> > David Holmes
> >
> > _______________________________________________
> > Concurrency-interest mailing list
> > Concurrency-interest at cs.oswego.edu
> > http://cs.oswego.edu/mailman/listinfo/concurrency-interest
> >
>




More information about the Concurrency-interest mailing list