GateAI
CPU and I/O Scheduling

GATE CSE 2025 Set 1 · Q38

MCQ2 marksMedium

Time

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?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: A) 9.00

CPU and I/O Scheduling

Let all processes arrive at t=0t = 0 ms.

### Process Details:

  • P1P_1: Burst time = 20 ms20\text{ ms}

  • P2P_2: Burst time = 16 ms16\text{ ms}

  • P3P_3: Burst time = 25 ms25\text{ ms}

  • P4P_4: Burst time = 10 ms10\text{ ms}

### Priority Orders:

  • For M1M_1: P1>P3>P2>P4P_1 > P_3 > P_2 > P_4

  • For M2M_2: P2>P3>P4>P1P_2 > P_3 > P_4 > P_1

---

### Step-by-step Scheduling:

  1. At t=0 mst = 0\text{ ms}:

    • Both M1M_1 and M2M_2 are free.

    • Among the available processes {P1,P2,P3,P4}\{P_1, P_2, P_3, P_4\}:

      • The highest priority process for M1M_1 is P1P_1. Thus, P1P_1 is allocated to M1M_1 for duration 20 ms20\text{ ms} (executes from t=0t = 0 to t=20t = 20).

      • Among the remaining processes {P2,P3,P4}\{P_2, P_3, P_4\}, the highest priority process for M2M_2 is P2P_2. Thus, P2P_2 is allocated to M2M_2 for duration 16 ms16\text{ ms} (executes from t=0t = 0 to t=16t = 16).

  2. At t=16 mst = 16\text{ ms}:

    • Processor M2M_2 finishes P2P_2 and becomes free.

    • Waiting processes are {P3,P4}\{P_3, P_4\}.

    • For M2M_2, priority order is P3>P4P_3 > P_4. Therefore, P3P_3 is scheduled on M2M_2 for duration 25 ms25\text{ ms} (executes from t=16t = 16 to t=41t = 41).

  3. At t=20 mst = 20\text{ ms}:

    • Processor M1M_1 finishes P1P_1 and becomes free.

    • The only remaining process waiting is P4P_4.

    • Therefore, P4P_4 is scheduled on M1M_1 for duration 10 ms10\text{ ms} (executes from t=20t = 20 to t=30t = 30).

---

### Waiting Times: Waiting Time for P1=0−0=0 msWaiting Time for P2=0−0=0 msWaiting Time for P3=16−0=16 msWaiting Time for P4=20−0=20 ms\begin{aligned} \text{Waiting Time for } P_1 &= 0 - 0 = 0\text{ ms} \\ \text{Waiting Time for } P_2 &= 0 - 0 = 0\text{ ms} \\ \text{Waiting Time for } P_3 &= 16 - 0 = 16\text{ ms} \\ \text{Waiting Time for } P_4 &= 20 - 0 = 20\text{ ms} \end{aligned}

### Average Waiting Time:

Average Waiting Time=0+0+16+204=364=9.00 ms\text{Average Waiting Time} = \frac{0 + 0 + 16 + 20}{4} = \frac{36}{4} = 9.00\text{ ms}

Hence, the correct option is (A).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This CPU and I/O Scheduling previous year question is Q38 of the GATE CSE 2025 Set 1 paper. Find more GATE CSE PYQs on CPU and I/O Scheduling in Operating Systems, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related CPU and I/O Scheduling PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

CPU and I/O Scheduling in GATE CSE

CPU and I/O Scheduling has 25 GATE CSE PYQs across 22 papers from 2011 to 2026. 7 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2025 Set 1.

How GATE tests CPU and I/O Scheduling

More from GATE CSE 2025 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2025 Set 1 · Q38 · MCQ

A computer has two processors, M1 and M2. Four processes P1, P2, P3, P4 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: • M1 uses priority of execution for the processes as, P1 > P3 > P2 > P4, i.e., P1 and P4 have highest and lowest priorities, respectively. • M2 uses priority of execution for the processes as, P2 > P3 > P4 > P1, i.e., P2 and P1 have highest and lowest priorities, respectively. A process Pi is scheduled to a processor Mk, if the processor is free and no other process Pj 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?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.