Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions