httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: flock() question (fwd)
Date Fri, 28 Nov 1997 18:47:22 GMT
You always need locking if there are multiple Listen statements.
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 <dg@root.com>
> To: Marc Slemko <marcs@znep.com>
> Cc: Charles Mott <cmott@srv.net>, 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
> 
> 


Mime
View raw message