We have discussed Three methods of Zombie Prevention. This article is about one more method of zombie prevention.
Zombie Process: A process which has finished the execution but still has entry in the process table to report to its parent process is known as a zombie process. A child process always first becomes a zombie before being removed from the process table.
How Creating a Grandchild / Double Forking helps?
- The parent calls wait and creates a child. The child creates a grandchild and exits.
- The grandchild executes its instruction(task) and eventually it terminates. As the child has already exited, the grandchild will be taken care by init process.
- Init collect the exit status of grandchild. Hence the grandchild is not a zombie.
Note: Child is not a zombie as the parent called wait. Also in this case, the parent cannot verify the exit status of grandchild.
This article is contributed by Pramod Kumar. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- How to execute zombie and orphan process in a single program?
- Zombie and Orphan Processes in C
- Zombie Processes and their Prevention
- Create n-child process from same parent process using fork() in C
- Pass the value from child process to parent process
- Difference between float and double in C/C++
- Modulus of two float or double numbers
- C program to find the size of int, float, double and char
- What is the difference between single quoted and double quoted declaration of char array?
- C program to print a string without any quote (singe or double) in the program
- Get/Set process resource limits in C
- Communication between two process using signals in C
- MCQ on Memory allocation and compilation process
- Creating multiple process using fork()
- Calculation in parent and child process using fork()