I am learning about forks, so I tried the following code to make sure I
had everything down:
#! /usr/bin/perl
use strict;
use warnings;
my $counter = 1;
my $pid = 0;
while ($counter < 50) {
if ($pid = fork) {
open ("FORKED", ">./fork/$counter")
or die("COULD NOT OPEN FORK");
print FORKED $counter;
close("FORKED");
$SIG{CHLD} = "IGNORE";
}
$counter++;
}
I figured this would write 49 files relatively quickly and that would be
the end of it. Running it DOSes a 1Ghz PIII Box I have takes 20 minutes
-- during which time /nothing/ else can be done, i.e. a DOS. Oddly
enough, putting the limit on counter down to 5 runs in less then 0.02s.
So what am I doing wrong?
-Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>