Re: any fairness in NTPL pthread mutexes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christopher Friesen wrote:

I'm using NPTL.

If I have a pthread mutex currently owned by a task, and two other tasks try to lock it, when the mutex is unlocked, are there any rules about the order in which the waiting tasks get the mutex (ie priority, FIFO, etc.)?


SCHED_OTHER.

If there are any waiting tasks when the mutex is unlocked, one of the waiting
tasks is woken up but not given lock ownership.  It has to acquire the mutex
on its own.  If it fails because another thread got the mutex first, then it
goes back to waiting.   It's sometimes called an adaptive mutex.  It's a little
faster than a FIFO mutex.  It recovers from intermittent contention better.
With heavier contention, some threads in theory could starve, something that
wouldn't happen with a FIFO mutex.

--
Joe Seigh

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux