In: Computer Science
Urgent!!
What is the waiting time and Turnaround time of each process for each of the scheduling algorithms? [12 Marks] Job Arrival Time Burst(msec) Priority A 0 6 3 (Silver) B 1 2 1 (Diamond) C 3 5 3 (Silver) D 5 3 4 (Bronze) E 7 2 2 (Gold) (a) First-Come-First-Served (FCFS) scheduling [2 Marks] (b) Preemptive PRIORITY scheduling [2 Marks] (c) Highest Response Ratio Next (HRRN) scheduling [2 Marks] (d) Round Robin (RR) (quantum = 4) scheduling [2 Marks] (e) Which of the foregoing scheduling policies provides the lowest waiting time for this set of jobs? What is the waiting time with this policy? (Show your work) [4 Marks]
Waiting Time(WT): The time process spent in the
ready queue and for I/O completion.It is also considered as the
Time Difference between turn around time and burst time.
Waiting Time = Turn Around Time – Burst Time
TurnAroundTime(TAT): The time since the process
entered into ready queue for execution till the process completed
it’s execution.It is also considered as Time Difference between
completion time and arrival time.
Turn Around Time = Completion Time – Arrival Time
a)FCFS :
Process | Arrival Time | Burst Time | Completion Time(CT) | Turn Around Time(TAT) | Waiting Time(WT) |
A | 0 | 6 | 6 | 0 | 6 |
B | 1 | 2 | 8 | 6 | 2 |
C | 3 | 5 | 13 | 8 | 5 |
D | 5 | 3 | 16 | 13 | 3 |
E | 7 | 2 | 18 | 16 | 2 |
Waiting Time = Turn Around Time – Burst Time
Turn Around Time = Completion Time – Arrival Time
In FCFS the first arrived process will have the first priority. So, the Gantt Chart is as follows:
Gantt Chart:
A | B | C | D | E |
0 6 8 13 16 18
AverageTurn Around Time = = 8.6 milli sec
Average Waiting Time = = 3.6 milli sec
b) Priority Scheduling (Pre-emptive):
Process | Arrival Time | Burst Time | Priority | Completion Time(CT) | Turn Around Time(TAT) | Waiting Time(WT) |
A | 0 | 6 | 3 | 10 | 10 | 0 |
B | 1 | 2 | 1(L) | 3 | 2 | 1 |
C | 3 | 5 | 3 | 15 | 12 | 3 |
D | 5 | 3 | 4(H) | 18 | 13 | 5 |
E | 7 | 2 | 2 | 9 | 2 | 7 |
Waiting Time = Turn Around Time – Burst Time
Turn Around Time = Completion Time – Arrival Time
Here the lowest priority numbered process will have the highest priority i.e.., B is having the priority 1(L) which have the highest priority out of all and D having the priority 4(H) will have the lowest priority.
Gantt Chart:
Since no other process is available hence this will be scheduled till next job arrives or its completion (whichever is lesser).
A |
0 1
A | B |
0 1 3
A | B | A |
0 1 3 7
A | B | A | E |
0 1 3 7 9
A | B | A | E | A |
0 1 3 7 9 10
A | B | A | E | A | C | D |
0 1 3 7 9 10 15 18
Average TAT = = 7.8 milli sec
Average WT = = 3.2 milli sec
C) Highest Response Ratio Next (HRRN) scheduling:
Response Ratio (RR) for any process is calculated by using the formula
Response Ratio (RR) =
Process | Arrival Time | Burst Time | Completion Time(CT) | Turn Around Time(TAT) | Waiting Time(WT) |
A | 0 | 6 | 6 | 6 | 0 |
B | 1 | 2 | 8 | 7 | 1 |
C | 3 | 5 | 13 | 10 | 3 |
D | 5 | 3 | 18 | 13 | 5 |
E | 7 | 2 | 15 | 8 | 7 |
A |
0 6
The response ratio are-
Since process B has the highest response ratio, so process B executes till completion.
A | B |
0 6 8
The response ratio are-
Since process C and D have the same response ratio.
A | B | C |
0 6 8 13
The response ratio are-
Since process E has the highest response ratio, so process E executes till completion.After that D executes till completion.
A | B | C | E | D |
0 6 8 13 15 18
Avg TAT = = 8.8 milli sec
Average WT = = 3.2 milli sec
D) Round Robin (RR):
Process | Arrival Time | Burst Time | Completion Time(CT) | Turn Around Time(TAT) | Waiting Time(WT) |
A | 0 | 6 | 12 | 12 | 0 |
B | 1 | 2 | 6 | 5 | 1 |
C | 3 | 5 | 18 | 15 | 3 |
D | 5 | 3 | 15 | 10 | 5 |
E | 7 | 2 | 17 | 10 | 7 |
CPU scheduling policy is Round Robin with time quantum = 4 unit
Gantt chart:
A | B | C | A | D | E | C |
0 4 6 10 12 15 17 18
Ready queue:
A | B | C | A | D | E | C |
Avg TAT = = 10.4 milli sec
Average WT = = 3.2 milli sec
E) Out of foregoing scheduling policies Priority scheduling, Highest Response Ratio Next (HRRN) scheduling and Round Robin Scheduling provides the lowest waiting time for this set of jobs with 3.2 milli secs. The entire work is attached while solving each policy.