 Ajit Bundalai, assistant professor, electrons department, Valtran Institute, Solapur. Friend, in this video lecture, we are going to just have a discussion over the shortage of first process scheduling algorithm. Now, in this video, we expect these kind of outcomes here, that you should be able to describe the shortage of first algorithm, and we just try to evaluate its performance with the help of some performance parameters. Now, the goals of these lectures are, we have to first understand how this shortage of first algorithm works here, then we will evaluate some of the parameters regarding this performance evaluation of this SJF, and we also have some comments about the benefits and drawbacks there. Friend, this is SJF is standing for a shortage of first, and this is an example of non-preemptive scheduling algorithm. It means that when one's process goes inside the CPU for execution, we cannot get execution in between here. Then the main principle of the working, it considers the burst time of a process to decide who will go first in the CPU for execution there. So, the name suggests that we said that process which is having a smaller burst time. What is burst time, friend here? This is a time required to execute all the process completely in the CPU. Now in this mechanism, the CPU is going to choose the smallest burst time process initially here, and he will execute that process initially. Now, after this execution, now he will think regarding the second process which is having the smallest burst time available amongst the remaining processes which are in the ready queue. So friend, ultimately in all this processing, we consider the burst time and in this scheduling, we consider the smallest burst time initially here. That's why the name is coming as the smallest job first type of mechanism here. Then as I said earlier here, this entire process is depending upon the burst time here. And just try to understand some of the features of this algorithm. So this table shows you some processes that are stacked in the given ready queue. And the second comment shows you the process arrival times and the last is showing you the burst time. So table shows you the process P1, P2, P3, P4 and P5, they are arriving in the ready queue at different time instances that is 1, 2, 3, 4, 5 and so on. The burst times also are noted down in the last column. So friend, by looking in the last column, we simply make a judgment that the P3 is having the smallest burst time here. And as the name says that the shortage of first mechanism, this P3 should get first chance of execution here. But is it possible? Because in this case of execution, we have to also consider the time of arrivals of these processes. So friend in this kind of execution, we have to take into account both the parameters such as the arrival time of process and the burst time into account. Now working of this SJF here, the shortage of first year. So always we start execution in the CPU at the zero time instant here. It means that the CPU is going to look for all the process are available in ready queue at the zero time instant. And he will choose that process which is having the smaller burst time here. But suppose friend, if I don't find any process is ready at zero time instant in the ready queue, so that zero to one or zero time instant get unused here. And after that, I will again check down different process available at first time instant in ready queue. And then I will make a choice between the processes in ready in ready queue, which is having the smaller burst time. Now friend, when I see a burst time is small for some process here, I will take down this process from ready queue. And that is sent to the running queue, which is in the CPU and we execute that process. After that execution, now we are going to look for the next process here. Friend, this is the mechanism that utilizes non preemptive type of execution, which mean that when process enters in the running queue or in the CPU, we are not going to stop its execution. Now friend, again going back with the same example here, let us try to draw some Gantt chart here. Gantt chart just tells you the different process how they are put in the sequence, along with some timings are written at the bottom here. As I said earlier friend here, we always start this execution at zero time instant here. So friend, if you see that in this case, friend, you see that in this case here, the P1 is arriving at its first time instant here. And we say that the CPU start execution at zero time instant here. So CPU expects some process should be ready in the ready queue at zero time instant here. But presently from the given chart here, we are not finding any process is available in the ready queue at zero time instant here. That's why the zero to first time interval is not used here. It is get lost in fact unused I can say. Now I will not describe the process available in the ready queue at first time instant here. Friend at this first instant here, only P1 is ready in the ready queue there. And so that is no any solution parameter remaining for me, but I have to go for P1 execution there. So this P1 enters in the running queue at this first instant here. And this CPU execute all this process P1 completely at the end of this eighth time instant here. Because the burst time for this P1 is 7 time units I can say. Now friend, actually when you want to evaluate this performance of this shortage of first algorithm, we are going to consider two parameters of performance here. One is called the turn around time. And the other is called as a TAT, which is a difference between the time of completion of a process minus the time of arrival of a process here. And secondly, we also consider the waiting time. It is a difference between the turn around time and the burst time. Friend again just get back to the main chart here and just try to calculate what is the end time? What is the process time of completion here? What is the turn around time? All that thing here. So friends, as you see here, the chart shows you these are the input conditions given by the example here. Then I will use this can chart to enter all these parameters in these different columns here. So friend from this can chart, we are going to put some entries in the column which is denote me the time of completion. And this TAT is now find by the formulae and again this waiting time also is used by using that formula there. So friend from this can chart here, the process P1 enters in the CPU at the first time instant here and it ends its execution at the end of 8 time instant here. So just I mark this entry in this CT, so these are the time of completion from the Gantt chart here. Now from this Gantt chart I can always find this value of TAT which is CT minus AT here. So it is quite simple to enter all these entries in the table. So it is having all these parameters enter like this. Then we also go for the last which is called the waiting time which is a difference between the TAT and the burst time. So the entries are coming like this. So friend now we are getting different values of this TAT for all the process, we also get different waiting time for this processes from the given chart here. But normally we measure the performance with the help of this average TAT and this average waiting time. So for this example friend the value of this average TAT comes as 9.2 and this average waiting time is coming as 5.2 milliseconds here or I can say here suppose the times are in terms of milliseconds it is taken to be millisecond here otherwise it can be taken as 9.2 time units here. Now friend before I close here let us have some glimpse of the features of this HF. This is a non preemptive execution or type of scheduling algorithm here. Then it is a base approach to minimize the waiting time because we always choose a short process initially. So ultimately the waiting time for this small process will be get decreased here. Now in this case friend this one critical thing to be marked here that the processor should be knowing how much burst time is required to execute that process which is rather a difficult thing to understand here. Regarding this advantages here friend this is a SJF having a biggest advantage is that it is having smaller waiting time for the small processes here and it is normally called as it is having small time for waiting here which confirm that there is no starvation for small processes. Friend this is something about this SJF algorithm these are references. I hope this video is helping you to understand the basic concept of this SJF. Thank you for listening this video. Thanks very much.