LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Zombie Process Handling (https://www.linuxquestions.org/questions/linux-newbie-8/zombie-process-handling-74537/)

kghoshal 07-21-2003 06:45 AM

Zombie Process Handling
 
Is there a special meachanism in Linux to handle Zombie Processes?

shishir 07-21-2003 06:49 AM

what exactly is your question?
if you are asking if the kernel sees if a parent process is waiting
for a child process it forked, then no....i dont think so..
if your parent doesnt wait for a child process and the child exits,
it (child) would become a zombie...a condition that would go either when the parent process exits or when the system restarts

Pres 07-21-2003 09:10 AM

Below is Beej's code snip and explanation for handling zombies under any *nix. Seems to work if you include the right headers.

Code:

        sa.sa_handler = sigchld_handler; // reap all dead processes
        sigemptyset(&sa.sa_mask);
        sa.sa_flags = SA_RESTART;
        if (sigaction(SIGCHLD, &sa, NULL) == -1) {
            perror("sigaction");
            exit(1);
        }

(Also, this whole sigaction() thing might be new to you--that's ok. The code that's there is responsible for reaping zombie processes that appear as the fork()ed child processes exit. If you make lots of zombies and don't reap them, your system administrator will become agitated.)


All times are GMT -5. The time now is 06:00 AM.