Skip to content
Official PYQ · 2021

GATE CS 2021 Set 1 Q25 — CPU Scheduling

Explain with AI
Three processes arrive at time zero with CPU\text{CPU} bursts of 16,  2016,\;20 and 1010 milliseconds. If the scheduler has prior knowledge about the length of the CPU\text{CPU} bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest integer) is _____________ milliseconds.
View worked solution

Answer: 12 : 12

To minimize the average waiting time of a set of processes, the optimal scheduling algorithm is Shortest Job First (SJF).

We are given three processes arriving at time t=0t = 0 with the following CPU burst times:

  • P1P_1: 16 ms16\text{ ms}
  • P2P_2: 20 ms20\text{ ms}
  • P3P_3: 10 ms10\text{ ms}

Sorting these processes in ascending order of their burst times (SJF order):

Execution Order: P3→P1→P2\text{Execution Order: } P_3 \to P_1 \to P_2

Gantt Chart:

The execution timeline is as follows:

P3P1P20102646\begin{array}{|c|c|c|} \hline \quad P_3 \quad & \quad P_1 \quad & \quad P_2 \quad \\ \hline 0 \quad\quad\quad 10 & \quad\quad\quad\quad 26 & \quad\quad\quad\quad\quad 46 \\ \hline \end{array}

Waiting Time Calculation:

Since all processes arrive at time t=0t = 0, the waiting time for each process is simply its start time:

  • Waiting time of P3=0 msP_3 = 0\text{ ms}
  • Waiting time of P1=10 msP_1 = 10\text{ ms}
  • Waiting time of P2=26 msP_2 = 26\text{ ms}

Average Waiting Time=0+10+263=363=12 ms\text{Average Waiting Time} = \frac{0 + 10 + 26}{3} = \frac{36}{3} = 12\text{ ms}

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

Published
Report a correction
Keep exploringMore CPU Scheduling questions