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

Compl Yue Still complystill at gmail.com
Tue Aug 21 09:25:11 EDT 2007


But to my understanding of the requirements of the Memory Model, upon
a lock action all variable values must be flushed out of the thread's
working memory, especially other variables not marked as volatile but
ever read by current thread; and upon unlock, all assigned variables
even not marked as volatile in the thread's working memory must be
synchronized to the main memory. So if my understanding is correct so
far, do you imply that accessing a volatile variable causes Hotspot to
synchronize the thread's working memory with main memory? I'm doubting
coz I havn't noticed this requirement in JLS.. Or this is specific to
Hotspot VM?

Thanks for the reply, but I'm still unclear about it.

Regards,
Compl

On 8/21/07, Matthias Ernst <ernst.matthias at gmail.com> wrote:
> > I'm just curious that how lock implementations of JSR166 correctly
> > satisfied the following requirement in the lock specification:
>
> One word: volatile.
>


More information about the Concurrency-interest mailing list