Question: 1 . a ) Define single programming and mul programming . b ) Describe a scenario where mul programming might be be er than single

1. a) Define single programming and mulprogramming.
b) Describe a scenario where mulprogramming might be beer than single programming. Note: You may use the internet to research any applicaons or describe an example from your personal experience.
2. Suppose P1, P2, P3, and P4 are ready to run (in this order). P1 executes for 4me units, P2 executes for 5me units, P3 executes for 2me units, and P4 executes for 3me units. Neither process invokes I/O. Assuming that a mer interrupt occurs every me unit, fill in the table:
Time (in units)
Running
Queue of Processes Ready to Run
0+e
P1
P2, P3, P4
1+e
2+e
3+e
4+e
5+e
6+e
7+e
8+e
9+e
10+e
11+e
12+e
3. Suppose P1, P2, P3, P4 are in this order in the Ready Queue, and that the following sequence of events occurs:
Time 10: P1 invokes write
Time 15: P2 invokes write
Time 25: P3 invokes read
Time 30: Interrupt (P1's write complete) Time 40: Interrupt (P3s read complete) Time 45: P4 terminates
Time 50: P1 terminates
There is no noon of a me slice and a process yields to another process only when it invokes an I/O operaon (read/write) or terminates.
Time
Running
Ready
Blocked
0+e
10+e
15+e
25+e
30+e
35+e
40+e
45+e
50+e
4. A) Explain the fork funcon and the return values for the fork funcon. B) What is the output of the following code:
intx=5;
int main(){
pid_t ret;
ret = fork(); if(ret!=0){
prin("parent: x =%d
", x -4); }
else {
prin("child: x =%d
", x +4);
}}
Note: Explaining your thought process will get you paral credit in case the answer is incorrect.
5. Draw a process tree for the following code: void parent_child_fork()
{
prin("L0
"); fork(); prin("L1
"); fork(); prin("L2
"); fork(); prin("Bye
");
}

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!