Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Help with Fork bomb

by cursion (Pilgrim)
on Aug 30, 2012 at 16:07 UTC ( #990791=note: print w/replies, xml ) Need Help??


in reply to Help with Fork bomb

Each fork() duplicates the code that is running. All the variables are duplicated and they are each in a separate process - and most importantly they don't communicate with each other (except for the wait() call). They don't update each other's variables. Each child is acting like like a parent when it starts the next iteration of the loop.

The program you started is managing it's kids properly (limiting kids to 5). However, each child is also acting as a parent and managing kids. Their kids too. And so on.

You start with one process, that makes two, then four, then eight, etc.

This probably isn't what you intended ... you may want to check out a package by the name of Parallel::ForkManager. Find some sample code using that and you might find the light bulb.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://990791]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2020-11-29 17:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?