A Zombie process is a process that has completed execution, but still has an entry in the process table (the parent did not read its exit code, or, in other words, it was not “received”).
An orphan process is a process whose parent has finished, although he continues to work on his own (his parent “passed away”, but he is still “alive”). in this case he initwill accept him and will wait for him.
So, consider the following:
int main(int argv, char *argc[]) {
pid_t p=fork();
if (p<0) {
perror("fork");
}
if (p==0) {
exit(2);
}
sleep(2);
return 1;
}
The baby process created here will be a zombie in 2 seconds, but what will be its status when the parent finishes? Zombie orphan?
What happens with his entry into the process table?
Are "zombie orphans" (for example, above) also accepted initand received by him?