You are on page 1of 1

Title: Shortest Job First Algorithm

Introduction

To ensure that the CPU operates optimally allowing the consistent flow of data back and forth.
To achieve this CPU scheduling was developed and there are different types of CPU scheduling but the
most common type is called Shortest Job First Algorithm.

Shortest Job First Algorithm

Shortest job first also known as Shortest Job next is a type a CPU scheduling stated earlier. It simply
works by selecting the task with Shortest execution time to be executed next.

How it works

Its Algorithm works using three parameters which are:

 All tasks are originally sorted according to arrival time.


 The task with the lowest arrival time, is then selected.
 Once one task is completed the next task is selected using the steps about from the process pool
and so on.

Types

There are 2 types of SJF namely:

1. Pre-emotive: in pre-emtive SJF as jobs arrive they’re put in the ready queue and are executed
sequentially just ad they arrived since they all have the same execution time.
2. Non Pre-emptive: here the arrival time for the tasks vary and as such the task with the Shortest
burst time is then given priority.

Note: for this system to be used effectively the burst time of each process should be known to the
CPU ahead of time, which isn’t practically possible.

The algorithm is best used for batch systems where the tasks have the same arrival time.

You might also like