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

The arrival time, priority, and durations of the CPU and I/O bursts for each of three processes P1, P2 and P3 are given in the table below. Each process has a CPU burst followed by ab I/O burst followed by another CPU burst. Assume that each prcess has its own I/O resource.

Process Arrival
time
Priority Burst
durations
CPU, I/O CPU
P1 0 2 1,5,3
P2 2 3
(lowest)
3,3,1
P3 3 1
(highest)
2,3,1

The multi-programmed operating system uses preemptive priority scheduling. What are the finish times of the processes P1 P2 and P3 ?

A
12, 17, 11
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
11, 16, 10
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
11, 15, 9
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
10, 15, 9
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

The correct option is D 10, 15, 9
At t = 0 only P1 is present so execute it for 1 unit (remaining CPU time of P1 = 0, now it will perform I/O).
At t = 1 no process is available for CPU so CPU will remain idle and P1 will perform I/O
(remaining I/O time of P1 = 4)
At t = 2 P2 arrives and is available for CPU so execute it for 1 unit and simultaneously P1 will do I/O (remaining CPU time of P2=2 and remaining I/O time of P1 = 3).

At t = 3 P3 also arrives and it is having highest priority among all processes available for CPU so we can execute P3 for its complete CPU burst (i.e. 2 unit) as all processes has arrived and simultaneously P1 will do I/O (remaining CPU time of P3 = 0, now P3 will perform I/O & remaining I/O time of P1 = 1).

At t = 5 only P2 is available for CPU so it will execute for 1 unit and P1 and P3 will perform I/O (remaining CPU time of p2=1, remaining I/O time of P3 = 2, remaining I/O time of P1 = 0, now P1 will perform CPU)

At t = 6 P2 and P1 are available for CPU but P1 will be selected because it is having highest priority then P2 so execute P1 for 1 unit (remaining CPU time of P1 = 2 & remaining I/O time of P3 is 1)

At t = 7 again P1 will be executed for 1 unit (remaining CPU time of P1 = 1 and remianing I/O time of P3 = 0, now P3 will perform CPU).

At t = 8 now P1, P2 & P3 are available for CPU so P3 will be selected based on highest priority and will be executed for 1 unit (remaining CPU time of P3 = 0, so P3 completed at t = 9).

At t = 9 P1 will be executed on CPU for 1 unit (remaining CPU time of P1 = 0, so P1 completed at t = 10).

At t = 10 only P2 is available for CPU so it will execute its remaining CPU burst (i.e. 1 unit) (remaining CPU time of P2 = 0, now P2 will perform I/O.)

At t = 11 P2 will perform I/O for 3 units and CPU will remain IDLE.

At t = 14 P2 will perform CPU again and P2 is completed at t = 15
P1 IDLE P2 P3 P2 P1 P1 P3 P1 P2 IDLE P2
0 1 2 3 5 6 7 8 9 10 11 14 15

flag
Suggest Corrections
thumbs-up
1
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Mathematical Expectation
ENGINEERING MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon