Process Arrival Time Burst Time P1 0 2 P2 1 1 P3 2 2 P4 3 5 P5 4 1 Consider a se
ID: 3767298 • Letter: P
Question
Process Arrival Time Burst Time
P1 0 2
P2 1 1
P3 2 2
P4 3 5
P5 4 1
Consider a set of processes given above with the arrival time and the length of CPU burst time given in cycles. Show a Gantt chart and calculations of average turnaround time and average waiting time of these processes under: (a) the shortest job first with preemption CPU scheduling algorithm and (b) the round-robin CPU scheduling algorithm with a time quantum of one cycle.
Explanation / Answer
a) Shortest Job first with preemption: This cpu scheduling algorithm is also known as shortest remaining time first.
Gantt chart for SJF with preemption is:
0 1 2 3 4 5 6 11
Average Turnaround time=Finish time-Arrival time
= (2+2+3+8+2)/5
= 17/5
= 3.4 ms
Average Waiting time=Response time-Arrival time
= (0+1+1+3+1)/5
= 6/5
= 1.2 ms
b) Round-robin Algorithm.
Gantt chart for RR is:
0 1 2 3 4 5 6 7 8 9 10 11
Average Turnaround time=Finish time-Arrival time
= (6+1+5+8+1)/5
= 21/5
= 4.2 ms
Average Waiting time=Response time-Arrival time
= (5+0+3+3+0)/5
= 11/5
= 2.2 ms
p1 p1 p2 p3 p3 p5 p4Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.