Friday, May 24, 2013

Perl's simple parallel processing fork manager


-----------------
fork_manager.pl
-----------------
use Parallel::ForkManager;

#$pm = new Parallel::ForkManager($MAX_PROCESSES);
$pm = new Parallel::ForkManager(33);


foreach my $command (@commands) { $pm->start and next; #fork the child and move next look in parent system( $command ); #child's work $pm->finish; #child ends here };

$pm->wait_all_children; #wait till all children are complete


No comments:

Post a Comment