Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Fork Information

by koolade (Pilgrim)
on Jun 14, 2001 at 22:42 UTC ( #88567=note: print w/replies, xml ) Need Help??

in reply to Fork Information

Maybe not as thorough as you'd like, but I think the first place you should lok (if you haven't already) is the perl docs for fork. It also links to perlipc which also has some good related information.

Replies are listed 'Best First'.
Re: Re: Fork Information
by hackmare (Pilgrim) on Jun 15, 2001 at 13:37 UTC


    I often find the explanations for fork to be usually a little self-imporant (as they were for me when I got started).

    Here's teh babble-free version of fork as it was originally explained to me

    Your program runs instructions sequentially, like a car driving by itself down the road, where each traffic event (stop light, intersection, traffic sigh) is the equivalent of a code instruction (such as print "hello,world.\n") in the source code.

    When you fork, you are cloning your car and giving the clone its own identity, and telling each car about the existance of the other car.

    What happens now is that each car starts going down the same road (the same code, starting from the fork command) in parallel, at first, until the second car finds an instruction telling it to do something based on its identity as the second car (the child)

    And this goes on until something tells one of the cars (the parent or the child) to dissapear.

    Now, something to consider is that this second car takes a lot of energy to generate (and a fork ahs a fair bit of overhead at first).

    I hope you dont find this explanation too pedantic.
    For a real explanation, refer to the doc as advised by the others.


      Not pedantic at all (unless you meant the good connotation of pedantic) I finally understand what fork is all about.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2022-08-18 20:19 GMT
Find Nodes?
    Voting Booth?

    No recent polls found