Is there a way to kill a zombie process? I've tried calling exit
to kill the process and even sending SIGINT
signal to the process, but it seems that nothing can kill it. I'm programming for Linux.
Additionally, you can also kill the zombie process by sending the SIGCHLD signal to the parent process to make the parent process exit cleanly with its zombie process.
Zombie processes are already dead, so they cannot be killed, they can only be reaped, which has to be done by their parent process via wait*() . This is usually called the child reaper idiom, in the signal handler for SIGCHLD : while (wait*(...
By ignoring the 'SIGCHLD' signal: When a child is terminated, a corresponding SIGCHLD signal is delivered to the parent, if we call the 'signal(SIGCHLD,SIG_IGN)', then the SIGCHLD signal is ignored by the system, and the child process entry is deleted from the process table Thus, no zombie is created.
Nearly all zombie survivalists are in agreement that the destruction of the brain is the only surefire way to neutralize the zombie (though a few rare types of zombies require complete dismemberment).
Zombie processes are already dead, so they cannot be killed, they can only be reaped, which has to be done by their parent process via wait*()
. This is usually called the child reaper
idiom, in the signal handler for SIGCHLD
:
while (wait*(... WNOHANG ...)) {
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With