Here's a skeleton from something I've used successfully for dealing with large numbers of processes by forking a limited number in parallel.
--Bob Niederman, http://bob-n.com# UNTESTED # @srvrs is potentially LARGE array of servers to test # $frk is maximum number of processes to fork at one time. while ( @srvrs ) { SRVR: for (1..$frk) { $x = shift @srvrs or last SRVR; $pid = fork; if ( $pid ) { push @pids, $pid } elsif ( defined $pid ) { # DO thing with $x you want parallelized (testing servers +) here exit; } else + { die "fork failed\n"; } } waitpid($_, 0) for ( @pids ); }
In reply to Re: Forking Issues
by bobn
in thread Forking Issues
by satanklawz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |