[concurrency-interest] Relativity of guarantees provided by volatile
zhong.j.yu at gmail.com
Fri Aug 17 19:41:51 EDT 2012
Actually we need to reverse engineer a synchronization order, from
values written and read. This is not always possible. For example,
thread W writes 1 then writes 2, and thread R reads 2 then reads 1.
(all volatile) There is no way to concoct a synchronization order
consistent with other JMM requirements. Therefore the example is
impossible under JMM.
Is OP's example possible under JMM? I think so, we can construct a
physical model that conforms to JMM but with a slow signal speed (say
data are delivered by USPS), and OP's example can be realized on it.
More information about the Concurrency-interest