The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+13 votes
1.6k views

A process executes the following code

for(i=0; i<n; i++) fork();

The total number of child processes created is

  1. n
  2. 2n-1
  3. 2n
  4. 2n+1 - 1
asked in Operating System by Veteran (59.4k points) | 1.6k views

1 Answer

+26 votes
Best answer

Each fork() creates a child which start executing from that point onward. So, number of child processes created will be 2n - 1. 

At each fork, the number of processes doubles like from 1 - 2- 4 - 8 ... 2n. Of these except 1, all are child processes. 

https://gateoverflow.in/3707/gate2004-it_64

answered by Veteran (339k points)
selected by
–1
please elaborate.
0

At each fork, the number of processes doubles like from 1 - 2- 4 - 8 ... 2n. Of these except 1, all are child processes. 

Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

34,780 questions
41,755 answers
118,923 comments
41,399 users