Question: 3. The following code uses fork to create a new process. What will this program print when it runs? int pid fork(); if (pid

3. The following code uses fork to create a new process. What

3. The following code uses fork to create a new process. What will this program print when it runs? int pid fork(); if (pid > 0) { printf("parent: child-%d ", pid); pid = wait ((int *) 0); printf("child %d is done ", pid); } else if (pid == 0) { printf("child: exiting "); exit (0); } else { printf("fork error "); }

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!