fdegir has asked for the wisdom of the Perl Monks concerning the following question:
OS is solaris10. Any comments?#!/usr/bin/env perl for($i = 1; $i < 6; $i++){ my $pid = fork(); if($pid){ print "INFO\t: Started job $i (PID: $pid)\n"; push @childs, $pid; }elsif($pid == 0){ pJob($i); exit 0; }else{ die "ERROR\t: Can not fork:$!\n"; } } for(@childs){ my $tmp = waitpid($_, 0); } sub pJob($){ my $id = shift; `touch /tmp/file_$id`; print "INFO\t: Done with job $i\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with Parallel Processes
by almut (Canon) on May 31, 2010 at 14:40 UTC | |
|
Re: Problem with Parallel Processes
by JavaFan (Canon) on May 31, 2010 at 14:43 UTC |