[concurrency-interest] What are the odds of an "early read?"
Christian Vest Hansen
karmazilla at gmail.com
Mon Apr 4 15:47:18 EDT 2011
Consider the situation where we have an ordinary field A and a volatile field B.
Thread 1 writes to A and then to B. Then thread 2 reads B and then A,
and the write to A is guaranteed to happen-before the read of A
because it piggy-backed on the ordering guarantees of B.
However, what if a third thread was doing another write sequence
similar to that of thread 1, but slightly delayed? Could thread 2 then
observe the write of thread 1 to B, and the write of thread 3 to A?
Venlig hilsen / Kind regards,
Christian Vest Hansen.
More information about the Concurrency-interest