🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 103 (from laksa084)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

đź“„
INDEXABLE
âś…
CRAWLED
5 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.2 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://www.geeksforgeeks.org/operating-systems/zombie-processes-prevention/
Last Crawled2026-04-01 11:49:58 (5 days ago)
First Indexed2025-07-05 13:33:43 (9 months ago)
HTTP Status Code200
Meta TitleZombie Processes and their Prevention - GeeksforGeeks
Meta DescriptionYour All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more., Your All-in-One Learning Portal. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
Meta Canonicalnull
Boilerpipe Text
Last Updated : 23 Jul, 2025 A zombie process is a process that has completed its execution but still remains in the process table because its parent process has not yet read its exit status. It is called a "zombie" because it is no longer active or running, but it still exists as a placeholder in the system. Zombie processes do not consume system resources like CPU or memory, but they can clutter the process table if not handled properly, especially if many zombie processes accumulate. A zombie process occurs when a child process finishes but the parent process has not called wait() to read its status. It is not an active process and does not consume CPU or memory but it can still occupy an entry in the process table. Too many zombie processes can cause issues by filling up the process table, limiting the creation of new processes. Entry of child process remains in the process table until the parent process retrieves the exit status. During this time, the child process is referred to as a zombie process . This happens because the operating system keeps the process table entry to allow the parent to gather information about the terminated child. Example let's see an example of Zombie Process: // A C program to demonstrate working of // fork() and process table entries. #include <stdio.h> #include <unistd.h> #include <sys/wait.h> #include <sys/types.h> int main () { int i ; int pid = fork (); if ( pid == 0 ) { for ( i = 0 ; i < 20 ; i ++ ) printf ( "I am Child \n " ); } else { printf ( "I am Parent \n " ); while ( 1 ); } } Output :   Now check the process table using the following command in the terminal $ ps -eaf Here the entry [a.out] defunct shows the zombie process. Why do we need to prevent the creation of the Zombie process?   There is one process table per system. The size of the process table is finite. If too many zombie processes are generated, then the process table will be full. That is, the system will not be able to generate any new process, then the system will come to a standstill. Hence, we need to prevent the creation of zombie processes. Prevention to Zombie Process Zombie processes can be prevented by ensuring proper cleanup of child processes after they terminate. Preventing Zombie Process helps maintain a clean process table and prevents system issues caused by lingering zombie processes. Different techniques to prevent zombie process are: Using wait() system call By ignoring the 'SIGCHLD' signal By using a signal handler Double fork Using the waitpid() system call 1. Using wait() system call When the parent process calls wait(), after the creation of a child, it indicates that, it will wait for the child to complete and it will reap the exit status of the child. The parent process is suspended(waits in a waiting queue) until the child is terminated. It must be understood that during this period, the parent process does nothing just wait. (Point 2. is wrong and doesn't prevent zombie creation,  its the job of parent process to remove the child process from process list and is not done by the kernel, infact SIG_IGN is the default handler for SIGCHLD signal to the parent process). 2. By ignoring the 'SIGCHLD' signal When a child is terminated, a corresponding SIGCHLD signal is delivered to the parent, if we call the 'signal(SIGCHLD,SIG_IGN)', then the SIGCHLD signal is ignored by the system, and the child process entry is deleted from the process table Thus, no zombie is created. However, in this case, the parent cannot know about the exit status of the child. 3. By using a signal handler The parent process installs a signal handler for the SIGCHLD signal. The signal handler calls wait() system call within it. In this scenario, when the child terminated, the SIGCHLD is delivered to the parent. On receipt of SIGCHLD, the corresponding handler is activated, which in turn calls the wait() system call. Hence, the parent collects the exit status almost immediately and the child entry in the process table is cleared. Thus no zombie is created. Output: Here no any [a.out] defunct i.e. no Zombie process is created. 4. Double fork This involves creating a grandchild process which is then orphaned by the parent process. This ensures that the grandchild process is inherited by the init process, which reaps it automatically. This prevents the creation of a zombie process. 5. Using the waitpid() system call This system call is similar to the wait() system call, but it allows the parent process to wait for a specific child process to terminate. This way, the parent can collect the exit status of the child and prevent the creation of a zombie process. Zombie vs Orphan Process A zombie process is a process that has completed its execution but still exists in the process table because its parent process hasn’t read its exit status. It’s not active or using resources, but it remains as an entry in the system. On the other hand, an orphan process is a process whose parent has terminated while the child is still running. Orphan processes are adopted by the init process (or its equivalent), which takes responsibility for them to ensure they continue running smoothly. The key difference is that zombies are finished processes waiting to be cleaned up, while orphans are still active and working without their original parent. read more about - Zombie and Orphan Processes Conclusion A zombie process is when a child process terminates but remains in the process table because its parent has not picked up its exit status. It doesn’t consume CPU or memory but can fill up the process table and cause issues if many zombie processes are present. Understanding zombie processes through code examples helps you to recognize them and fix them. To prevent zombie processes the parent process should use functions like wait() or waitpid() to clean up child processes or use signal handlers like SIGCHLD to automatically reap terminated child processes.
Markdown
[![geeksforgeeks](https://media.geeksforgeeks.org/gfg-gg-logo.svg)](https://www.geeksforgeeks.org/) ![search icon](https://media.geeksforgeeks.org/auth-dashboard-uploads/Property=Light---Default.svg) - Sign In - [Courses]() - [Tutorials]() - [Interview Prep]() - [OS Tutorial](https://www.geeksforgeeks.org/operating-systems/operating-systems/) - [Interview Questions](https://www.geeksforgeeks.org/operating-systems/operating-systems-interview-questions/) - [Quizzes](https://www.geeksforgeeks.org/quizzes/50-operating-system-mcqs-with-answers/) - [Notes](https://www.geeksforgeeks.org/operating-systems/last-minute-notes-operating-systems/) - [System Call](https://www.geeksforgeeks.org/operating-systems/introduction-of-system-call/) - [Paging](https://www.geeksforgeeks.org/operating-systems/paging-in-operating-system/) - [Virtual Memory](https://www.geeksforgeeks.org/operating-systems/virtual-memory-in-operating-system/) - [Deadlock Handling](https://www.geeksforgeeks.org/operating-systems/handling-deadlocks/) - [DBMS](https://www.geeksforgeeks.org/dbms/dbms/) - [Computer Network](https://www.geeksforgeeks.org/computer-networks/computer-network-tutorials/) # Zombie Processes and their Prevention Last Updated : 23 Jul, 2025 A ****zombie process**** is a process that has completed its execution but still remains in the process table because its parent process has not yet read its exit status. It is called a "zombie" because it is no longer active or running, but it still exists as a placeholder in the system. Zombie processes do not consume system resources like CPU or memory, but they can clutter the process table if not handled properly, especially if many zombie processes accumulate. - A zombie process occurs when a child process finishes but the parent process has not called `wait()` to read its status. - It is not an active process and does not consume CPU or memory but it can still occupy an entry in the process table. - Too many zombie processes can cause issues by filling up the process table, limiting the creation of new processes. ![zmb](https://media.geeksforgeeks.org/wp-content/uploads/20250116110406721449/zmb.webp) - Entry of child process remains in the process table until the parent process retrieves the exit status. During this time, the child process is referred to as a ****zombie process****. This happens because the operating system keeps the process table entry to allow the parent to gather information about the terminated child. ## Example let's see an example of Zombie Process: C `` ****Output :**** ![zombie1\_1](https://media.geeksforgeeks.org/wp-content/uploads/zombie1_1.png) Now check the process table using the following command in the terminal ****\$ ps -eaf**** ![zombie1\_2](https://media.geeksforgeeks.org/wp-content/uploads/zombie1_2.png) Here the entry ****\[a.out\] defunct**** shows the zombie process. ****Why do we need to prevent the creation of the Zombie process?**** There is one process table per system. The size of the process table is finite. If too many zombie processes are generated, then the process table will be full. That is, the system will not be able to generate any new process, then the system will come to a standstill. Hence, we need to prevent the creation of zombie processes. ## Prevention to Zombie Process Zombie processes can be prevented by ensuring proper cleanup of child processes after they terminate. Preventing Zombie Process helps maintain a clean process table and prevents system issues caused by lingering zombie processes. Different techniques to prevent zombie process are: 1. Using wait() system call 2. By ignoring the 'SIGCHLD' signal 3. By using a signal handler 4. Double fork 5. Using the waitpid() system call ### ****1\. Using wait() system call**** When the parent process calls wait(), after the creation of a child, it indicates that, it will wait for the child to complete and it will reap the exit status of the child. The parent process is suspended(waits in a waiting queue) until the child is terminated. It must be understood that during this period, the parent process does nothing just wait. C `` ``` // A C program to demonstrate working of ``` ``` // fork()/wait() and Zombie processes ``` ``` #include<stdio.h> ``` ``` #include<unistd.h> ``` ``` #include<sys/wait.h> ``` ``` #include<sys/types.h> ``` ``` ​ ``` ``` int main() ``` ``` { ``` ``` int i; ``` ``` int pid = fork(); ``` ``` if (pid==0) ``` ``` { ``` ``` for (i=0; i<20; i++) ``` ``` printf("I am Child\n"); ``` ``` } ``` ``` else ``` ``` { ``` ``` wait(NULL); ``` ``` printf("I am Parent\n"); ``` ``` while(1); ``` ``` } ``` ``` } ``` (Point 2. is wrong and doesn't prevent zombie creation, its the job of parent process to remove the child process from process list and is not done by the kernel, infact SIG\_IGN is the default handler for SIGCHLD signal to the parent process). ### ****2\. By ignoring the 'SIGCHLD' signal**** When a child is terminated, a corresponding SIGCHLD signal is delivered to the parent, if we call the 'signal(SIGCHLD,SIG\_IGN)', then the SIGCHLD signal is ignored by the system, and the child process entry is deleted from the process table Thus, no zombie is created. However, in this case, the parent cannot know about the exit status of the child. C `` ``` // A C program to demonstrate ignoring ``` ``` // SIGCHLD signal to prevent Zombie processes ``` ``` #include<stdio.h> ``` ``` #include<unistd.h> ``` ``` #include<sys/wait.h> ``` ``` #include<sys/types.h> ``` ``` ​ ``` ``` int main() ``` ``` { ``` ``` int i; ``` ``` int pid = fork(); ``` ``` if (pid == 0) ``` ``` for (i=0; i<20; i++) ``` ``` printf("I am Child\n"); ``` ``` else ``` ``` { ``` ``` signal(SIGCHLD,SIG_IGN); ``` ``` printf("I am Parent\n"); ``` ``` while(1); ``` ``` } ``` ``` } ``` ### ****3\. By using a signal handler**** The parent process installs a signal handler for the SIGCHLD signal. The signal handler calls wait() system call within it. In this scenario, when the child terminated, the SIGCHLD is delivered to the parent. On receipt of SIGCHLD, the corresponding handler is activated, which in turn calls the wait() system call. Hence, the parent collects the exit status almost immediately and the child entry in the process table is cleared. Thus no zombie is created. C `` ``` // A C program to demonstrate handling of ``` ``` // SIGCHLD signal to prevent Zombie processes. ``` ``` #include<stdio.h> ``` ``` #include<unistd.h> ``` ``` #include<sys/wait.h> ``` ``` #include<sys/types.h> ``` ``` ​ ``` ``` void func(int signum) ``` ``` { ``` ``` wait(NULL); ``` ``` } ``` ``` ​ ``` ``` int main() ``` ``` { ``` ``` int i; ``` ``` int pid = fork(); ``` ``` if (pid == 0) ``` ``` for (i=0; i<20; i++) ``` ``` printf("I am Child\n"); ``` ``` else ``` ``` { ``` ``` signal(SIGCHLD, func); ``` ``` printf("I am Parent\n"); ``` ``` while(1); ``` ``` } ``` ``` } ``` ****Output:**** ![zom\_final](https://media.geeksforgeeks.org/wp-content/uploads/zom_final.png) Here no any ****\[a.out\] defunct**** i.e. no Zombie process is created. ### ****4\. Double fork**** This involves creating a grandchild process which is then orphaned by the parent process. This ensures that the grandchild process is inherited by the init process, which reaps it automatically. This prevents the creation of a zombie process. C `` ``` // A C program to demonstrate double fork ``` ``` #include <stdio.h> ``` ``` #include <stdlib.h> ``` ``` #include <unistd.h> ``` ``` #include <sys/types.h> ``` ``` #include <sys/wait.h> ``` ``` ​ ``` ``` int main() { ``` ``` int status; ``` ``` pid_t pid = fork(); ``` ``` ​ ``` ``` if (pid == 0) { ``` ``` pid_t child_pid = fork(); ``` ``` if (child_pid == 0) { ``` ``` printf("I am grandchild\n"); ``` ``` exit(0); ``` ``` } ``` ``` else { ``` ``` printf("I am child\n"); ``` ``` exit(0); ``` ``` } ``` ``` } ``` ``` else { ``` ``` wait(&status); ``` ``` printf("I am parent\n"); ``` ``` while(1); ``` ``` } ``` ``` } ``` ### ****5\. Using the waitpid() system call**** This system call is similar to the wait() system call, but it allows the parent process to wait for a specific child process to terminate. This way, the parent can collect the exit status of the child and prevent the creation of a zombie process. C `` ``` // A C program to demonstrate the use of waitpid() ``` ``` #include<stdio.h> ``` ``` #include<unistd.h> ``` ``` #include<sys/wait.h> ``` ``` #include<sys/types.h> ``` ``` ​ ``` ``` int main() ``` ``` { ``` ``` int i; ``` ``` int pid = fork(); ``` ``` if (pid == 0){ ``` ``` for (i=0; i<20; i++) ``` ``` printf("I am Child\n"); ``` ``` } ``` ``` else ``` ``` { ``` ``` int status; ``` ``` waitpid(pid, &status, 0); ``` ``` printf("I am Parent\n"); ``` ``` while(1); ``` ``` } ``` ``` } ``` ## Zombie vs Orphan Process A ****zombie process**** is a process that has completed its execution but still exists in the process table because its parent process hasn’t read its exit status. It’s not active or using resources, but it remains as an entry in the system. On the other hand, an ****orphan process**** is a process whose parent has terminated while the child is still running. Orphan processes are adopted by the `init` process (or its equivalent), which takes responsibility for them to ensure they continue running smoothly. The key difference is that zombies are finished processes waiting to be cleaned up, while orphans are still active and working without their original parent. read more about - [Zombie and Orphan Processes](https://www.geeksforgeeks.org/c/zombie-and-orphan-processes-in-c/) ## Conclusion A zombie process is when a child process terminates but remains in the process table because its parent has not picked up its exit status. It doesn’t consume CPU or memory but can fill up the process table and cause issues if many zombie processes are present. Understanding zombie processes through code examples helps you to recognize them and fix them. To prevent zombie processes the parent process should use functions like wait() or waitpid() to clean up child processes or use signal handlers like SIGCHLD to automatically reap terminated child processes. Comment [K](https://www.geeksforgeeks.org/user/Kishlay%20Verma/) kartik 46 Article Tags: Article Tags: [Operating Systems](https://www.geeksforgeeks.org/category/computer-subject/operating-systems/) [system-programming](https://www.geeksforgeeks.org/tag/system-programming/) [Process Management](https://www.geeksforgeeks.org/tag/process-management/) [Processes \&amp; Threads](https://www.geeksforgeeks.org/tag/os-processes-threads/) ### Explore [![GeeksforGeeks](https://media.geeksforgeeks.org/auth-dashboard-uploads/gfgFooterLogo.png)](https://www.geeksforgeeks.org/) ![location](https://media.geeksforgeeks.org/img-practice/Location-1685004904.svg) Corporate & Communications Address: A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305) ![location](https://media.geeksforgeeks.org/img-practice/Location-1685004904.svg) Registered Address: K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305 [![GFG App on Play Store](https://media.geeksforgeeks.org/auth-dashboard-uploads/googleplay-%281%29.png)](https://geeksforgeeksapp.page.link/gfg-app)[![GFG App on App Store](https://media.geeksforgeeks.org/auth-dashboard-uploads/appstore-%281%29.png)](https://geeksforgeeksapp.page.link/gfg-app) - Company - [About Us](https://www.geeksforgeeks.org/about/) - [Legal](https://www.geeksforgeeks.org/legal/) - [Privacy Policy](https://www.geeksforgeeks.org/legal/privacy-policy/) - [Contact Us](https://www.geeksforgeeks.org/about/contact-us/) - [Advertise with us](https://www.geeksforgeeks.org/advertise-with-us/) - [GFG Corporate Solution](https://www.geeksforgeeks.org/gfg-corporate-solution/) - [Campus Training Program](https://www.geeksforgeeks.org/campus-training-program/) - Explore - [POTD](https://www.geeksforgeeks.org/problem-of-the-day) - [Job-A-Thon](https://practice.geeksforgeeks.org/events/rec/job-a-thon/) - [Blogs](https://www.geeksforgeeks.org/category/blogs/?type=recent) - [Nation Skill Up](https://www.geeksforgeeks.org/nation-skill-up/) - Tutorials - [Programming Languages](https://www.geeksforgeeks.org/computer-science-fundamentals/programming-language-tutorials/) - [DSA](https://www.geeksforgeeks.org/dsa/dsa-tutorial-learn-data-structures-and-algorithms/) - [Web Technology](https://www.geeksforgeeks.org/web-tech/web-technology/) - [AI, ML & Data Science](https://www.geeksforgeeks.org/machine-learning/ai-ml-and-data-science-tutorial-learn-ai-ml-and-data-science/) - [DevOps](https://www.geeksforgeeks.org/devops/devops-tutorial/) - [CS Core Subjects](https://www.geeksforgeeks.org/gate/gate-exam-tutorial/) - [Interview Preparation](https://www.geeksforgeeks.org/aptitude/interview-corner/) - [Software and Tools](https://www.geeksforgeeks.org/websites-apps/software-and-tools-a-to-z-list/) - Courses - [ML and Data Science](https://www.geeksforgeeks.org/courses/category/machine-learning-data-science) - [DSA and Placements](https://www.geeksforgeeks.org/courses/category/dsa-placements) - [Web Development](https://www.geeksforgeeks.org/courses/category/development-testing) - [Programming Languages](https://www.geeksforgeeks.org/courses/category/programming-languages) - [DevOps & Cloud](https://www.geeksforgeeks.org/courses/category/cloud-devops) - [GATE](https://www.geeksforgeeks.org/courses/category/gate) - [Trending Technologies](https://www.geeksforgeeks.org/courses/category/trending-technologies/) - Videos - [DSA](https://www.geeksforgeeks.org/videos/category/sde-sheet/) - [Python](https://www.geeksforgeeks.org/videos/category/python/) - [Java](https://www.geeksforgeeks.org/videos/category/java-w6y5f4/) - [C++](https://www.geeksforgeeks.org/videos/category/c/) - [Web Development](https://www.geeksforgeeks.org/videos/category/web-development/) - [Data Science](https://www.geeksforgeeks.org/videos/category/data-science/) - [CS Subjects](https://www.geeksforgeeks.org/videos/category/cs-subjects/) - Preparation Corner - [Interview Corner](https://www.geeksforgeeks.org/interview-prep/interview-corner/) - [Aptitude](https://www.geeksforgeeks.org/aptitude/aptitude-questions-and-answers/) - [Puzzles](https://www.geeksforgeeks.org/aptitude/puzzles/) - [GfG 160](https://www.geeksforgeeks.org/courses/gfg-160-series) - [System Design](https://www.geeksforgeeks.org/system-design/system-design-tutorial/) [@GeeksforGeeks, Sanchhaya Education Private Limited](https://www.geeksforgeeks.org/), [All rights reserved](https://www.geeksforgeeks.org/copyright-information/) ![]()
Readable Markdown
Last Updated : 23 Jul, 2025 A ****zombie process**** is a process that has completed its execution but still remains in the process table because its parent process has not yet read its exit status. It is called a "zombie" because it is no longer active or running, but it still exists as a placeholder in the system. Zombie processes do not consume system resources like CPU or memory, but they can clutter the process table if not handled properly, especially if many zombie processes accumulate. - A zombie process occurs when a child process finishes but the parent process has not called `wait()` to read its status. - It is not an active process and does not consume CPU or memory but it can still occupy an entry in the process table. - Too many zombie processes can cause issues by filling up the process table, limiting the creation of new processes. ![zmb](https://media.geeksforgeeks.org/wp-content/uploads/20250116110406721449/zmb.webp) - Entry of child process remains in the process table until the parent process retrieves the exit status. During this time, the child process is referred to as a ****zombie process****. This happens because the operating system keeps the process table entry to allow the parent to gather information about the terminated child. ## Example let's see an example of Zombie Process: `` ****Output :**** ![zombie1\_1](https://media.geeksforgeeks.org/wp-content/uploads/zombie1_1.png) Now check the process table using the following command in the terminal ****\$ ps -eaf**** ![zombie1\_2](https://media.geeksforgeeks.org/wp-content/uploads/zombie1_2.png) Here the entry ****\[a.out\] defunct**** shows the zombie process. ****Why do we need to prevent the creation of the Zombie process?**** There is one process table per system. The size of the process table is finite. If too many zombie processes are generated, then the process table will be full. That is, the system will not be able to generate any new process, then the system will come to a standstill. Hence, we need to prevent the creation of zombie processes. ## Prevention to Zombie Process Zombie processes can be prevented by ensuring proper cleanup of child processes after they terminate. Preventing Zombie Process helps maintain a clean process table and prevents system issues caused by lingering zombie processes. Different techniques to prevent zombie process are: 1. Using wait() system call 2. By ignoring the 'SIGCHLD' signal 3. By using a signal handler 4. Double fork 5. Using the waitpid() system call ### ****1\. Using wait() system call**** When the parent process calls wait(), after the creation of a child, it indicates that, it will wait for the child to complete and it will reap the exit status of the child. The parent process is suspended(waits in a waiting queue) until the child is terminated. It must be understood that during this period, the parent process does nothing just wait. (Point 2. is wrong and doesn't prevent zombie creation, its the job of parent process to remove the child process from process list and is not done by the kernel, infact SIG\_IGN is the default handler for SIGCHLD signal to the parent process). ### ****2\. By ignoring the 'SIGCHLD' signal**** When a child is terminated, a corresponding SIGCHLD signal is delivered to the parent, if we call the 'signal(SIGCHLD,SIG\_IGN)', then the SIGCHLD signal is ignored by the system, and the child process entry is deleted from the process table Thus, no zombie is created. However, in this case, the parent cannot know about the exit status of the child. ### ****3\. By using a signal handler**** The parent process installs a signal handler for the SIGCHLD signal. The signal handler calls wait() system call within it. In this scenario, when the child terminated, the SIGCHLD is delivered to the parent. On receipt of SIGCHLD, the corresponding handler is activated, which in turn calls the wait() system call. Hence, the parent collects the exit status almost immediately and the child entry in the process table is cleared. Thus no zombie is created. ****Output:**** ![zom\_final](https://media.geeksforgeeks.org/wp-content/uploads/zom_final.png) Here no any ****\[a.out\] defunct**** i.e. no Zombie process is created. ### ****4\. Double fork**** This involves creating a grandchild process which is then orphaned by the parent process. This ensures that the grandchild process is inherited by the init process, which reaps it automatically. This prevents the creation of a zombie process. ### ****5\. Using the waitpid() system call**** This system call is similar to the wait() system call, but it allows the parent process to wait for a specific child process to terminate. This way, the parent can collect the exit status of the child and prevent the creation of a zombie process. ## Zombie vs Orphan Process A ****zombie process**** is a process that has completed its execution but still exists in the process table because its parent process hasn’t read its exit status. It’s not active or using resources, but it remains as an entry in the system. On the other hand, an ****orphan process**** is a process whose parent has terminated while the child is still running. Orphan processes are adopted by the `init` process (or its equivalent), which takes responsibility for them to ensure they continue running smoothly. The key difference is that zombies are finished processes waiting to be cleaned up, while orphans are still active and working without their original parent. read more about - [Zombie and Orphan Processes](https://www.geeksforgeeks.org/c/zombie-and-orphan-processes-in-c/) ## Conclusion A zombie process is when a child process terminates but remains in the process table because its parent has not picked up its exit status. It doesn’t consume CPU or memory but can fill up the process table and cause issues if many zombie processes are present. Understanding zombie processes through code examples helps you to recognize them and fix them. To prevent zombie processes the parent process should use functions like wait() or waitpid() to clean up child processes or use signal handlers like SIGCHLD to automatically reap terminated child processes.
Shard103 (laksa)
Root Hash12046344915360636903
Unparsed URLorg,geeksforgeeks!www,/operating-systems/zombie-processes-prevention/ s443