Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

1. Identify three approaches to culture.

Answered: 1 week ago

Question

2. Define communication.

Answered: 1 week ago