Chris,
What Nick said:
Both parent and child resume/start executing at the next instruction, which is the if() test. The child gets a return value of 0 from fork() whereas the parent gets a non-zero positive value.
More specifically: The parent gets the PID of the child process. So if you need to fork a whole bunch of children and keep track of them, you can read back the return result of fork() and then shove it in some kind of array or structure. You can then send signals to the children as required.
Some long-running processes do things like this -- fork a bunch of children and hand them requests on some kind of load-balancing or round-robin basis, then once a child process has done enough work kill it off and fork a new one to tidy up any possible memory leaks.
Del -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
