[concurrency-interest] Multi-level locks

Khilan Gudka khilan at doc.ic.ac.uk
Tue Mar 16 09:45:01 EDT 2010

Hi David, Bryan and Tim,

Thanks for your replies. I will read Doug's AQS paper but from David's
reply, I think I misunderstood how I could use AQS and now see the potential
perhaps of representing multiple modes within AQS's S mode given that
tryAcquireShared is called again when waking up a queued thread? I'm still
not sure how I could give priority to upgraders? The paper mentions barging?

Bryan: I absolute agree that optimistic techniques such as transactional
memory can give better throughput and scalability. I'm currently researching
lock inference techniques for implementing atomic blocks ( i.e. atomic { ...
} ) using locks. There are times when atomics might need to use locks over
TM, such as if it contains I/O.

Our current approach uses multi-granularity locks when the set of objects
accessed cannot be statically determined - in this case, we lock types
(multi-granularity locks allow us to support both type locks and instance
locks rather than reverting only to type locks), although in the future we'd
like to look into more fine-grained approaches.

Tim: thanks for the link, I'll have a look.

Thanks again,

On 16 March 2010 13:28, Tim Peierls <tim at peierls.net> wrote:

> On Mon, Mar 15, 2010 at 6:51 PM, David Holmes <davidcholmes at aapt.net.au>wrote:
>>  There's also an example on using AQS to do Room Synchronization that we
>> presented at various places, but for which I'm having trouble finding an
>> actual link. :( Contact me if you'd like me to dig it up. I think there
>> should be a JavaOne presentation with it in, somewhere.
> I don't remember a J1 presentation, but I do remember putting together a
> room synchronizer based on AQS:
> https://dev.priorartisans.com/repos/jcip/trunk/src/main/jcip/rrlock/RoomSynchronizer.java
> I can't find any test suites with it, so I'd treat this code as more of a
> sketch than a real implementation. (For example, the comment for private
> static method indexMask looks wrong to me. For another, the use of a map
> instead of an array to hold the room locks now strikes me as an unnecessary
> and expensive nicety.)
> --tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20100316/7ec9ce4f/attachment.html>

More information about the Concurrency-interest mailing list