[concurrency-interest] question the about the JMM

Peter Veentjer alarmnummer at gmail.com
Thu Dec 6 03:46:03 EST 2007


Hi Larry,

according to the JMM, the complete state of a thread when it releases
a lock X (or does a volatile write or ...) is visible in a different
thread when it acquires lock X (or does a volatile read or ...). The
changes made after the lock has been releases ( or. ) could even be
visibile when the lock is acquired ( or ...).

So the level of granulairy is big. This property is required to do a
save hand off: to pass a structure with visibility problems (an
ordinary POJO without any knowledge of concurrency) from one thread to
another. A BlockingQueue is a concurrency structure that provides a
save hand off and you could use it to pass an ordinary Person for
example.

On Dec 6, 2007 12:37 AM, Larry Riedel <larryr at saturn.sdsu.edu> wrote:
>
> > one of the problems with the difference between reasoning in
> > cache invalidation and happens before relations, is that with
> > the former the following sounds very plausible: a release of
> > lock X (that causes a cache invalidation) and an acquire of
> > lock Y (that causes a cache update) is a usable mechanism to
> > make all changes from one thread visible in another.
>
> I hope it is fair to presume any sane cache coherence
> protocol maintains consistency at a level of granularity far
> far smaller than the entire cache!  I would agree it would
> be ludicrous to model the entire memory space of a thread
> as one giant blob which gets invalidated every time a lock
> is acquired/released!  The only changes I would expect to
> be made visible in the above case are those made to values
> in the memory blocks associated with the acquire/release of
> both lock X and lock Y.  And in Java, if X is not Y, I do
> not think any presumptions are supposed to be made about
> which values those are, without additional information.
>
>
>
> Larry
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>


More information about the Concurrency-interest mailing list