[openstack-dev] [oslo][concurrency] lockutils lock fairness / starvation

Chris Friesen chris.friesen at windriver.com
Thu May 18 23:18:05 UTC 2017

On 05/16/2017 10:45 AM, Joshua Harlow wrote:
> So fyi,
> If you really want something like this:
> Just use:
> http://fasteners.readthedocs.io/en/latest/api/lock.html#fasteners.lock.ReaderWriterLock
> And always get a write lock.
> It is a slightly different way of getting those locks (via a context manager)
> but the implementation underneath is a deque; so fairness should be assured in
> FIFO order...

I'm going ahead and doing this.   Your docs for fastener don't actually say that 
lock.ReaderWriterLock.write_lock() provides fairness.  If you're going to ensure 
that stays true it might make sense to document the fact.

Am I correct that fasteners.InterProcessLock is basically as fair as the 
underlying OS-specific lock?  (Which should be reasonably fair except for 
process scheduler priority.)


More information about the OpenStack-dev mailing list