Question: Consider the following code fragment: 1 pid_t pid; 2 pid = fork(); 3 if (pid == 0) { / child process / 4 fork(); 5

Consider the following code fragment: 1 pid_t pid;

2 pid = fork();

3 if (pid == 0) { / child process /

4 fork();

5 thread_create(...);

6 }

7 fork();

Answer the following questions and explain (or show how you arrived at) your answer.

A) How many unique processes are running after line 7?

B) How many threads are created?

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!