[concurrency-interest] What are the odds of an "early read?"
jim.andreou at gmail.com
Mon Apr 4 16:04:38 EDT 2011
Of course it can happen:
E1: thread1 writes A, B
E2: thread2 reads B
E3: thread3 writes A, B
E4: thread2 reads A
Unless E3 "happens before" E1, but you didn't specify that.
On Mon, Apr 4, 2011 at 12:47 PM, Christian Vest Hansen <karmazilla at gmail.com
> 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.
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest