I'm assuming Linux, but the process should be similar on other operating systems. You want to look into the kill()
function declared typically declared in the signal.h
header file. This will allow you to send a signal to a specific PID from your zombie killer. The easiest approach would be to send your zombie process a kill signal (SIGKILL
). SIGKILL
cannot be caught or ignored, and immediately kill a process dead.
If you need to do some cleanup in your zombie process, you can create a signal handler with the signal()
function. This will allow you to specify a function to call when a process receives a signal. This function would implement your cleanup code and then exit()
.
On linux, your shell should have a kill command that mimics the functionality of kill()
. The syntax is typically kill -s 9 PID
. This will send a SIGKILL (signal number 9) to the process PID.
I hope this answer nudges you in the proper direction.