[concurrency-interest] Curious: How Java Memory Model is satisfied in JSR166 locks?

Dawid Kurzyniec dawid.kurzyniec at gmail.com
Tue Aug 21 11:50:13 EDT 2007


On 8/21/07, Compl Yue Still <complystill at gmail.com> wrote:
> Thanks much Dawid, this is the best answer I'd expected to hear!
>
> However I'm still a little away from this happy conclusion, given your
> suggested bullets from
> http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.4.4
>
> * An unlock action on monitor m synchronizes-with all subsequent lock
> actions on m (where subsequent is defined according to the
> synchronization order).
> * A write to a volatile variable (§8.3.1.4) v synchronizes-with all
> subsequent reads of v by any thread (where subsequent is defined
> according to the synchronization order).
>
> Where I understand that the order between actions is specific to a
> monitor (of an object) or a volatile variable. But from JVM Spec 8.6 (
> http://java.sun.com/docs/books/jvms/second_edition/html/Threads.doc.html#22253
> )
>
> 8.6 Rules About the Interaction of Locks and Variables
>   Let T be any thread, let V be any variable, and let L be any lock.
> There are certain constraints on the operations performed by T with
> respect to V and L:
> (...)

You're quoting the JVM spec _second_ edition. Throw it out the window,
or better yet, burn it, so that no one can find it and get confused by
it ;)

All that stuff has been obsoleted by JSR 133.

--
Regards,
Dawid



More information about the Concurrency-interest mailing list