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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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 44 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; } } }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply