GateAI
CPU and I/O Scheduling

GATE CSE 2011 · Q35

MCQ2 marksMedium

Time

Consider the following table of arrival time and burst time for three processes P0, P1 and P2. The pre-emptive shortest job first scheduling algorithm is used. Scheduling is carried out only at arrival or completion of processes. What is the average waiting time for the three processes?

GATE CSE 2011 Q35 diagram

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: A) 5.0 ms

CPU and I/O Scheduling

From the given process table:

  • Process P0: Arrival Time = 0 ms0\text{ ms}, Burst Time = 9 ms9\text{ ms}

  • Process P1: Arrival Time = 1 ms1\text{ ms}, Burst Time = 4 ms4\text{ ms}

  • Process P2: Arrival Time = 2 ms2\text{ ms}, Burst Time = 9 ms9\text{ ms}

Gantt Chart Execution (Pre-emptive Shortest Job First / SRTF):

  1. Time 0 to 1 ms: Only P0 is present. P0 executes for 1 ms1\text{ ms}. Remaining burst of P0 = 8 ms8\text{ ms}.

  2. Time 1 ms: P1 arrives with remaining burst 4 ms4\text{ ms}. Since 4<84 < 8, P0 is pre-empted and P1 starts executing.

  3. Time 2 ms: P2 arrives with burst 9 ms9\text{ ms}. Remaining burst of P1 is 3 ms3\text{ ms}, which is the shortest (3<8<93 < 8 < 9). P1 continues executing.

  4. Time 5 ms: P1 completes execution.

  5. Time 5 ms to 13 ms: Ready queue has P0 (remaining 8 ms8\text{ ms}) and P2 (remaining 9 ms9\text{ ms}). Since 8<98 < 9, P0 executes to completion at time 5+8=13 ms5 + 8 = 13\text{ ms}.

  6. Time 13 ms to 22 ms: P2 executes to completion at time 13+9=22 ms13 + 9 = 22\text{ ms}.

Calculation of Waiting Times:

  • Completion Time (CTCT):

    • P0: 13 ms13\text{ ms}

    • P1: 5 ms5\text{ ms}

    • P2: 22 ms22\text{ ms}

  • Turnaround Time (TAT=CT−ATTAT = CT - AT):

    • P0: 13−0=13 ms13 - 0 = 13\text{ ms}

    • P1: 5−1=4 ms5 - 1 = 4\text{ ms}

    • P2: 22−2=20 ms22 - 2 = 20\text{ ms}

  • Waiting Time (WT=TAT−BTWT = TAT - BT):

    • P0: 13−9=4 ms13 - 9 = 4\text{ ms}

    • P1: 4−4=0 ms4 - 4 = 0\text{ ms}

    • P2: 20−9=11 ms20 - 9 = 11\text{ ms}

Average Waiting Time:

Average WT=4+0+113=153=5.0 ms\text{Average } WT = \frac{4 + 0 + 11}{3} = \frac{15}{3} = 5.0\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 Q35 of the GATE CSE 2011 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 2011.

How GATE tests CPU and I/O Scheduling

More from GATE CSE 2011

Share this solution

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

GateAI solution cardGATE CSE 2011 · Q35 · MCQ

Consider the following table of arrival time and burst time for three processes P0, P1 and P2. The pre-emptive shortest job first scheduling algorithm is used. Scheduling is carried out only at arrival or completion of processes. What is the average waiting time for the three processes?

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.