in reply to Re: Re: Threads, Forks, or Nothing?
in thread Threads, Forks, or Nothing?

The trick there is to have your children ready before you accept. Basically you fork multiple times, then the parent sits on the socket. The moment you get a connection you just start writing to the children. In this case you would probably just have the children blocking on reads from the pipe to the parent.

The Apache webserver does this to improve it's response times to connections. If you look at the process table while apache is running, you will see MAX_SERVERS + 1 processes. That's the parent with MAX_SERVERS children standing by.

____________________
Jeremy
I didn't believe in evil until I dated it.