Re: JavaMemoryModel: Thread Synchronization at Creation and Termination

From: Bill Pugh (
Date: Wed Feb 07 2001 - 10:55:06 EST

>I have a question about the synchronization of constructors, and the
>start and join methods of threads.

>I still couldn't find any definitive word about the memory consistency
>guarantees for thread creation, "starting" and synchronization (via
>join, not the synchronized statements).

I'm going to answer this with regards to proposed specifications,
rather than the existing specs where aren't real detailed on this

>So my questions are:
>1. Am I correct that at the end, val could be 5 or 0?
> (I have sequences of load, store, etc. actions that I believe are
> correct according to JLS.)

val can only be 3.

In our paper "Semantics of Multithreaded Java" this is spelled out
formally in section 7.4 and informally in section 3.

But in short, writes are made visible and synchronized via both
start() and join().

JavaMemoryModel mailing list -

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