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
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; } } }