CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question


Consider the following set of processes, with the arrival times and the CPU-burst times given in milliseconds
Process Arrival time Burst time
P1
P2
P3
P4
0
1
2
4
5
3
3
1

What is the average turnaround time for these processes with the preemptive Shortest Remaining Processing Time first (SRPT) algorithm?

A
6.25
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
5.50
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
6.00
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
5.75
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is B 5.50
Process Arrival Time Burst Time
P1 0 5
P2 1 3
P3 2 3
P4 4 1

The Gantt chart for SRPT CPU scheduling algorithm is
P1 P2 P2 P2 P4 P3 P3 P3 P1 P1 P1 P1
0 1 2 3 4 5 6 7 8 9 10 11 12

Process P1 arrive at time 0, at time unit 1 the remaining time of P1 is 4 and remaining time of P2 is 3 so P1 preempted. At the end of time unit 2 the remaining time of P2 is 2 and P3 is 3 so P2 is not preempted At time unit 4 the remain time of P2 is 0 and P4 is scheduled. The same process repeated upto time unit 12.
The turnaround time is the interval between submission and completion of a given process. Calculate turnarround time for each process as

P1=120=12
P2=41=3
P3=6,P4=1

So average turnaround time
=12+3+6+14=224=5.50

flag
Suggest Corrections
thumbs-up
1
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Introduction to CPU Scheduling
OTHER
Watch in App
Join BYJU'S Learning Program
CrossIcon