[concurrency-interest] CPU cache-coherency's effects on visibility

thurston at nomagicsoftware.com thurston at nomagicsoftware.com
Thu Feb 14 11:48:32 EST 2013


Given that all (?) modern CPUs provide cache-coherency, in the 
following (admittedly superficial example):

Thread 1:
while (true)
{
     log(this.shared)
     Thread.sleep(1000L)
}

Thread 2:
    this.shared = new Foo();

with Thread 2's code only invoked once and sometime significantly after 
(in a wall-clock sense)
Thread 1; and there are no operations performed by either thread 
forming a happens-before relationship (in the JMM sense).

Is Thread 1 *guaranteed* to eventually see the write by Thread 2?
And that that guarantee is provided not by the JMM, but by the 
cache-coherency of the CPUs?


More information about the Concurrency-interest mailing list