Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: fork usage

by Marshall (Canon)
on Aug 24, 2009 at 06:16 UTC ( [id://790746]=note: print w/replies, xml ) Need Help??

in reply to fork usage

The classic use of fork() is in client-server applications. The server just listens for new inbound connections and when one is detected, it accepts the connection to this new client and makes a "copy of itself" to handle whatever business this client wants. This "new copy" is known as a child process. The code is simplified as the server doesn't know how many "children" it has and each child deals with one client. Roughly speaking, this "start new copy of myself" is fork(). On Windows, this doesn't quite work this way and details get complicated, but same idea applies. There are a lot of "pesky details" to building good, robust client server applications.

One basic thing is: don't use system() or exec() if you can call a Perl module or function to do what you want. For example, you wouldn't want to call a shell command like 'ls' on Unix or 'dir' on Windows to list a directory.

Any way in programming fork is not a dining utensil, it is more like a "fork in the road".

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-05-28 01:30 GMT
Find Nodes?
    Voting Booth?

    No recent polls found