In Linux kernel
, the process descriptor
of a process is removed from the system by invoking the release_task()
function, after the process has terminated.
I believe, the wait()
system call issued by the parent process on the child process invokes the release_task()
function when the child process terminates.
Suppose the parent process does not issue a wait()
system call explicitly, how is release_task()
function invoked and the process descriptor of the child process deallocated?
If the parent process does not wait(2)
for a child process, the child becomes a zombie
. As long as the parent lives, the child cannot be reaped. When the parent dies, all his un-waited children are adopted by init
. One of the jobs of init
is to periodically wait for children (thereby freeing associated resources)