How to create a Dummy Zombie Process in C Programming Language on Debian 10

A zombie process is a type of process that has been completed, but whose entry still remains in the process table due to lack of communication between the child and parent process. The small program developed in this tutorial can be useful for learning purposes. E.g. when it comes to detecting zombie processes under Linux.

In this tutorial, I will create a dummy zombie process in Debian 10.

Creating a Dummy Zombie Process in Debian 10

Open the notepad and paste the following code.

#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main ()
pid_t child_pid;child_pid = fork ();
if (child_pid > 0) {
sleep (120);
else {
exit (0);
return 0;

Save this file as zombie.c.  The zombie process created with this code will run for 120 seconds. You can adjust the time duration (in seconds) in the sleep function.

Next, open the terminal and run the following command to compile the above code.

cc zombie.c -o zombie

After this command, an executable objective file should have been created in your current directory.

Run the zombie file:


When you execute the following command with grep, you will get the parent ID of the zombie process.

ps axo stat,ppid,pid,comm | grep -w defunct

So this is how you create a dummy zombie process in Debian 10. I hope you have no difficulty in following this tutorial.