[concurrency-interest] Unsafe publication of new objects question

Andrew Trick andrew.trick at gmail.com
Fri Nov 12 15:59:04 EST 2010


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

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