A system and method is provided for using a kernel exit routine, performed
when a parent process exits, to efficiently remove zombie child
processes. The kernel exit routine also re-parents active child processes
to a standard system process, such as the init process. When the kernel
exit routine re-parents the active child process to the init process, the
child process is flagged indicating that the child's original parent
process has already exited. A kernel routine, such as the swapper
process, periodically cleans up flagged processes that have exited. In
this manner, although active child processes are still re-parented to
init, the init process is no longer burdened with the task of waiting on
such processes when they exit.