This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Race unlocking-locking mutex


On Thu, Sep 12, 2013 at 12:58 PM, David Ahern <dsahern@gmail.com> wrote:
> On 9/12/13 9:52 AM, Godmar Back wrote:
>>
>>
>> Not a race, at best the possibility of starvation.
>
>
> It is a race -- you have 2 threads running to the same point the winner of
> which is determined by non-deterministic events. The loser goes to the back
> of the queue. In some situations (single CPU without WAKEUP_PREEMPT (linux
> system)) the case I outlined below causes an extreme starvation.

It's a race only the strictest sense of the definition. We mostly
refer to races when we are talking about bugs, but a race need not be
a bug.

I agree there is a race, but not a bug.

>> To my knowledge, POSIX doesn't require fair queuing - if you want it,
>> implement it yourselves.
>
> And that is why I am asking on the libc mailing list: is this something that
> libc has an interest in addressing as a general infrastructure/OS component
> - providing fairness in access to a resource?

A ticket lock system is fairly easy to implement on top of a mutex.

I expect that glibc will only be interested in an implementation if
you can show a considerable performance boost for having the library
implement the ticket lock.

You can always make a proposal and send it to
libc-alpha@sourceware.org to have it discussed?

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]