[concurrency-interest] question the about the JMM

Larry Riedel larryr at saturn.sdsu.edu
Thu Dec 6 23:12:04 EST 2007


> > > [...] "cache coherence" doesn't address reorderings
> > > that the runtime compiler is allowed to do.
> > >     
> >
> > Is there a canonical or ubiquitous example of this?  I
> > am interested in the difficulties with using a model
> > which includes, for example, a simple object cache
> > coherence protocol based on a distributed directory.
> 
> Initially, o.x == o.y == 0.
> Thread 1:
>     o.x = 1; // 1a
>     j = o.y; // 1b
> Thread 2:
>     o.y = 1; // 2a
>     i = o.x; // 2b
> 
> In the absence of happens-before constraints

Presuming none of those are volatile, I would expect
Thread1 can feel free to read o.y whenever it wants to
before it does something with j, and write o.x whenever
it gets around to it.  Correspondingly for Thread2.
This seems tangential to cache coherence protocols since
neither thread is expressing any interest in seeing the
latest shared version, or acknowledging the potential
need for anyone else to see its cached local version.


Larry



More information about the Concurrency-interest mailing list