Skip to content
Official PYQ · 2006

GATE CS 2006 Q64 — CPU Scheduling

Explain with AI

Consider three processes (process id 00, 11, 22 respectively) with compute time bursts 22, 44 and 88 time units. All processes arrive at time zero. Consider the longest remaining time first (LRTF) scheduling algorithm. In LRTF ties are broken by giving priority to the process with the lowest process id. The average turn around time is:

Choose one option
View worked solution

Answer: A

Longest Remaining Time First (LRTF) is a preemptive scheduling algorithm. At any time instant, the process with the longest remaining burst time is scheduled. Ties are broken by choosing the process with the lowest process ID.

Let the processes be P0P_0, P1P_1, and P2P_2 with initial burst times 22, 44, and 88 respectively, arriving at t=0t = 0. We trace the execution step-by-step:

  • Interval [0,4][0, 4]: P2P_2 has the longest remaining time (88). It runs for 44 units.
    Remaining times at t=4t = 4: P0=2P_0 = 2, P1=4P_1 = 4, P2=4P_2 = 4.
  • Interval [4,5][4, 5]: P1P_1 and P2P_2 are tied at 44. P1P_1 runs (lower ID).
    Remaining times at t=5t = 5: P0=2P_0 = 2, P1=3P_1 = 3, P2=4P_2 = 4.
  • Interval [5,6][5, 6]: P2P_2 runs.
    Remaining times at t=6t = 6: P0=2P_0 = 2, P1=3P_1 = 3, P2=3P_2 = 3.
  • Interval [6,7][6, 7]: P1P_1 and P2P_2 are tied at 33. P1P_1 runs.
    Remaining times at t=7t = 7: P0=2P_0 = 2, P1=2P_1 = 2, P2=3P_2 = 3.
  • Interval [7,8][7, 8]: P2P_2 runs.
    Remaining times at t=8t = 8: P0=2P_0 = 2, P1=2P_1 = 2, P2=2P_2 = 2.
  • Interval [8,9][8, 9]: All are tied at 22. P0P_0 runs.
    Remaining times at t=9t = 9: P0=1P_0 = 1, P1=2P_1 = 2, P2=2P_2 = 2.
  • Interval [9,10][9, 10]: P1P_1 and P2P_2 are tied at 22. P1P_1 runs.
    Remaining times at t=10t = 10: P0=1P_0 = 1, P1=1P_1 = 1, P2=2P_2 = 2.
  • Interval [10,11][10, 11]: P2P_2 runs.
    Remaining times at t=11t = 11: P0=1P_0 = 1, P1=1P_1 = 1, P2=1P_2 = 1.
  • Interval [11,12][11, 12]: All are tied at 11. P0P_0 runs and completes.
    Remaining times at t=12t = 12: P0=0P_0 = 0, P1=1P_1 = 1, P2=1P_2 = 1.
  • Interval [12,13][12, 13]: P1P_1 and P2P_2 are tied at 11. P1P_1 runs and completes.
    Remaining times at t=13t = 13: P1=0P_1 = 0, P2=1P_2 = 1.
  • Interval [13,14][13, 14]: P2P_2 runs and completes.

The completion times (CTCT) for the processes are:

  • CT(P0)=12CT(P_0) = 12
  • CT(P1)=13CT(P_1) = 13
  • CT(P2)=14CT(P_2) = 14

Since all processes arrive at t=0t = 0, the turnaround time (TAT=CT−ATTAT = CT - AT) for each process is equal to its completion time.

Average Turnaround Time=12+13+143=393=13 units\text{Average Turnaround Time} = \frac{12 + 13 + 14}{3} = \frac{39}{3} = 13\text{ units}

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

Published
Report a correction
Keep exploringMore CPU Scheduling questions