Question

In: Computer Science

The following table lists the characteristics of three processes that require service in a time-sharing system...

The following table lists the characteristics of three processes that require service in a time-sharing system Assume that no time is required to choose the next process and perform a context switch. For each algorithm, show the process that is running in each time interval

Process

Name

Arrival

Time

Burst/CPU Time

Priority

Start Time

End Time

Turnaround (TA) Time

WTA

Wait

P1

2

8

1

P2

4

5

4

P3

6

2

3

p4 3 4 2


d) Preemptive Shortest Job First (Shortest Remaining Time First (SRTF))

Time

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

Process

d) Priority Scheduling (PRI): Preemptive

Time

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

Process

d) Round Robin: Time Quantum =2, context switch =1.

Time

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

Process

Solutions

Expert Solution

In case of any queries, please revert back. I will solve them ASAP. PS. Experts dont know when a question was posted. We solve it as soon as we see it.

Process Name Arrival Time Burst Time Priority
P1 2 8 1
P2 4 5 4
P3 6 2 3
P4 3 4 2

A.) Shortest Remaining Time First(Shortest Job first that is Preemptive) :-

1. This first process Comes at Time 2. So, till then, the CPU is empty.

2. Now P1 arrives and has Shortest Remaining time of 8 seconds. So, it goes at time=2

3. However at time = 3, P4 arrives and preempts P1. P1 now has 7 seconds left. P4 enters CPU at t=3

4. When P2 enter at t=4, P4 has remaining 3 seconds and so P2 waits at it has burst time of 5.

5. At t=6, P3 enters and sees that it has burst time of 2, but P4 has only 1 second left. So, it waits 1 second.

6. At t=7, P3 enters with shortest burst time. At t=8, P2 enters with burst time of 5. At t=14, P1 enters.

T 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
P - - P1 P4 P4 P4 P4 P3 P3 P2 P2 P2 P2 P2 P1 P1 P1 P1 P1 P1 P1 -

B.) Priority Scheduling Preemtive :-

1. This first process Comes at Time 2. So, till then, the CPU is empty.

2. Now P1 arrives and is only process so enters. It has priority 1 which is highest and so first completes and leaves at t=9. rest processes arrive and wait.

3. Next according to priority is P4, then P3 and then P2

T 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
P - - P1 P1 P1 P1 P1 P1 P1 P1 P4 P4 P4 P4 P3 P3 P2 P2 P2 P2 P2 -

C.) Round Robin. Time Quantum = 2.

Job is changed every 2 seconds,

1. P1 executes for 2 seconds. Now at t=4, there are P4 and P2. P4 enters then P2. At t=6, P3 has joined.

Then robin goes like P1[6],P4[2],P2[3].

P1[4], P2[1]

P1[2]

T 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
P - - P1 P1 P4 P4 P2 P2 P3 P3 P1 P1 P4 P4 P2 P2 P1 P1 P2 P1 P1 -

Related Solutions

Q1. a: Why time sharing a CPU with multiple processes reduces the effectiveness of temporal locality?...
Q1. a: Why time sharing a CPU with multiple processes reduces the effectiveness of temporal locality? b: Why time sharing a CPU with multiple processes reduces the effectiveness of spatial locality? Q2. Why the context switching overhead need to be low for a CPU scheduler?
What is the maximum number of processes in the system at any time using the following...
What is the maximum number of processes in the system at any time using the following code segment? extern char mypath[]; for ( int i = 0; i < 10; i++ ) { pid_t pid, pid_out; unsigned char status; if ( pid = fork() ) pid_out = wait ( &status ); else   execl ( mypath, "child", "parameter", NULL ); } Assume that child performs some simple computation and returns the result, that is captured in status.
The following table lists the activities needed to complete a project. The first column lists the...
The following table lists the activities needed to complete a project. The first column lists the activities and the “follows” column shows which other activity or activities, (if any), must be completed before these activities can start. The remaining columns give three estimates of the activity duration; the mean duration calculated from these estimates and standard deviation assuming a beta distribution of activity duration. Activity Follows Estimates of durations (days) Optimistic Most likely Pessimistic A -- 3 6 15 B...
The following table lists the activities needed to complete a project. The first column lists the...
The following table lists the activities needed to complete a project. The first column lists the activities and the “follows” column shows which other activity or activities, (if any), must be completed before these activities can start. The remaining columns give three estimates of the activity duration; the mean duration calculated from these estimates and standard deviation assuming a beta distribution of activity duration. Activity Follows Estimates of durations (days) Optimistic Most likely Pessimistic A -- 3 6 15 B...
(a) What are the advantages and disadvantages of a time-sharing system? Explain. (b) Is multi-programming more...
(a) What are the advantages and disadvantages of a time-sharing system? Explain. (b) Is multi-programming more effective in a batch OS or in a time-sharing OS? Explain. (c) How is the effectiveness of scheduling measured? Explain.
Determine the Functional Dependencies that exist in the following Orders table. This table lists customer and...
Determine the Functional Dependencies that exist in the following Orders table. This table lists customer and order data. Orders (SupplierNum, SupplierName, Supp_Phone, ProductNum, Description, Product_type, QuotedPrice) . Normalize the above relation to 3 rd normal form, ensuring that the resulting relations are dependency-preserving and specify the primary keys in the normalized relations by underlining them.
1. Processes A, B, C, D, E, and F require service times of 3, 5, 2,...
1. Processes A, B, C, D, E, and F require service times of 3, 5, 2, 5, 3, and 5. Their arrival times are 0, 1, 3, 9, 10, and 12. What is the average turnaround time, waiting time, response time, and throughput when using SRJF, RR (q=2), and MLF (q=22i+1). Show your work.
1. Processes A, B, C, D, E, and F require service times of 3, 5, 2,...
1. Processes A, B, C, D, E, and F require service times of 3, 5, 2, 5, 3, and 5. Their arrival times are 0, 1, 3, 9, 10, and 12. What is the average turnaround time, waiting time, response time, and throughput when using SRJF, RR (q=2), and MLF (q=22i+1). Show your work.
Identify whether each attribute in the following table is an advantage or disadvantage of sharing a...
Identify whether each attribute in the following table is an advantage or disadvantage of sharing a currency across country boundaries. Attribute Advantage Disadvantage Price stability Limited scope for fiscal policy Lower transaction costs Speculative attacks during currency transition Protection from monetary disturbances and speculation Which of the following are reasons the European Union is considered   currency area? Check all that apply. Labor immobility Limited use of fiscal policy Low economic efficiency gains No legal or cultural barriers to labor mobility...
Create a C program that simulates time-sharing in the operating system. Please follow the instructions provided:...
Create a C program that simulates time-sharing in the operating system. Please follow the instructions provided: a) Use a circular queue. b) It is required that the process be inputted by the user. The user must input the process name and the duration in seconds, and for this simulation let the user input 5 processes. c) As this requires process name and duration, use an array of structures. d) To simulate time-sharing, following the algorithm presented below: d.1) Use the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT