wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Consider three CPU-intensive processes, which require 10,20 and 30 time units and arrive at times 0, 2, and 6, respectively. How many context switches are needed if the operating system implements a shortest remaining time first scheduling alogrithm? Do not count the context switches at time zero and at the end

Open in App
Solution

Let three processes are P1,P2 and P3
Process Arrival Time Burst Time
P1 0 10
P2 2 20
P3 6 30

The Gantt chart for SRTF scheduling algorithm
P1 P2 P3
0 10 30 60

So there is only two context switches, at time unit 10 context switch form P1 to P2 and at time unit 30 context switch form P2 to P3.

flag
Suggest Corrections
thumbs-up
7
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Scheduling Queues and Process State Queuing Diagram
OTHER
Watch in App
Join BYJU'S Learning Program
CrossIcon