Re: Linus on Linux, Apache and Threads

Richard Dynes (rdynes@varcom.com)
Tue, 27 Apr 1999 13:01:09 +0000


Tony Gale wrote:
>
> 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)?

I'm interested in this too. Tony's point was my immediate thought:
pthread_cond_signal is an obvious implementation of a solution to the
'thundering herd' problem. But it has apparently been discounted.

I had assumed that this was because of some limitation to the linux
pthread implementation. I had read (somewhere, recently) that linux
pthreads in a process were not scheduled independently by the kernel,
but were scheduled only within that process, thus only get a single
kernel scheduling slot. This is a real limitation. But Matt Ranney
has said on this list that:

<snip> Linux pthreads are all kernel processes, <snip>

True? I'll go find the answers on my own, but I'm curious about the
answer to Tony Gale's question.

-Richard

-- 
    Richard Dynes
    rdynes@varcom.com

- 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/