c - Where do Zombie processes go after their parent dies? -



c - Where do Zombie processes go after their parent dies? -

a zombie process process has completed execution, still has entry in process table (the parent hasn't read exit code, or in other words, hasn't been "reaped").

an orphan process process parent has finished, though remains running (its parent has "passed away" still "alive"). in case, init adopt , wait it.

so consider this:

int main(int argv, char *argc[]) { pid_t p=fork(); if (p<0) { perror("fork"); } // kid if (p==0) { exit(2); } // parent sleeps 2 seconds sleep(2); homecoming 1; }

the kid process beingness created here zombie 2 seconds, status when parent finishes? orphan-zombie?

what happens entry in process table?

are "orphan-zombies" (such above) adopted init , beingness reaped it?

according man 2 wait:

a kid terminates, has not been waited becomes "zombie". kernel maintains minimal set of info zombie process (pid, termination status, resource usage information) in order allow parent later perform wait obtain info child. long zombie not removed scheme via wait, consume slot in kernel process table, , if table fills, not possible create farther processes. if parent process terminates, "zombie" children (if any) adopted init(8), automatically performs wait remove zombies.

when parent process finishes, kid process (even if it's zombie process) adopted init. then, said, init wait() exit status.

so, don't think "orphan zombie" special case.

c linux linux-kernel wait zombie-process

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -