Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solved with the explanation please Consider the following code #include #include void main(void) { pid_t pid; int i=0; pid = fork(); if (pid==0) pid =

Solved with the explanation please

Consider the following code

#include

#include

void main(void) {

pid_t pid; int i=0;

pid = fork();

if (pid==0)

pid = getpid();

else if (pid>0)

i=5;

else if (pid<0)

i=10;

return 0; }

What are the values of i and pid:

a)If the fork() is successful and returned in the child process:

b)If the fork() is successful and returned in the parent process:

c)If the fork() is unsuccessful:

-----------------------------------------------------

In a multiprogramming environment, consider we have the following process P1:

#

Instruction

Execution time

1

Assignment

2 ms

2

Fork ()

3 ms

3

Wait (Null)

3 ms

4

Print

2ms

Assume the following:

fork () is executed correctly.

Push time in any queue =2 ms.

Wait time in printer queue =4 ms.

Dispatch time = 1ms.

Complete the following table:

Accumulative

Time

Process

State

Executing

Instruction

Queue

Name

Execution

Time

Dispatch Time

Push

Time

Wait

Time in Q

0

Ready

Ready Q

1

1

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_2

Step: 3

blur-text-image_3

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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

What are the objectives of Human resource planning ?

Answered: 1 week ago

Question

Explain the process of Human Resource Planning.

Answered: 1 week ago

Question

LO4 List options for development needs analyses.

Answered: 1 week ago