Skip to content
Official PYQ · 2025

GATE CS 2025 Set 2 Q16 — CPU Scheduling

Explain with AI

​​​Processes P1,P2,P3,P4P 1, P 2, P 3, P 4 arrive in that order at times 0,1,20,1,2, and 8 milliseconds respectively, and have execution times of 10,13,610,13,6, and 9 milliseconds respectively. Shortest Remaining Time First (SRTF) algorithm is used as the CPU scheduling policy. Ignore context switching times.

Which ONE of the following correctly gives the average turnaround time of the four processes in milliseconds?

Choose one option
View worked solution

Answer: D

To find the average turnaround time, we trace the execution of the processes using the Shortest Remaining Time First (SRTF) scheduling algorithm:

  • At t=0t = 0: Only P1P_1 (burst time = 10) is available. P1P_1 starts executing.
  • At t=1t = 1: P2P_2 (burst time = 13) arrives. The remaining time for P1P_1 is 9. Since 9<139 < 13, P1P_1 continues execution.
  • At t=2t = 2: P3P_3 (burst time = 6) arrives. The remaining time for P1P_1 is 8. Since P3P_3 has the shortest remaining time (6<86 < 8), P1P_1 is preempted, and P3P_3 starts executing.
  • At t=8t = 8: P3P_3 completes execution. P4P_4 (burst time = 9) arrives. The remaining times of the active processes are:
    • P1P_1: 8
    • P2P_2: 13
    • P4P_4: 9
    P1P_1 has the shortest remaining time (8) and executes from t=8t = 8 to t=16t = 16, completing at t=16t = 16.
  • At t=16t = 16: The remaining processes are P2P_2 (13) and P4P_4 (9). P4P_4 executes from t=16t = 16 to t=25t = 25, completing at t=25t = 25.
  • At t=25t = 25: Only P2P_2 (13) remains. It executes from t=25t = 25 to t=38t = 38, completing at t=38t = 38.

Now, we calculate the Turnaround Time (TAT=Completion Time−Arrival Time\text{TAT} = \text{Completion Time} - \text{Arrival Time}) for each process:

Process Arrival Time (AiA_i) Burst Time Completion Time (CiC_i) Turnaround Time (TATiTAT_i)
P1P_1 0 10 16 16−0=1616 - 0 = 16
P2P_2 1 13 38 38−1=3738 - 1 = 37
P3P_3 2 6 8 8−2=68 - 2 = 6
P4P_4 8 9 25 25−8=1725 - 8 = 17

The average turnaround time is calculated as:

Average Turnaround Time=16+37+6+174=764=19 ms\text{Average Turnaround Time} = \frac{16 + 37 + 6 + 17}{4} = \frac{76}{4} = 19\text{ ms}

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore CPU Scheduling questions