IAE Academy

GATE 2025 CS1 Q.38: solution and answer

GATE 2025 · CS1Q.38 · 2 marks · MCQ

A computer has two processors, and . Four processes 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:
- uses priority of execution for the processes as, , i.e., and have highest and lowest priorities, respectively.
- uses priority of execution for the processes as, , i.e., and have highest and lowest priorities, respectively.

A process is scheduled to a processor , if the processor is free and no other process 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

  2. (B)

    8.75

  3. (C)

    6.50

  4. (D)

    7.50

See the question in the paper

Answer and solution

ANSWER

The average waiting time is 9.00 ms, option (A).

Official answer: ASource: Official answer key, GATE 2025 CS1 (IIT Roorkee)

  1. All four processes arrive at and both processors are free. Each free processor takes the waiting process that ranks highest in its own priority order, and no process is preempted once started.

  2. At : ranks first, so runs on during . ranks first, so runs on during .

  3. At : becomes free. and are waiting, and ranks , so runs on during . is still busy, so is the only free processor.

  4. At : becomes free. Only is waiting, so runs on during .

  5. Timeline: : , . : , .

  6. All arrivals are at 0, so waiting time = start time:

  7. Average waiting time ms, which is option (A).

KEY IDEA

With non-preemptive scheduling on two processors, each processor that becomes free picks the waiting process that is highest in its own priority list. Simulate the events in time order.

WATCH OUT FOR

Using one global priority order, or letting run on at before . ranks above , so goes first and waits until frees at .

From the GATE 2025 CS1 paper. Every question of this paper · Download the full paper · All 8 CPU scheduling questions, with notes

More CPU scheduling questions