in reply to
Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
I know you're using P::FM. However, I have to wonder if this would be easier to do with AnyEvent. I'm not entirely sure, as after about 10 minutes, I still don't have example code quite working :-) but maybe it's something to start with.
use AnyEvent::Util qw(run_cmd);
# set up my condvars
my $all_done = AE::cv;
$all_done->begin for 1..50;
my $ten = AE::cv;
# start the first 10...
start_ten($ten, $all_done, $_) for 1..2;
# wait for all of them to finish.
my $t = shift;
my $all = shift;
my $one = shift;
state $started = 0;
# 10/100 too much for my machine...
my $proc = $started;
$t->begin if $one == 1;
my $cv = run_cmd(
'>' => File::Spec->devnull(),
'2>' => File::Spec->devnull(),
'<' => File::Spec->devnull(),
my $c = shift;
my $rc = $c->recv();
print "Finished $proc: $rc\n";
# when we're done, start the next ten.
my $c = shift;
print "Checking next group...($started)\n";
$all->ready() or start_ten($t, $all, 1)
There is some tweaking required - this will start the first two groups of five, and wait - once the first five come in, it goes and starts the rest. It's not waiting properly. There is also AnyEvent::Util::fork_call which is quite similar to what you want to do, and you may be able to adapt its methods to what you want to do while still leaving much of the heavy lifting to AnyEvent.
Note that 100 processes being kicked off can do serious damage to your system's responsiveness. Hopefully you have the requisite CPU/RAM :-)