468 views

2 Answers

Best answer
0 votes
0 votes

7.

First fork() will generate 1 children. Total number of process = 1 child (C1) + 1 parent (P) = 2.

Second fork() will generate 1 more process in C1 (C2) and one more process in P (C3), Total number of child processes at this stage = 3.

Similarly, 4 more child processes will be generated after calling third fork().

So, overall 8 processes will be there, 1 parent and 7 children. For more information, you can refer to the link provided to you in response to your another similar question .

selected by
0 votes
0 votes

Answer is 7

Bcz when we execute fork() command then a child process is created and then the next instruction following this fork() command will be executed by both parent as well as by the child process.

First fork() will generate 1 children. Total number of process = 1 child (C1) + 1 parent (P) = 2.

Second fork() will generate 1 more process in C1 (C2) and one more process in P (C3), Total number of child processes at this stage = 3.

Similarly, 4 more child processes will be generated after calling third fork().

So, overall 8 processes will be there, 1 parent and 7 children.

Related questions

0 votes
0 votes
1 answer
2
IgnitorSandeep asked Sep 28, 2015
1,325 views
In a binary tree with n nodes every node has an odd no. of descendants. Every node is considered to be its own descendant. What is the no. of nodes in the tree that has e...