 vote
 |
|
A fork() system call in code that is not thoroughly thought out is a truly dangerous thing...
Of course, there are all kinds of gotchas you must deal with when fork()ing processes or else your sysadmin will get irate with you when you fill of the system process table and they have to punch the reset button on the machine.
First of all, you should know something of process behavior under Unix. When a process dies, it doesn't really go away completely. It's dead, so it's no longer running, but a small remnant is waiting around for the parent process to pick up. This remnant contains the return value from the child process and some other goop. So after a parent process fork()s a child process, it must wait() (or waitpid()) for that child process to exit. It is this act of wait()ing that allows all remnants of the child to vanish.
| | |
| |
|
|