#include <unistd.h>
int main(void)
{
// Fork a child process
fork();
// fork another child process
fork();
// and another process
fork();
return 0;
}
Including the initial parent process, how many processes are created by the following program? Explain.
#include <stdio.h>
#include <unistd.h>
int main(void)
{
// Fork a child process
fork();
// fork another child process
fork();
// and another process
fork();
return 0;
}
Each fork function call creates child process to parent we becalculate number of process as order 2n where n refersto number of fork functions.
Explanation :-
including the initial parent process