Re: JavaMemoryModel: Roach motel ordering: Do we have consensus?

From: Doug Lea (
Date: Tue Jul 17 2001 - 21:32:50 EDT

> <alex@enkidu.East.Sun.COM> wrote:
> >
> >Hans Boehm wrote:
> >
> >> 1) Can a volatile write be reordered with a following volatile read as in
> >> TSO. I think this is basically the same question as whether monitor exit
> >> and a following volatile read can be reordered. I currently think this is
> >> observable (in spite of earlier messages to the contrary), but it's probably
> >> not critical either way. Allowing the reordering is cheaper on Itanium, at
> >> least for volatiles.
> >>

>I agree that such reorderings are observable and I can think of several
>techniques that rely on the ability to prevent (volatile) reads
>being reordered before (volatile) writes.

[ ...two of my favorite examples elided...]

Alex is entirely right. We cannot relax rules to allow
read-after-write reorderings of volatiles (similarly for
read-after-unlock). A bunch of useful algorithms wouldn't be


JavaMemoryModel mailing list -

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:33 EDT