Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 17532 invoked by uid 6000); 11 May 1999 14:05:32 -0000 Received: (qmail 17523 invoked from network); 11 May 1999 14:05:30 -0000 Received: from twinlark.arctic.org (204.107.140.52) by taz.hyperreal.org with SMTP; 11 May 1999 14:05:30 -0000 Received: (qmail 561 invoked by uid 500); 11 May 1999 14:05:30 -0000 Date: Tue, 11 May 1999 07:05:30 -0700 (PDT) From: Dean Gaudet To: new-httpd@apache.org Subject: Re: Proposal: Get rid of most accept mutex calls on hybrid server. In-Reply-To: Message-ID: X-Comment: Visit http://www.arctic.org/~dgaudet/legal for information regarding copyright and disclaimer. MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org On Tue, 11 May 1999, Tony Finch wrote: > Dean Gaudet wrote: > >On Mon, 10 May 1999, Tony Finch wrote: > >> Dean Gaudet 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