This is a multipart blog article series, and in this series I am going to explain you the concepts of operating system. This article series is divided into multiple modules and this is the second module which consists of 11 articles.
In this article we will see a question on shortest job first and try to understand the concepts of SJF operation in an operating system.
Question: The gantt chart for pre-emptive shortest job first scheduling algorithm will be?
|Process No.||Arrival time||Burst time|
- Pre-emptive shortest job first (SJF) is also known as shortest remaining time first.
- Gantt chart always starts from zero.
- The process
P1arrives at CPU at time unit
0with burst time of
7units, it get executed for
1unit of time. Now the remaining burst time of process
- At time unit
P2also arrives at the CPU with burst time of
4units less than the burst time of
P1will be preempt and
P2will start executing, it will get executed completely and terminated because no other process have less burst time then it.
P3has already arrived to CPU at time unit
- If we check the time units of the both the processes present in the ready queue, we see that
P1have burst time of
6unit left and
8units of burst time. So,
P1will again start its execution till it ends.
P1ends at time unit
P3start its execution and get terminate at time unit
So, this was all about pre-emptive shortest job first CPU scheduling algorithm in an operating system. Hope you liked it and learned something from it.
If you have any doubt, question, queries related to this topic or just want to share something with me, then please feel free to contact me.