Are not uncommon on a Unix system. In essence a zombie proces is a finished process that still has an entry in the process table with the exit code. They don’t exist in memory anymore and don’t utilise any system resources.
As soon as the processes parent requests the exit code from the process table the entry will be removed.
Demonstration of zombie proces
This behaviour can be demonstrated easily with a small shell script. The shell script will launch two processes in the background that will complete in a couple of seconds.
Before the complete their parent process will be stopped (paused). As a result the parent will never request the exit code leaving the two processes as zombies on the system.
If you resume the stopped process it will request those entries and hence, the zombies are gone.
Script to create a zombie proces
I use the following script.
# Demonstration of Zombie processes.
# This script will create child processes that will 'run' several seconds.
# Before the child processes terminate the script will have paused itself.
# As a result it will never request the exit codes of its child processes.
# Hence, we've got Zombies.
echo "When this script has finished you should be able to find two zombie processes"
sleep 5 &
sleep 15 &
# Pause the main script and be patient. One process becomes a zombie in a matter of seconds.
# The other process takes more time to complete and become a zombie.
echo "Type the command: ps aux | grep sleep a couple of times until both processes are zombies"
echo "Type kill -SIGCONT $OUR_PID to resume the parent process"
# Don't stop to quick, allow the system time to create the processes.
kill -SIGSTOP $OUR_PID
Disclaimer: All information posted is written with the upmost care and valid at the time of writing. Changes in versions can supersede the provided information. Please use your own judgement.