What is Zombie process and How to create zombie process in Linux ?

Zombie process is the process which died immediately and whose parent didn’t cared to handled the status of child death. When a child process exits, it is not immediately cleared off the process table. Instead, a signal is sent to its parent process, which needs to acknowledge it’s child’s death, and only then the child process is completely removed from the system. If a parent is not written by taking care of handling acknowledgement from child, the child becomes zombie.

Such process’s continues to run in


state till the parent is exited completely.

$ vim create_zombie.c
int main(int argc, char **argv) {
        pid_t child_pid;
        int child_status;

        child_pid = fork();
        switch (child_pid) {
                case -1:
                        printf("error: we can use perror\n");
                case 0:
                        printf("child is getting dead immediately\n");
                        printf("parent process continuing to execute, but not cared of child is dead or alive\n");
                        sleep (180);
        return 0;

you can run below program as,

$ gcc -o our_zombie_child create_zombie.c
$ ./our_zombie_child

This program makes parent goes sleep for 180 sec, meantime child has already died, but parent process doesn’t handles the child’s death since it was already in sleep ( normally this child death report needs to handled using signal in parent process )

Related :   How to execute a command in Linux using C program ?

so now, you can open another terminal and type

$ ps -ax | grep defunct
5208 pts/1    Z+     0:00 [our_zombie_chil] defunct

where “ps” command showed, child process which we created became zombie. [ as indicated by defunct ]


Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )


1 thought on “What is Zombie process and How to create zombie process in Linux ?”

Leave a Comment

Android Android Applications Android Build system Android Commands Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded