Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The lifetimes of parent and child processes are usually not the same—either the parent outlives the child or vice versa. This raises two questions:
Who becomes the parent of an orphaned child? The orphaned child is adopted by init, the ancestor of all processes, whose process ID is 1. In other words, after a child’s parent terminates, a call to getppid() will return the value 1. This can be used as a way of determining if a child’s true parent is still alive (this assumes a child that was created by a process other than init).