Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 19542 invoked by uid 6000); 28 Nov 1997 18:49:27 -0000 Received: (qmail 19535 invoked from network); 28 Nov 1997 18:49:25 -0000 Received: from valis.worldgate.com (marcs@198.161.84.2) by taz.hyperreal.org with SMTP; 28 Nov 1997 18:49:25 -0000 Received: from localhost (marcs@localhost) by valis.worldgate.com (8.8.7/8.8.7) with SMTP id LAA27614 for ; Fri, 28 Nov 1997 11:49:24 -0700 (MST) Date: Fri, 28 Nov 1997 11:49:24 -0700 (MST) From: Marc Slemko To: TLOSAP Subject: Re: flock() question (fwd) In-Reply-To: Message-ID: 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 Fri, 28 Nov 1997, Dean Gaudet wrote: > You always need locking if there are multiple Listen statements. Let me rephrase what I said: "if using a FreeBSD box of recent 2.2 vintage and you don't need accept locking because you aren't using multiple Listen statements..." Yes, I mean what you say. > Otherwise FreeBSD has broken accept() semantics. Our select()/accept() > loop is not designed for multiple tasks when there are multiple sockets. > You end up starving sockets because children will block on a single > socket and not wake up until they manage to get a request on that socket; > meanwhile requests may be ready on other sockets and go unserviced. > > Defining SAFE_UNSERIALIZED_ACCEPT is fine with me, that only affects > the single socket case. > > Dean > > On Fri, 28 Nov 1997, Marc Slemko wrote: > > > FYI, if using a FreeBSD box of recent 2.2 vintage and you don't need > > accept locking to handle multiple Listen statements, you may (or may not) > > get better performance with many children using SAFE_UNSERIALIZED_ACCEPT. > > > > This is because for each accept() only one child is woken up, but whenever > > a process fights for a flock(), they all wake up. > > > > ---------- Forwarded message ---------- > > Date: Fri, 28 Nov 1997 03:07:25 -0800 > > From: David Greenman > > To: Marc Slemko > > Cc: Charles Mott , hackers@FreeBSD.ORG > > Subject: Re: flock() question > > > > >Hmm. It looks like if you have multiple processes blocked on the > > >same lock in FreeBSD (well, 2.2 anyway), they are all woken up when > > >the lock is freed. Yes, only one will get the lock but they will > > >all be woken. Unless I am reading the code wrong... This is in > > >contrast to multiple processes blocking in accept(), where only > > >one will be woken up. > > > > The optimized wakeup case for accept() is that way because I optimized > > it. :-) You're probably right about flock(), but I haven't gotten around to > > looking at that and other potential wakeup optimizations. Changes like that > > have to be made with great care...what seems obvious often doesn't turn out > > that way. :-) > > > > -DG > > > > David Greenman > > Core-team/Principal Architect, The FreeBSD Project > > > > >