Question: Chapter 3 3.7 Describe the actions taken by a kernel to context-switch between processes. 3.10 Using the program shown below, identify the values of pid

Chapter 3 3.7 Describe the actions taken by a kernel to context-switch between processes. 3.10 Using the program shown below, identify the values of pid at lines: (Assume the actual pids of the parent is 2600 and child is 2603) a) Value of pid at line A b) Value of pid at line B c) Value of pid at line C d) Value of pid at line D 
#include  #include  #include  int main() { pid_t pid, pid1; pid = fork(); if ( pid < 0 ) { fprintf(stderr, "fork failed"); return 1; } else if ( pid == 0 ) { pid1 = getpid(); printf("child: pid = %d ", pid); // line A printf("child: pid1 = %d ", pid1); // line B } else { pid1 = getpid(); printf("parent: pid = %d ", pid); // line C printf("parent: pid1 = %d ", pid1); // line D wait(NULL); } return 0; } 

3.13 Including the initial parent process, how many processes are created by the program shown below?

#include  #include  int main() { fork(); fork(); fork(); return 0; } 

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!