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

Re: Thread starvation with mutex



Luke Elliott wrote:
> I don't know what the standard has to say in this area, but is this 
> expected? Surely there should be some FIFO queueing of waiters here? 

Is it an SMP or hyperthreaded box?

Waiters are FIFO queued.  The futex does not use synchronous wakeups,
so I'd expect the FUTEX_WAKE to wake the second thread, which will be
run immediately because if it's preferred dynamic priority.

If it's running on a non-hyperthreaded uniprocessor, the second thread
will then acquire the lock, but if it's SMP or HT, both threads will
run concurrently and the first thread will be a bit faster, so win the
race to acquire the lock.

-- Jamie




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