Shortest Remaining Time Scheduling





Shortest remaining time (SRT) scheduling
Shortest remaining time scheduling is the preemptive counter part of SJF and is useful in time sharing system. In SRT, process with the smallest estimated run time to completion is run next, in SJF once a job begin executing, it runs to completion. In SRT a running process may be preempted by a user process with a shorter estimated run time.
Consider an example, where three processes arrived in the order P1, P2, P3 at the time mentioned below, and then the average waiting time using SJF scheduling algorithm will be calculated as:

process CPU Burst Time Time of Arrival
p1 10 0
p2 5 1
p3 2 2
shortest remaining time scheduling

shortest remaining time scheduling

In this, the CPU will be taken away from the currently executing process whenever a process will less CPU burst time.
As shown in figure, the time when P2 arrives P1 needs 9 millisecond more to finish. As B’s cpu burst in 5 millisecond < 9 millisecond, therefore, P1’s execution will be preempted and P2 will be executed but against as P3 arrives P2’s execution needs 3 more millisecond where as P3 needs only 2 millisecond to execute, thus P3 takes over P2 and so on.

Waiting time for P1 = 0+ (8-1) = 7 millisecond
Waiting time for P2 = 1+ (4-2) = 3 millisecond
Waiting time for P3 = 2 millisecond
Average waiting time = (7+3+2) / 3 = 4 millisecond



Related posts:

  1. Shortest job first scheduling Shortest job first scheduling Key concept of this algorithm is:...
  2. Round robin scheduling Round Robin Scheduling The basic purpose of this algorithm is...
  3. Scheduling Introduction Scheduling is the process of determining which processes will...
  4. First Come First Served Algorithm First come first served scheduling algorithm (FCFS) FCFS also termed...
  5. Processes Scheduling queue As processes enter the system they put in job queue....