Question
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 | | 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started