The GATE Grind

GATE 2024 CS (CS2) – Question 37

Operating System · CPU and I/O Scheduling · 2 marks · Multiple choice

Consider a single processor system with four processes A, B, C, and D, where for each process the first value is its arrival time, and the second value is its CPU burst time: A (0, 10), B (2, 6), C (4, 3), and D (6, 7). Which one of the following options gives the average waiting times when preemptive Shortest Remaining Time First (SRTF) and Non-Preemptive Shortest Job First (NP-SJF) CPU scheduling algorithms are applied to the processes?

  1. SRTF = 6, NP-SJF = 7
  2. SRTF = 6, NP-SJF = 7.5
  3. SRTF = 7, NP-SJF = 7.5
  4. SRTF = 7, NP-SJF = 8.5

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) SRTF = 7, NP-SJF = 7.5

Explanation

SRTF: order A(0-2), B(2-4)... gives waiting times totalling 28, avg 7. NP-SJF: A 0-10, C 10-13, B 13-19, D 19-26 gives waits 0, 11, 6, 13 = 30, avg 7.5.