P is for Practical | |
PerlMonks |
Re^2: strange behaviour when forking lots of times (1<<$N)by tye (Sage) |
on May 16, 2006 at 15:13 UTC ( [id://549792]=note: print w/replies, xml ) | Need Help?? |
No, it forks about 2**11 processes. The first time through the loop, it forks once, creating two processes that each have 9 items left to do. The next time, the 2 processes become 4 that each have 8 items left to do. Then 4 become 8 that each have 7 items left to do... For a total of 2*(2**$N-1). And the whole run takes a fraction of second. (: - tye
In Section
Seekers of Perl Wisdom
|
|