1.

What are the similarities and the differences between Shortest Job FIrst (SJF) and Shortest Remaining TIme FIrst (SRTF) CPU scheduling algorithms?

Answer»

SJF (Shortest Job First) is a scheduling policy that prioritizes the waiting PROCESS with the shortest EXECUTION time. Shortest Job Next (SJN) or Shortest Process Next are other names for it (SPN). It is a scheduling algorithm that is not preemptive (that is, one process cannot SNATCH the resources assigned to a currently running process).

The preemptive variant of SJF scheduling is the Shortest Remaining Time First (SRTF). The procedure, next in the queue, with the least amount of time till completion is chosen to be executed in this scheduling technique. Processes that arrive at the same time transform SRTF to SJF.

Similarities:

  • Both SJF and SRTF are ESSENTIALLY difficult to implement since the processes' burst time cannot be predicted.
  • Both SJF and SRTF have the potential to cause process starvation since long processes can be delayed forever if short processes are constantly added.
  • Once all of the processes are in the ready queue, both SJF and SRTF are regarded the same. This is because no preemption is performed after the processes are added to the ready queue.
Shortest Job FirstShortest Remaining Time First
SJF is a non-preemptive algorithm.SRTF is a preemptive algorithm.
SJF involves less overheads than SRTF.SRTF involves more overhead than SJF.
SJF results in comparatively lower throughput.SRTF results in increased throughput as execution is faster.
SJF reduces the average waiting time for each process.SRTF may or may not reduce the average waiting time for each process.
SJF involves a lesser NUMBER of context switching.SRTF involves a greater number of context switching.


Discussion

No Comment Found