in reply to Re^2: Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
in thread Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
You are mostly right, in the end he does want to run 1000 jobs, but only have 100 at a time max and in blocks of 10.
When calling P::FM you declare how many forks you want to run. In the main method:
my $max_children = 100; my $job_size = 10; my $main_pfm = P::FM->new( $max_children/$job_size );
So that is 100/10 which is 10 job blocks at the same time. Since the job size is 10, then that is 100 jobs at the same time.
my $total_children = 1000; my $job_size = 10; foreach ( 1..$total_children/$job_size ) {
So then we loop through our data (F::PM blocks if there is no avalible slots) 1000/10 is 100. So the main method loops through 100 job blocks while only running 10 blocks at a time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
by anshumangoyal (Scribe) on Dec 01, 2011 at 18:51 UTC | |
by admiral_grinder (Pilgrim) on Dec 01, 2011 at 20:23 UTC | |
by runrig (Abbot) on Dec 01, 2011 at 20:19 UTC |