Skip to main content

GATE CSE 2025Operating System › CPU SchedulingVerified

GATE CSE 2025 PYQ: A computer has two processors, M 1 M_{1} M 1 ​ and M 2 M_{2} M 2 ​ . Four processes P 1 , P 2 , P 3 , P 4…

A computer has two processors, M1M_{1} and M2M_{2}. Four processes P1,P2,P3,P4P_{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:

  • M1M_{1} uses priority of execution for the processes as, P1>P3>P2>P4P_{1}>P_{3}>P_{2}>P_{4}, i.e., P1P_{1} and P4P_{4} have highest and lowest priorities, respectively.
  • M2M_{2} uses priority of execution for the processes as, P2>P3>P4>P1P_{2}>P_{3}>P_{4}>P_{1}, i.e., P2P_{2} and P1P_{1} have highest and lowest priorities, respectively.

A process PiP_{i} is scheduled to a processor MkM_{k}, if the processor is free and no other process PjP_{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. A
    9.00
    Correct answer
  2. B
    8.75
  3. C
    6.50
  4. D
    7.50

Answer

(A) 9.00 9.00 9.00

Approach

Simulate the non-preemptive two-processor schedule clock by clock. At each instant a processor becomes free, assign it the waiting process that has the highest priority in that processor's own priority order, since no higher-priority process is then blocked. Then compute waiting time = completion time − burst time for each process (all arrive at t = 0) and average.

The two processors pick independent top-priority processes at t = 0, then each frees and picks the best remaining process in its own order. This yields one valid schedule with waiting times 0, 0, 16, 20, so the average waiting time is 9.00 ms, matching option A. All three community answers agree on 9.00.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.