Luke Elliott wrote:As an embedded systems software engineer, I've been developing complex systems based upon lightweight processes or 'threads' for some twenty-five years now. For the past five years I have been working with POSIX threads on Solaris and Linux. The ambiguities of the Linux scheduler's dynamic priority manipulation notwithstanding, I would indeed expect that a FIFO-queued mutex would allow Mr. Elliot's 'thread 2' to acquire the mutex once it was released... the majority of the threaded environments with which I have worked would in fact guarantee that, given two threads of equal priority.
Is there a reason why NPTL does not use this "fair" method?
It's slow and unnecessary.
Surely this is pretty normal, expected behaviour of a mutex?
Perhaps expected by you. Anybody with thread experience wouldn't expect it.