Consider the following set of processeswith the length of th

Consider the following set of processes,with the length of the CPU burst given in milliseconds:
Process BurstTime Priority

P1 2 2

P2 1 1

P3 8 4

P4 4 2

P5 5 3

The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.

a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptivepriority(a larger priority number implies a higher priority),and RR (quantum=2).

b. What is the turnaround time of each process for each of the scheduling algorithms in part a?

c. What is the waiting time of each process for each of these scheduling algorithms?

d. Which of the algorithms results in the minimum average waiting time(overallprocesses)?

Solution

FCFS

|     P1    |   P2 |       P3       |      P4     |       P5      |

0            2         3                 11           15               20

Average Turnaround Time = (2+3+11+15+20)/5 = 10.2 ms

Average waiting Time = (0+2+3+11+15)/5 = 6.2 ms

SJF

|   P2   |    P1   |      P4    |         P5        |       P3        |

0         1           3             7                   12                 20

Average TurnAround time = (1+3+7+12+20)/5 = 8.6 ms

Average Waiting Time = (0+1+3+7+12)/5 = 4.6 ms

Non Preemptive priority

|            P3    |      P5         |     P1      |      P4        |       P2 |

0                   8                 13             15               19        20

Average TurnAround Time = (8+13+15+19+20)/5 = 15 ms

Average Waiting Time = (0+8+13+15+19)/5 = 11 ms

RR

| P1 | P2 | P3 | P4 | P5 | P3 | P4 | P5 | P3 | P5 | P3|

0    2      3     5     7     9    11    13   15   17 18     20

Average turnaround time = (2+3+20+13+18)/5 = 11.2 ms

Average waiting time = (0+2+18+11+17)/5 = 9.6

(d) The minimum waiting time is in SJF algorithm is 4.6 ms

Consider the following set of processes,with the length of the CPU burst given in milliseconds: Process BurstTime Priority P1 2 2 P2 1 1 P3 8 4 P4 4 2 P5 5 3 Th
Consider the following set of processes,with the length of the CPU burst given in milliseconds: Process BurstTime Priority P1 2 2 P2 1 1 P3 8 4 P4 4 2 P5 5 3 Th

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site