Subj : Re: trying to understand simultaneous wakeup of all threads on pthreads_cond_broadcast() To : comp.programming.threads From : Joseph Seigh Date : Mon Jan 31 2005 08:30 pm On Tue, 01 Feb 2005 00:01:55 +0100, wrote: > Hello, > > I'm reading through linuxthreads and NPTL source code in glibc and I've > got some difficulties understanding how the simultaneous wakeup of > waiting threads works in linuxthreads. I'd like to post what I think is > the relevant piece of code: > [...] > So how does the linuxthreads implementation guarantee randomness in the > waiting thread selection? Or does POSIX not require randomness for > pthreads_cond_broadcast()? > No randomness or fairness is guaranteed or required. This works as long as there isn't any serious contention. If there is, mutexes tank rather badly. There are mutex implementations that guaranteed fairness, e.g. real time implementations, but at a rather dramatic performance cost. -- Joe Seigh .