[concurrency-interest] Double Checked Locking in OpenJDK

Gregg Wonderly gregg at cytetech.com
Sat Aug 18 08:25:55 EDT 2012


On 8/16/2012 6:40 PM, Vitaly Davidovich wrote:
> Store buffer writes are still part of cache coherency, they just don't publish
> the value to L1 right away.  The point of the store buffer is that if CPU 1
> needs to write to cache line A but doesn't have the line in its L1 (let's not
> forget that a write has to do a load as well), it can drop the write in the
> store buffer while cache controller fetches it - this is to avoid a stall.  If
> line is already in L1 it can store directly to it (and bypass store buffer),
> possibly causing invalidate requests to be sent out.

This bit of caching can create a temporal write ordering issue though, can it 
not?  The fact that the core doesn't wait for the cache line to appear, and then 
return with the write completed, implies that multiple threads which might 
perform writes on different cores may result in memory states which are not in 
line with the visible order of execution, because it depends on which cores 
cache coherency processing wins in the time to issue the read the line, 
including the thought that invalidation may occur nanoseconds after the line is 
retrieved.

Gregg



More information about the Concurrency-interest mailing list