Skip to content

UGC NET CS 2019System Software and Operating System › CPU SchedulingVerified

UGC NET CS 2019 PYQ: Consider three CPU intensive processes, which require 10, 20 and 30 units of time and arrive at times 0, 2…

Consider three CPU intensive processes, which require 10, 20 and 30 units of time and arrive at times 0, 2 and 6 respectively. How many context switches are needed if the operating system implements a shortest remaining time first scheduling algorithm? Do not count the context switches at time zero and at the end.

  1. A
    4
  2. B
    2
    Correct answer
  3. C
    3
  4. D
    1

Answer

(B) 2

Approach

Simulate shortest remaining time first (preemptive SJF) and count only the preemptions between processes, excluding time 0 and completion.

Reviewed by UGC IQ Editorial Team.