[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Zombie processes
Doron Zifrony wrote:
> Every Unix process that finish running is returning a status. That's the
> value the program passes to the exit() system call, or the value returned
> by the routine main().
> A process does not get erased from the process table until its parent
> receives the process termination status via the wait() system call or its
> derivatives (like wait3(), wait4()). Until this wait() system call is
> being performed, the process ramins a zombie (or defunct, another name for it).
>
> I have no idea who the father process for the modprobe program is. If it is
> some system process, then if it needs to keep running there's nothing you
> can do to remove the Zombies. If it is dispensable, then you can terminate
So far so true (including the first paragraph).
> the father process, like Shlomi suggested, and its father process (perhaps
> a shell or init) may do a wait() which will clean up the process table.
Bzzzt! Wrong. :-)
When a process dies, all its children get inherited by init (process 1),
which knows about its special status and will handle SIGCHLD (SIGCLD)
correctly. (just think of the reasoning - if it was the way you describe
it then every program which does a simple "system(3)" or fork(2) should
have
had to handle SIGCHLD, just in case one of its descendents didn't
wait(2)
on its own descendents)
You can find the parent process' id (PPID) in the 'l' output format
of "ps".
Cheers,
--Amos
Follow-Ups:
References: