Question: Given the code below, 1) What are the two different semantics for fork() system call on multithreading? Please explain each case. 2) For each case,
Given the code below,
1) What are the two different semantics for fork() system call on multithreading? Please explain each case.
2) For each case, draw the process tree (use P, SP, SSP, to indicate the main process, sub-process, sub-sub-process, ; use P(n) to indicate a process with n extra threads.);
3) For each case, how many new processes have been created? and how many extra threads have been created?
pid_t pid;
pid = fork();
if (pid == 0) { /* child process */
fork();
thread_create( . . .);
}
else {
thread_create( . . .); }
fork();
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
