Operating Systems | Scheduling Algorithms : SRTF


Shortest Remaining Time First(SRTF)

It schedules a job with least remaining time among available jobs in ready state. Usually it is a preemptive algorithm, so it has to check and reschedule process with least remaining time at every unit interval of time.

Example : Consider the following table of processes and calculate completion time, turn around time and waiting time using STJF algorithm with the following assumptions.

  • Preemptive algorithm.
  • No I/O request will be there from any process.
  • Arrival time is relative to CPU on time.

Process AT BT
P1 0 4
P2 1 3
P3 2 1
P4 3 2

Answer:



The scheduler has to check the shorted burst time at every unit interval of execution and to reschedule the CPU with shortest among available process. The overall process can be depicted as shown in following figure.

Once all the processes are arrived at the memory the algorithm shows same behavior as that of SJF algorithm.

Process Number AT BT CT TAT WT
1 0 4 5 5 1
2 1 3 7 6 3
3 2 1 3 1 0
4 3 2 9 6 4

Generally algorithm which considers burst time as a parameter, can not be implemented on a realistic basis but using probabilistic predictive methods.

Comments