Parent and Child Lifetimes
Due to the nature of fork(), every process has exactly one parent process, while a parent can have multiple child processes. Unix enforces the rule that, while any process might or might not have children, every process always has a parent process. If a child process’ parent exits before the child does, then the child process is adopted by process 1. Under most Unixes, this is the init process; under Mac OS X, it is the versatile launchd.
When a child process exits, that is not the end of it. After a process terminates, the operating system keeps some information associated with it alive, such as its exit code and system resource usage statistics. Only after this information has been delivered to the child’s parent ...
Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.