Skip to main content

Shortest job First (SJF)

  

Out of all available (waiting) processes, it selects the processes, it selects the process with the smallest burst time to execute next.

  • This algorithm for both Non-preemptive and Preemptive (SRTF- Shortest Remaining Time First).
  • If two processors the burst time is same then we will go with the first come first serve.
  • Here Completion time= Gantt chart values.
  •   Turn Around time = Completion time -  Arrival time.
  •  Waiting Time = Turn Around time -  Burst time.
  • Response time = Gantt chart values arrival - Arrival time.
  • It is preemption running process here in Gantt chart we check for processor for each and every one unit.
  • After all the elements in the ready queue it will work  as Non- Preemption.

Advantage of Shortest job First

  • Min average waiting time & min average Turn Around time.
  • Better Response time than FCFS.
  • Max Throughput.
  • Provides a standard for other algorithms in case of average waiting time.

Disadvantage

  • Can not be implemented.
  • Starvation problem with process having larger Burst time.

Shortest job First (SJF) with prediction of Burst Time in OS

  • Process Size.
  • Process type.
  • Simple Averaging (τ(n+1) = (1/n) ∑ T(i) )
  • Exponential average (Aging) – Τn+1 = αtn + (1 - α)Τn 
                         α = smoothing factor  and 0 <= α <= 1
                         tn = actual burst time of nth process
                          Τn = predicted burst time of nth process.

Popular posts from this blog

Operating System

What is an operating system? An operating system (OS) is the program that, after being initially loaded into the computer by a boot program, manages all of the other application programs in a computer. The application programs make use of the operating system by making requests for services through a defined application program interface ( API ). In addition, users can interact directly with the operating system through a user interface, such as a command-line interface (CLI) or a graphical UI (GUI). Why use an operating system? An operating system brings powerful benefits to computer software and software development. Without an operating system, every application would need to include its own UI, as well as the comprehensive code needed to handle all low-level functionality of the underlying computer, such as disk storage, network interfaces and so on. Considering the vast array of underlying hardware available, this would vastly bloat the size of every application and make software