Re: rmlock question..

From: Darren Reed <darrenr_at_freebsd.org>
Date: Mon, 26 Nov 2007 09:29:34 -0800
Stephan Uphoff wrote:
> Julian Elischer wrote:
>> Julian Elischer wrote:
>>> If I make an exclusive rmlock request on an rmlock that has a busy 
>>> set of readers coming and going, do new readers wait for me to get
>>> my turn, or do I have to wait for a moment where there are no more 
>>> readers before I get a go?
>> in fact if the requests are of the order
>>
>> reader, reader, writer, reader, reader, writer, reader
>>
>> is the order of evaluation defined? is it preserved?
> This is a bit of a tricky question to answer.
> ...
> So in your example the first writer (W1) will be blocked by the first 
> two Readers (R1,R2)
> but will disable the read fast path and hold the internal mutex.
> W1 will block R3,R4,W2,R5 as they all need to acquire the internal mutex.
> If R1,R2 release the lock, W1 will become unblocked and eventually 
> unlock the lock
> such releasing the mutex. At this time R3,R4,W2,R5 compete for the 
> mutex and whoever
> wins is next in the locking order.

Is there is a chance that so long as there is more than one Reader
waiting for a mutex, a Write lock request may never be granted?

Given the name "read mostly", is there any favouritism towards
Readers vs Writers when competing for the mutex?

Or conversely, if there is always a pending Write request that a
read is never granted?

When R3,R4,W3,R5 compete for the mutex, if R3-5 wins, is
the read fast path enabled again?

If any of the Readers wins, does this mean that all Readers are
dequeued, or only those upto the pending Write?

Darren
Received on Mon Nov 26 2007 - 16:48:16 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:23 UTC