httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: Proposal: Get rid of most accept mutex calls on hybrid server.
Date Tue, 11 May 1999 14:05:30 GMT


On Tue, 11 May 1999, Tony Finch wrote:

> Dean Gaudet <dgaudet@arctic.org> wrote:
> >On Mon, 10 May 1999, Tony Finch wrote:
> >> Dean Gaudet <dgaudet@arctic.org> wrote:
> >> >
> >> >Actually, I suspect that we don't really want to interprocess lock at all
> >> >in the multithreaded server.  We use non-blocking listening sockets, and
> >> >pay the wake-all cost for the small number of processes (we're talking
> >> >like 8 processes, right?) 
> >> 
> >> If there's a select collision isn't *every* process woken up (not
> >> just the httpds)?
> >
> >I'm not sure what you mean...  if a kernel had only one global sleeping
> >queue, yeah... but then there'd be no way for us to avoid thundering herd,
> >since everything would be awakened at all times.  But kernels typically
> >have a lot of sleeping queues... including one on every socket.
> 
> Sorry, I was too terse. The BSD network stack only has space for
> keeping track of one pid select()ing on each socket. If more than one
> child select()s on a listen socket at the same time the kernel cannot
> keep track of them so it doesn't even try: it just marks a collision
> and when a connection arrives on that socket it wakes up every process
> in select().

Hmm, that sucks.  Linux keeps a list of all pids on each socket... it
doesn't cost much, the select() code allocates a page of memory to store
the wait list elements in.  For stuff other than select, the wait list
elements are allocated on the kernel stack.  So even though there's a
dynamic cost to allocating list elements, it's fairly cheap. 

I wonder what solaris does (pretty much the only other platform I care
about ;) 

Dean


Mime
View raw message