GateAI
CPU and I/O Scheduling

GATE CSE 2014 Set 3 · Q32

NAT2 marksMedium

Time

An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds): The average waiting time (in milliseconds) of the processes is ________.

GATE CSE 2014 Set 3 Q32 diagram

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 5.5

CPU and I/O Scheduling

We use the Shortest Remaining Time First (SRTF) scheduling algorithm:

  1. Gantt Chart Execution:

    • At t=0t = 0: P1P_1 arrives (Burst =12= 12). P1P_1 executes until t=2t = 2.

    • At t=2t = 2: P2P_2 arrives (Burst =4= 4). Remaining time for P1=10P_1 = 10. Since 4<104 < 10, P2P_2 preempts P1P_1.

    • At t=3t = 3: P3P_3 arrives (Burst =6= 6). Remaining time for P2=3P_2 = 3. Since 3<63 < 6, P2P_2 continues.

    • At t=6t = 6: P2P_2 completes. Ready queue: P1P_1 (rem =10= 10), P3P_3 (rem =6= 6). P3P_3 starts executing.

    • At t=8t = 8: P4P_4 arrives (Burst =5= 5). Remaining time for P3=4P_3 = 4. Since 4<54 < 5, P3P_3 continues.

    • At t=12t = 12: P3P_3 completes. Ready queue: P4P_4 (rem =5= 5), P1P_1 (rem =10= 10). P4P_4 executes.

    • At t=17t = 17: P4P_4 completes. P1P_1 resumes and executes until t=27t = 27.

  2. Completion Times (CTCT):

    • CT(P1)=27CT(P_1) = 27

    • CT(P2)=6CT(P_2) = 6

    • CT(P3)=12CT(P_3) = 12

    • CT(P4)=17CT(P_4) = 17

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

    • TAT(P1)=27−0=27TAT(P_1) = 27 - 0 = 27

    • TAT(P2)=6−2=4TAT(P_2) = 6 - 2 = 4

    • TAT(P3)=12−3=9TAT(P_3) = 12 - 3 = 9

    • TAT(P4)=17−8=9TAT(P_4) = 17 - 8 = 9

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

    • WT(P1)=27−12=15WT(P_1) = 27 - 12 = 15

    • WT(P2)=4−4=0WT(P_2) = 4 - 4 = 0

    • WT(P3)=9−6=3WT(P_3) = 9 - 6 = 3

    • WT(P4)=9−5=4WT(P_4) = 9 - 5 = 4

  5. Average Waiting Time:

    Average WT=15+0+3+44=224=5.5 ms\text{Average } WT = \frac{15 + 0 + 3 + 4}{4} = \frac{22}{4} = 5.5\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 Q32 of the GATE CSE 2014 Set 3 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 2014 Set 3.

How GATE tests CPU and I/O Scheduling

More from GATE CSE 2014 Set 3

Share this solution

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

GateAI solution cardGATE CSE 2014 Set 3 · Q32 · NAT

An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds): The average waiting time (in milliseconds) of the processes 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.