in reply to Running parallel processes without communication

C'mon vit, this is NOT your first day on the job at the Monastery. In fact, it's a bit past your thousandth.

What have you tried? Where's your code? What have you searched for?

  • Comment on Re: Running parallel processes without communication

Replies are listed 'Best First'.
Re^2: Running parallel processes without communication
by vit (Friar) on Jan 03, 2011 at 22:51 UTC
    Alright :)
    Would this be correct. Looks like it works:
    use strict; my $pid = fork(); if($pid == 0) { `perl write.pl f1.txt`; exit(0); } my $pid = fork(); if($pid == 0) { `perl write.pl f2.txt`; exit(0); } exit(0); ### where write.pl is: use strict; my $file = $ARGV[0]; open OF, ">$file" or die "cannot open file $file\n"; for(1..10) {print OF time()."\n"; sleep 1} exit(0);
    The time printed in files overlaps.