GateAI
CPU and I/O Scheduling

GATE CSE 2020 · Q50

NAT2 marksMedium

Time

Consider the following set of processes, assumed to have arrived at time 0. Consider the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For RR, assume that the processes are scheduled in the order P1,P2,P3,P4P_1, P_2, P_3, P_4. If the time quantum for RR is 4 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is _______.

GATE CSE 2020 Q50 diagram

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 5.25

CPU and I/O Scheduling

### 1. Shortest Job First (SJF - Non-preemptive since all arrive at t=0t=0): Order of execution based on shortest burst time: P3(2)→P4(4)→P2(7)→P1(8)P_3 (2) \to P_4 (4) \to P_2 (7) \to P_1 (8)

  • Completion Times (CT):

    • CT(P3)=2CT(P_3) = 2

    • CT(P4)=2+4=6CT(P_4) = 2 + 4 = 6

    • CT(P2)=6+7=13CT(P_2) = 6 + 7 = 13

    • CT(P1)=13+8=21CT(P_1) = 13 + 8 = 21

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

    • Average TATSJF=2+6+13+214=424=10.5 msTAT_{SJF} = \frac{2 + 6 + 13 + 21}{4} = \frac{42}{4} = 10.5\text{ ms}

### 2. Round Robin (RR) with time quantum q=4 msq = 4\text{ ms}: Queue order: P1,P2,P3,P4P_1, P_2, P_3, P_4

  • 0−40 - 4: P1P_1 executes for 4 ms (remaining: 4)

  • 4−84 - 8: P2P_2 executes for 4 ms (remaining: 3)

  • 8−108 - 10: P3P_3 executes for 2 ms (completes at t=10t = 10)

  • 10−1410 - 14: P4P_4 executes for 4 ms (completes at t=14t = 14)

  • 14−1814 - 18: P1P_1 executes for 4 ms (completes at t=18t = 18)

  • 18−2118 - 21: P2P_2 executes for 3 ms (completes at t=21t = 21)

Completion Times for RR:

  • CT(P1)=18CT(P_1) = 18

  • CT(P2)=21CT(P_2) = 21

  • CT(P3)=10CT(P_3) = 10

  • CT(P4)=14CT(P_4) = 14

  • Average TATRR=18+21+10+144=634=15.75 msTAT_{RR} = \frac{18 + 21 + 10 + 14}{4} = \frac{63}{4} = 15.75\text{ ms}

### 3. Absolute Difference:

∣TATSJF−TATRR∣=∣10.5−15.75∣=5.25 ms|TAT_{SJF} - TAT_{RR}| = |10.5 - 15.75| = 5.25\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 Q50 of the GATE CSE 2020 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 GATE CSE 2020 has 2.

How GATE tests CPU and I/O Scheduling

More from GATE CSE 2020

Share this solution

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

GateAI solution cardGATE CSE 2020 · Q50 · NAT

Consider the following set of processes, assumed to have arrived at time 0. Consider the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For RR, assume that the processes are scheduled in the order P1, P2, P3, P4. If the time quantum for RR is 4 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) 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.