in reply to Forking Issues
Having said that, the way this is written it appears to me that you only ever fork one child process at a time, always waiting for that to complete before doing the next. I fail to see how this will get the improvement you are hoping for.
Maybe you should think about moving the waitpid() call to outside the inside while loop and use waitpid(-1,&WNOHANG) to wait for all child processes as documented in the Camel book.
But thinking about it you probably want to limit the number of child process to some fixed number (eg 10 or 20), so the solution becomes a bit more complicated than that.....
I hope I'm not way off the track here as I haven't used fork() much myself either.
Cheers!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Forking Issues
by mildside (Friar) on Aug 07, 2003 at 05:31 UTC | |
by satanklawz (Beadle) on Aug 07, 2003 at 17:14 UTC |