Skip to content
Official PYQ · 2003

GATE CS 2003 Q77 — CPU Scheduling

Explain with AI

A uni-processor computer system only has two processes, both of which alternate 1010 ms\text{ms} CPU bursts with 9090 ms\text{ms} I/O bursts. Both the processes were created at nearly the same time. The I/O of both processes can proceed in parallel. Which of the following scheduling strategies will result in the least CPU utilization (over a long period of time) for this system?

Choose one option
View worked solution

Answer: D

To find the scheduling strategy that results in the least CPU utilization, let us analyze the execution timelines for the processes P1P_1 and P2P_2 under the given strategies. Each process has a CPU burst of 10 ms10\text{ ms} and an I/O burst of 90 ms90\text{ ms}.

1. FCFS, SRTF, and Static Priority Scheduling:

Under these non-preemptive or priority-based schemes, one process completes its entire CPU burst before the other starts:

  • At t=0t = 0, P1P_1 runs on the CPU until t=10 mst = 10\text{ ms}, then goes for I/O (ready at t=100 mst = 100\text{ ms}).
  • At t=10 mst = 10\text{ ms}, P2P_2 runs on the CPU until t=20 mst = 20\text{ ms}, then goes for I/O (ready at t=110 mst = 110\text{ ms}).
  • The CPU remains idle from t=20 mst = 20\text{ ms} to t=100 mst = 100\text{ ms}.
  • At t=100 mst = 100\text{ ms}, P1P_1 returns and the cycle repeats.

The total cycle length is 100 ms100\text{ ms} (from t=100t = 100 to t=200t = 200), during which the CPU is busy for 20 ms20\text{ ms} (10 ms10\text{ ms} for P1P_1 and 10 ms10\text{ ms} for P2P_2).

CPU Utilization=20 ms100 ms=20%\text{CPU Utilization} = \frac{20\text{ ms}}{100\text{ ms}} = 20\%

2. Round Robin (RR) with Time Quantum = 5 ms5\text{ ms}:

Because of preemption, the execution interleaves:

  • t=0 to 5 mst = 0 \text{ to } 5\text{ ms}: P1P_1 runs (remaining = 5 ms5\text{ ms}).
  • t=5 to 10 mst = 5 \text{ to } 10\text{ ms}: P2P_2 runs (remaining = 5 ms5\text{ ms}).
  • t=10 to 15 mst = 10 \text{ to } 15\text{ ms}: P1P_1 runs and finishes, going to I/O (ready at 15+90=105 ms15 + 90 = 105\text{ ms}).
  • t=15 to 20 mst = 15 \text{ to } 20\text{ ms}: P2P_2 runs and finishes, going to I/O (ready at 20+90=110 ms20 + 90 = 110\text{ ms}).
  • The CPU is idle from t=20 mst = 20\text{ ms} to t=105 mst = 105\text{ ms}.
  • At t=105 mst = 105\text{ ms}, P1P_1 returns and runs until t=110 mst = 110\text{ ms} (remaining = 5 ms5\text{ ms}).
  • At t=110 mst = 110\text{ ms}, P2P_2 returns. Since P1P_1 has completed its 5 ms5\text{ ms} quantum, a context switch occurs. P2P_2 runs from t=110 to 115 mst = 110 \text{ to } 115\text{ ms} (remaining = 5 ms5\text{ ms}).
  • t=115 to 120 mst = 115 \text{ to } 120\text{ ms}: P1P_1 finishes and goes to I/O (ready at 120+90=210 ms120 + 90 = 210\text{ ms}).
  • t=120 to 125 mst = 120 \text{ to } 125\text{ ms}: P2P_2 finishes and goes to I/O (ready at 125+90=215 ms125 + 90 = 215\text{ ms}).

The repeating cycle now runs from t=105 mst = 105\text{ ms} to t=210 mst = 210\text{ ms}, which has a duration of 105 ms105\text{ ms}. During this cycle, the CPU is active for 20 ms20\text{ ms} (from t=105t = 105 to t=125t = 125).

CPU Utilization=20 ms105 ms≈19.05%\text{CPU Utilization} = \frac{20\text{ ms}}{105\text{ ms}} \approx 19.05\%

Since 19.05%<20%19.05\% < 20\%, Round Robin scheduling with a time quantum of 5 ms5\text{ ms} results in the least CPU utilization.

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

Published
Report a correction
Keep exploringMore CPU Scheduling questions