Link to home
Start Free TrialLog in
Avatar of warrior32
warrior32Flag for Afghanistan

asked on

parallel forkmanager how do I know it forked

I'm using the parallel forkmanager in Perl, when I do
my $pid = $pm->start and next;

the value of $pid is 0 and when I use top or ps to see the processes running I only see one perl process executing. How do I know for sure it did fork all threads specified (3 from my code) Below is my code.

my $start_time = time;
my $pm = new Parallel::ForkManager(3);

#run for 10 seconds
while(time - $start_time<=10){

  my $pid = $pm->start and next;
  print "pid = $pid\n";

   my $ranID = getRandomID(@IDS);

   system("php test.php $ID $ranID");
   $pm->finish;
}
ASKER CERTIFIED SOLUTION
Avatar of gremwell
gremwell

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial