[concurrency-interest] Curious: How Java Memory Model is satisfied in JSR166 locks?
Compl Yue Still
complystill at gmail.com
Tue Aug 21 07:27:21 EDT 2007
Hi list,
I'm just curious that how lock implementations of JSR166 correctly
satisfied the following requirement in the lock specification:
"Memory Synchronization
All Lock implementations must enforce the same memory synchronization
semantics as provided by the built-in monitor lock, as described in
The Java Language Specification, Third Edition (17.4 Memory Model):
A successful lock operation has the same memory synchronization
effects as a successful Lock action.
A successful unlock operation has the same memory synchronization
effects as a successful Unlock action."
I saw dl.util.concurrent code leverages synchronized(){} blocks to
assure similar effects, but I found no equivalent code in jdk source,
it's such a myth to me.
Is any black magic there?
BTW, I'm currently figuring a methcanism that can assign locks to
normal objects (transaction objects specifically, and
detached/attached to worker threads over time) other than threads. I
only have a rough understanding of AQS this far, and feels like it's
adequate but not happily sure yet... Any suggestions?
Best regards,
Compl
More information about the Concurrency-interest
mailing list