Question: how many process are created by the following three codes void main(){ if(fork() == 0) { printf(a); } else { printf(b); waitpid(-1, NULL, 0); }

how many process are created by the following three codes

void main(){ if(fork() == 0) { printf(a);

} else { printf(b);

waitpid(-1, NULL, 0);

}

printf(c); exit(0);

}

void main(){ printf("L0 ");

// parent

if (fork() != 0) { printf("L1 "); if (fork() != 0) { printf("L2 ");

fork();

}

}

printf("Bye ");

}

void main(){

if (fork() == 0){// Child printf("Terminate "); exit(0);

} else { // Parent printf("Running "); while (1) ; // Inf loop

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!