Page 1 of 1

How many processes will be created when the following program is executed? Assume that all fork() system calls are succe

Posted: Fri May 20, 2022 2:52 pm
by answerhappygod
How Many Processes Will Be Created When The Following Program Is Executed Assume That All Fork System Calls Are Succe 1
How Many Processes Will Be Created When The Following Program Is Executed Assume That All Fork System Calls Are Succe 1 (44.74 KiB) Viewed 45 times
How many processes will be created when the following program is executed? Assume that all fork() system calls are successful. What will be printed? main() { = int i = 3; int ret_val; while(i > 0) { if ((ret_val fork()) == 0) { printf("In child %d. \n", i); exit(0); } else { printf("In parent %d. \n", i); i = i - 1; } } }