The Gateway to Computer Science Excellence
0 votes
38 views
Including the initial parent process, how many processes are created by the program shown below-

#include <stdio.h>
#include <unistd.h>
int main()
{
int i;
for (i = 0; i < 4; i++)
fork();
return 0;
}
in Operating System by Boss (41.8k points) | 38 views

1 Answer

0 votes

Total number of child process are created = $2^n$-1.

Here for loop executed 4 times( n=4) .

Total number of child process are created = $2^4$ -1 =16-1 = 15.

 

by Boss (35.3k points)
edited by

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
50,650 questions
56,185 answers
193,939 comments
94,696 users