[concurrency-interest] Relativity of guarantees provided by volatile

Zhong Yu zhong.j.yu at gmail.com
Fri Aug 17 21:42:54 EDT 2012


On Fri, Aug 17, 2012 at 8:33 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:
> Consider this physical model:
>
> Each thread is a person Tx.
>
> There's a person V managing all variables.
>
> To make a write, Tx sends a paper mail to V. No return mail is
> required, therefore a write is very short.
>
> To make a read, Tx sends a paper mail to V, and waits for return mail.
>
> The synchronization order is the order the mails received by V.
>
> This seems to be a valid JMM model.
>
> --
>
> Now suppose thread R is very close to V, therefor reads are also very
> short. (it's easier to talk about temporal order between short
> actions) Suppose thread W is very far away from V.
>
> To realize OP's example, consider the numbers are in hours, and route
> W -> V takes 48 hours.
>
> On Monday, W writes v=1, it reaches V on Wednesday. On Tuesday R reads
> v=0. So the write is after read in sync order, yet write is before
> read in temporal order(even considering relativity - all persons are
> on Earth)
>
> Therefore sync order doesn't have to be consistent with temporal order.

On the other hand, if w is before r in sync order, there's a causal
relationship, it seems necessary that, the beginning of w is before
the end of r in temporal order. So there may be some constraints
between the two orders.


More information about the Concurrency-interest mailing list