# An operating system uses shortest remaining time (SRT) scheduling algorithm. Consider the arrival times and execution time for the following processes

193 views
in Computer
closed

An operating system uses shortest remaining time (SRT) scheduling algorithm. Consider the arrival times and execution time for the following processes:

 Proces Arrival Time Execution Time P1 0 20 P2 15 25 P3 30 10 P4 45 15

What is total waiting time for process P2?

1. 5
2. 15
3. 40
4. 55

by (24.2k points)
selected

Correct Answer - Option 2 : 15

Shortest remaining time (SRT)  is pre-emptive algorithms

Gantt chart:

 P1 P2 P3 P2 P4

0      20      30      40     55      70

Process Table:

 Process Arrival Time Execution Time (Burst Time) Completion Time Turnaround time Waiting time P1 0 20 P2 15 25 55 40 15 P3 30 10 P4 45 15

Explanation:

Completion time For P2 =55

Turn around time (TAT) = Completion time - Arrival time = 55 -15 = 40

Waiting Time for P2  = TAT-Execution Time = 40- 25 =15

Therefore waiting time P2 is 15 unit: