Question: Write a C program that corresponds to the below process tree. You are to use the fork ( ) system call to create child processes.

Write a C program that corresponds to the below process tree. You are to use the
fork() system call to create child processes. Additionally, your program should
ensure that the parent processes wait for their child processes to complete. As you can
see there are a total of 9 processes (including the parent process).
Output:
1. Your program must print the pids of all the processes created on the screen.
2. Your program must ensure that duplicate pids are not printed.
Sample Output: ./PLfork
--------------------------------------------------------------------------------------------------------------------
7615
7616
7617
7618
7619
7620
7621
7622
7623

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!