Re: Thread starvation with mutex
Jamie Lokier <[email protected]> Fri, 6 Feb 2004 22:15:06 +0000
| Newsgroups | gmane.comp.lib.phil |
|---|---|
| Message-ID | <[email protected]> |
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