• retagged by
5,274 views
7 7 votes

Consider a parent process $P$ that has forked a child process $C$. $C$ has again forked another child process $D$. Now $P$ terminates while $C$ and $D$ are still running. In this case, which of the following statements is true?

  1. $P$ immediately becomes a zombie process, until reaped by its parent
  2. Only process $C$ becomes a zombie process, until adopted by the init process
  3. Both process $C$ and $D$ becomes a zombie process, until adopted by the parent process of $P$
  4. $P$ immediately becomes an orphan process, until adopted by its parent

2 Answers

8 8 votes

A process is called a zombie process, if it is terminated but it's entry still exists in the Process Table, because it has to pass it's exit status to the the parent process

=> Only a terminated process can be a zombie process, which makes Option A our answer.


Processes C and D can't be zombie processes as they're not yet terminated. Process P can't be an orphan, as nowhere it is mentioned that it's parent has terminated.

 

Source: Galvin, page 121.

0 0 votes

(A) is the correct option!

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.

Reference: https://www.geeksforgeeks.org/double-forking-prevent-zombie-process/

If the parent decides not to wait for the child’s termination and it executes its subsequent task, then at the termination of the child, the exit status is not read. Hence, there remains an entry in the process table even after the termination of the child. This state of the child process is known as the Zombie state.

Answer:
Position:
Show:

Related questions

1 1 vote
1 1 answer
1.7k
1.7k views
Souvik33 asked Nov 28, 2022
1,695 views
MSQ Consider the following statements, which one of the following is/are TRUEIn fork() system call, child process inherits all the open file descriptors of parent process...
5 5 votes
8 8 answers
4.9k
4.9k views
admin asked Oct 25, 2019
4,946 views
Consider the following piece of C code: void main( ) { fork( ); fork( ); exit( ); }How many child processes are created upon execution of this program?
3 3 votes
1 answers 1 answer
1.4k
1.4k views
Bikram asked Dec 26, 2016
1,377 views
What will be the output of the following piece of code?Void foo() { int i=1; fork(); i++; printf(“%d”,i); fork(); i++; printf(“%d”,i); fork(); i++; printf(“%d”,i); }$2 \ ...
4 4 votes
1 answers 1 answer
2.6k
2.6k views
Ruturaj Mohanty asked Dec 27, 2018
2,553 views
Assume a program has just referenced an address in virtual memory. Which of the following scenario cannot occur?TLB miss with no page faultTLB hit and page replacementTLB...