GateAI
CPU and I/O Scheduling

GATE CSE 2017 Set 2 · Q51

NAT2 marksMedium

Time

Consider the set of processes with arrival time (in milliseconds), CPU burst time (in milliseconds), and priority (0 is the highest priority) shown below. None of the processes have I/O burst time. The average waiting time (in milliseconds) of all the processes using preemptive priority scheduling algorithm is _________.

GATE CSE 2017 Set 2 Q51 diagram

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 29 (±0)

CPU and I/O Scheduling

We can trace the execution using a Gantt chart with preemptive priority scheduling (lower priority value means higher priority):

  • At t=0t = 0: P1P_1 arrives (priority 2) and starts execution.

  • At t=2t = 2: P4P_4 arrives (priority 1). Since priority 1>21 > 2, P4P_4 preempts P1P_1. Remaining burst of P1=11−2=9P_1 = 11 - 2 = 9 ms.

  • At t=5t = 5: P2P_2 arrives (priority 0). Since priority 0>10 > 1, P2P_2 preempts P4P_4. Remaining burst of P4=10−3=7P_4 = 10 - 3 = 7 ms.

  • From t=5t = 5 to t=33t = 33: P2P_2 executes continuously until completion as it has the highest priority (0).

  • At t=33t = 33: The ready queue contains P4P_4 (remaining burst 7, priority 1), P1P_1 (remaining burst 9, priority 2), P3P_3 (burst 2, priority 3), and P5P_5 (burst 16, priority 4). P4P_4 has the highest priority, so it executes from t=33t = 33 to t=40t = 40.

  • At t=40t = 40: P1P_1 has the next highest priority (2), executing from t=40t = 40 to t=49t = 49.

  • At t=49t = 49: P3P_3 executes (priority 3) from t=49t = 49 to t=51t = 51.

  • At t=51t = 51: P5P_5 executes (priority 4) from t=51t = 51 to t=67t = 67.

Process Completion Times (CT), Turnaround Times (TAT = CT − AT), and Waiting Times (WT = TAT − BT):

  • P1P_1: CT=49\text{CT} = 49, TAT=49−0=49\text{TAT} = 49 - 0 = 49, WT=49−11=38\text{WT} = 49 - 11 = 38 ms

  • P2P_2: CT=33\text{CT} = 33, TAT=33−5=28\text{TAT} = 33 - 5 = 28, WT=28−28=0\text{WT} = 28 - 28 = 0 ms

  • P3P_3: CT=51\text{CT} = 51, TAT=51−12=39\text{TAT} = 51 - 12 = 39, WT=39−2=37\text{WT} = 39 - 2 = 37 ms

  • P4P_4: CT=40\text{CT} = 40, TAT=40−2=38\text{TAT} = 40 - 2 = 38, WT=38−10=28\text{WT} = 38 - 10 = 28 ms

  • P5P_5: CT=67\text{CT} = 67, TAT=67−9=58\text{TAT} = 67 - 9 = 58, WT=58−16=42\text{WT} = 58 - 16 = 42 ms

Average Waiting Time=38+0+37+28+425=1455=29 ms\text{Average Waiting Time} = \frac{38 + 0 + 37 + 28 + 42}{5} = \frac{145}{5} = 29\text{ ms}

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 Q51 of the GATE CSE 2017 Set 2 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. 10 of them are 2-mark NAT questions like this one, and it is the only one in GATE CSE 2017 Set 2.

How GATE tests CPU and I/O Scheduling

More from GATE CSE 2017 Set 2

Share this solution

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

GateAI solution cardGATE CSE 2017 Set 2 · Q51 · NAT

Consider the set of processes with arrival time (in milliseconds), CPU burst time (in milliseconds), and priority (0 is the highest priority) shown below. None of the processes have I/O burst time. The average waiting time (in milliseconds) of all the processes using preemptive priority scheduling algorithm is …

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.