The GATE Grind

GATE 2025 CS (CS1) – Question 38

Operating System · CPU and I/O Scheduling · 2 marks · Multiple choice

A computer has two processors, $M_1$ and $M_2$. Four processes $P_1, P_2, P_3, P_4$ with CPU bursts of 20, 16, 25, and 10 milliseconds, respectively, arrive at the same time and these are the only processes in the system. The scheduler uses non-preemptive priority scheduling, with priorities decided as follows:
- $M_1$ uses priority of execution for the processes as, $P_1 > P_3 > P_2 > P_4$, i.e., $P_1$ and $P_4$ have highest and lowest priorities, respectively.
- $M_2$ uses priority of execution for the processes as, $P_2 > P_3 > P_4 > P_1$, i.e., $P_2$ and $P_1$ have highest and lowest priorities, respectively.

A process $P_i$ is scheduled to a processor $M_k$, if the processor is free and no other process $P_j$ is waiting with higher priority. At any given point of time, a process can be allocated to any one of the free processors without violating the execution priority rules. Ignore the context switch time. What will be the average waiting time of the processes in milliseconds?

  1. 9.00
  2. 8.75
  3. 6.50
  4. 7.50

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (A) 9.00

Explanation

At t=0, P1 runs on M1 (0-20) and P2 runs on M2 (0-16). At t=16 M2 picks P3 (16-41). At t=20 M1 picks P4 (20-30). Waiting times are 0, 0, 16, 20, so the average is 36/4 = 9.00.