
Shortest job next (SJN), also known as shortest job first (SJF) or shortest process next (SPN), is a
scheduling policy
In computing, scheduling is the action of assigning ''resources'' to perform ''tasks''. The ''resources'' may be processors, network links or expansion cards. The ''tasks'' may be threads, processes or data flows.
The scheduling activity is ...
that selects for execution the waiting
process
A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic.
Things called a process include:
Business and management
*Business process, activities that produce a specific se ...
with the smallest execution time.
SJN is a non-
preemptive algorithm.
Shortest remaining time
Shortest remaining time, also known as shortest remaining time first (SRTF), is a scheduling method that is a preemptive version of shortest job next scheduling. In this scheduling algorithm, the process with the smallest amount of time remainin ...
is a preemptive variant of SJN.
Shortest job next is advantageous because of its simplicity and because it minimizes the average amount of time each process has to wait until its execution is complete. However, it has the potential for
process starvation
A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic.
Things called a process include:
Business and management
*Business process, activities that produce a specific se ...
for processes which will require a long time to complete if short processes are continually added.
Highest response ratio next Highest response ratio next (HRRN) scheduling is a non-preemptive discipline. It was developed by Brinch Hansen as modification of shortest job next or shortest job first (SJN or SJF) to mitigate the problem of process starvation. In HRRN, the ne ...
is similar but provides a solution to this problem using a technique called
aging
Ageing ( BE) or aging ( AE) is the process of becoming older. The term refers mainly to humans, many other animals, and fungi, whereas for example, bacteria, perennial plants and some simple animals are potentially biologically immortal. In ...
.
Another disadvantage of using shortest job next is that the total execution time of a job must be known before execution. While it is impossible to predict execution time perfectly, several methods can be used to estimate it, such as a weighted average of previous execution times.
Multilevel feedback queue In computer science, a multilevel feedback queue is a scheduling algorithm. ''Scheduling algorithms'' are designed to have some process running at all times to keep the central processing unit (CPU) busy. The ''multilevel feedback queue'' extends st ...
can also be used to approximate SJN without the need for the total execution time oracle.
Shortest job next can be effectively used with interactive processes which generally follow a pattern of alternating between waiting for a command and executing it. If the execution burst of a process is regarded as a separate "job", the past behaviour can indicate which process to run next, based on an estimate of its running time.
Shortest job next is used in specialized environments where accurate estimates of running time are available.
Weighted shortest job first
Weighted shortest job first (WSJF) is a modification of the concept used in
agile development
In software development, agile (sometimes written Agile) practices include requirements discovery and solutions improvement through the collaborative effort of self-organizing and cross-functional teams with their customer(s)/ end user(s), a ...
where jobs get weighted with the
cost of delay Cost of Delay is "a way of communicating the impact of time on the outcomes we hope to achieve". More formally, it is the partial derivative of the ''total expected value'' with respect to ''time''. Cost of Delay combines an understanding of value w ...
so that the highest valued jobs get done sooner.
Value-flow rate (VFR) is an alternate, more intuitive name given to WSJF which expresses
cost of delay Cost of Delay is "a way of communicating the impact of time on the outcomes we hope to achieve". More formally, it is the partial derivative of the ''total expected value'' with respect to ''time''. Cost of Delay combines an understanding of value w ...
and duration using unitless relative "points" rather than actual units of time or money.
See also
*
Shortest remaining time
Shortest remaining time, also known as shortest remaining time first (SRTF), is a scheduling method that is a preemptive version of shortest job next scheduling. In this scheduling algorithm, the process with the smallest amount of time remainin ...
References
External links
Shortest job first scheduling
{{DEFAULTSORT:Shortest Job Next
Processor scheduling algorithms