httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: Accept Serialization.
Date Tue, 02 Feb 1999 17:55:13 GMT


On Tue, 2 Feb 1999, Ryan Bloom wrote:

> Another solution is to have all threads block on the accept.  Then, you
> take the chance of the OS having a problem with a thundering herd.  If all
> threads block on the accept, and a request comes in, many OS's will wake
> up all of the threads, and then put them back to sleep after the first
> thread has gotten the request.  This causes many many context switches.

But *some* OSs get it right (freebsd for example doesn't have thundering
herd on accept()). 

In my opinion it's wrong to advocate a single solution.  We should
abstract this away and tuck it in a library and allow folks to optimize it
for their configuration.

But yeah we need one solution which is the "default" and yours probably
works.

> BAD :(  There is also the potential, out of pure dumb luck, that two
> threads will get through to the accept loop at once (IBM's last web server
> had this problem when they used this algorithm), this will cause bad
> things to happen.

Sounds like that OS is broken :)

BTW, do folks know how widespread sem_{init,wait,trywait,...} are?  I know
linuxthreads and solaris have them... do all pthreads implementations have
them?  (Any known speed problems with them?)

Dean



Mime
View raw message