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

Joshua Harlow harlowja at fastmail.com
Fri May 19 00:25:06 UTC 2017


Chris Friesen wrote:
> 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.

Sounds great, I was starting to but then got busy with other stuff :-P

>
> 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.)

Yup that IMHO would be fair, its just fnctl under the covers (at least 
for linux). Though from what I remember at 
https://github.com/harlowja/fasteners/issues/26#issuecomment-253543912 
the lock class here seemed a little nicer (though more complex). That 
guy I think was going to propose some kind of merge, but that never 
seemd to appear.


>
> Chris
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



More information about the OpenStack-dev mailing list