httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <>
Subject Re: Comments on accept-mutex/single-listen patch ??
Date Wed, 29 Aug 2001 17:57:44 GMT
On 29 Aug 2001, Jeff Trawick wrote:

> Jim Jagielski <> writes:
> > At 11:00 AM -0400 8/28/01, Jeff Trawick wrote:
> > >
> > >HAVE_NONE_xxx means that you can turn the accept mutex into a no-op,
> > >even in the multiple-listener case.  If we can play around with this
> > >on one platform (e.g., Darwin), why can't we play around with this
> > >everywhere?
> > 
> > Because, at least with the systems I've been testing, it appears to
> > work OK on OS X, and, as such, we should allow others to have the
> > choice. I've no idea if it works under IRIX, and having it as
> > a compiled default implies that we've tested it as such... Basically,
> > I want people to be able to use any of the compiled-in methods and
> > have Apache work (maybe not the fastest, but at least we know it
> > works). If we find out that NONE is supported and viable on
> > other platforms, we'll change things to make it a compiled default,
> > but it's premature to do it *now* without that knowledge.
> how would it not work?  fubar kernel?

Woah.  Hang on here.  Lets step back a second... is someone saying 
that we don't need an accept mutex with multiple listen sockets on 
some platform?  That is completely bogus, given the current code.  
Hopefully I am just misunderstanding what people are saying, but...
a bit of background:

The original reason for the accept mutex was because some OSes can not
handle having multiple processes calling accept() on the same socket at
the same time because the kernel just doesn't support it.  Many
traditional sysv kernels exhibit this behaviour, for example.  Most
"modern" OSes do not.

Later, it also became obvious that it was necessary to avoid
deadlocks (well, starvation anyway) with the multiple listener case
due to a race between select() and accept().  Well, actually, there
are other workarounds for this issue that don't involve a mutex
but they may well not be any less expensive and, in any case, are
not implemented.

The single listen unserialized accept was added as an optimization on
those platforms we know don't have problems with multiple threads in
accept() at once (especially those without the thundering herd
problem... although comparing the cost of the scheduler overhead from
thundering heard with the mutex overhead and implementation isn't easy),
to be used only in the case of a single listener because the starvation
problems do not occur there.

So I don't see how "NONE" is viable on _ANY_ platform in the multiple
listener case.  It may seem to "mostly" work, but it is not reliable and
can not be permitted.

View raw message