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

Re: Newbie question on mutexes

Abhijeet Bisain wrote:
> Can someone please let me know what I am doing wrong. I would have expected 
> the higher priority thread to get the mutex, but don't see that behavior in 

In this example, provided it's running on a uniprocesor machine, NPTL
is guaranteed to hand over the mutex to the first waiter in FIFO order.

We could change the kernel futex code specifically for real-time
tasks, so that the highest priority RT task is woken.  However, on SMP
or hyperthreaded systems that still wouldn't give the mutex to the
highest priority task in many realistic cases, so it's not worth
making the kernel code slower and more complex just to create a false
expectation for NPTL users that happens to work on UP.

What you observe is expected and you aren't doing anything wrong -
except having the wrong expectation. :)

-- Jamie

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