Shortest job first is a scheduling algorithm in which the process with the smallest execution time is selected for execution next. Shortest job first can be either preemptive(SRTF) or non-preemptive. Owing to its simple nature, shortest job first is considered optimal. It also reduces the average waiting time for other processes awaiting execution.
This page will demonsrate Preemptive SJF. In this scheduling system the shortest process is selected and processed as long as a new process arrives. If the new process has a smaller burst time than the remaining burst time of the current process then the current process is interupted and the new (Just arrived) process is executed.