Re: Linus on Linux, Apache and Threads

Ramakrishna K (ramak@wipinfo.soft.net)
Tue, 27 Apr 1999 14:08:06 +0530 (IST)


>
> Can I just get some clarification here. pthread_cond_signal is
> defined as waking *one* thread, thus:
>
> pthread_cond_signal restarts one of the threads that are
> waiting on the condition variable cond. If no threads are
> waiting on cond, nothing happens. If several threads are
> waiting on cond, exactly one is restarted, but it is not
> specified which.
>
> Are you saying that the kernel will in fact wake up *all* the threads
> (either just internally, or in actuality)?
In implementations i know off, the first in the queue waiting for the cond
variable to be signalled is restarted. But depending on the implementation
one can considering waking up a thread so as to utilise the system resources
in a * optimal * manner.

This is all the more true, because, if multiple threads are waiting for a
condition to occur and only one pthread_cond_signal comes in, the signalling
thread is not intersted in waking up any * particular * thread.

thanks,
Rama.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/