Question: Consider the following program fragment: int pid = 0 ; pid = fork ( ) ; / / call # 1 pid = fork (

Consider the following program fragment:
int pid =0;
pid = fork();// call # 1
pid = fork();// call # 2
if (! pid){
pid = fork(); // call # 3
}
Draw a diagram showing the relationships between parent and child processes created when the following code fragment is executed:
The diagram should indicate which call to fork (e.g.,1,2, or 3) created the process.
For example, this diagram is wrong, but shows the format that I'm looking for:
parent
/|
#1 #2
|
#3

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 Programming Questions!