 Hello friends, I am Ajay Gundalai, Assistant Professor, Department of Electronics, Vulture Institute, Solapur. In this video lecture, friend, we are going to put some focus on the shortest remaining time first algorithm. At the end of this video, we expect all these kind of outcomes that you should be able to describe the working of the shortest remaining time first algorithm. I will shortly call this as a SRTF and then we also try to evaluate the performance of this algorithm. Now, these are the goals of this discussion that is working of this SRTF, then evaluate all this performance of this algorithm and we also have a focus, the different parameters we can use to evaluate the performance of this SRTF. When SRTF is, I will say here, this is a preemptive type of the algorithm that schedules all the process for the execution there. I will also say that this is a preemptive version of a process or algorithm we can say which is called the shortage of first here, because shortage of first is algorithm that uses non preemptive type of the working mechanism. But in the case of SRTF, it is a preemptive type of scrolling mechanism, so that in this case, I can put any process at any instant in the given CPU by interrupting the CPUs ongoing process here. Secondly, this process also uses a mechanism that takes burst time into account here, that is I will select that process which is having small burst time for the execution. So, in this SRTF, initially the CPU will choose that process, in fact OS is going to choose that process which is having the smallest burst time available at that instant here. Now after that, that process is now executed for only one time instant here and again at every end of time instant here, I will again think of all the processes available in the ready queue and I will choose that process which is requiring the less burst time to execute it. So, when here in this mechanism, we take decision at the every end of a single time instant here. Suppose friend, you are finding two process, suppose if I take some decision now, suppose I just ended one time instance here of execution, now OS has to take decision here. Now I found that that two process in ready queue which possess the same burst time here. So, what we can do? So, in that case, we operate again that first come first serve criteria to choose the process for the execution means I will choose that process which is coming in the ready queue earlier and friend in this mechanism after every instance execution, I will decrement the burst count a burst time by one. So, we will operate all this mechanism until I finish all the processes execution there. Friend, rather wasting more time, let us describe all this functioning with the help of this small table there. So, the table again has got some process are waiting in the ready queue. The process name says P1 up to P6. The second column is marking the time of arrival of those process in ready queue and last column shows you the burst time. Burst nothing but the time quantum it requires to execute completely. Friend, here I am just showing one small chart here to describe the functioning here. So, friend initially from the given table, I found that the P1 is having the smallest burst time here because at 0 to interval I only got P1 is ready in the ready queue. So, I get no option to choose the P1 there. So, from 0 to 1 time slot here, so friend, here this is a time interval part of this table here. So, this is marking the first time instant here from 0 to 1, second, third like this here. So, as P1 is alone in ready queue at 0 time instant here, I had to choose that P1 for the execution here. I will execute this P1 only for one time instant here. So, in that case the process may finish execution or may not finish execution here. Currently P1 has got burst of 7 there. So, after execution of this one instant here or in one time interval I can say the burst remain at the 6 here. So, in this case I will execute P1 initially here and at the end of this first, now I will just take all the process ready in ready queue here. Friend, we know here at the end of one time instant here, you find that the process P1 is in the ready queue. I also find that one more new process is now in the ready queue which is called P2 there. Presently P1 has got burst of 6 and P2 has burst of 5 there. Now, CPU is going to choose the smaller burst time process here that is P2. So, in the 1, 2, 2 instant here I will execute the process P2 in the running queue here and I will decrement the burst time by again 1. So, friend this is a mechanism. Now again at the end of this I can say what the 2 time instant here means somewhere here. At this 2 I am getting 3 process are ready in ready queue that is P1, P2, P3 here. Now burst of P1 is 6, the burst of P2 is 4 and the burst of P3 is 3. So, again we have to make a choice between either 6, 4 or 3. Now from this values number 3 is smaller and so that between this 2 to 3 time instant here or interval I will choose the process P3 for execution there. So, friend just operate this kind of mechanism and just try to have some sort of idea. Again at this end of this I will say here that 2 to 3 interval here I will again not take process ready in the queue up to the 3 time instant here. So, at this time I find 0 is ready, P1 is ready, P2 is ready, P3 is ready and also we get P4 here. So, but I will choose now P4 because it is showing me the least burst count here. So, that is executed completely in a single time instant here. So, friend this P4 will not been contest onwards here. So, we operate the same mechanism now for all the further processes and friend we are going to again decrement the burst count after each interval execution here. So, friend this chart is showing me this kind of execution phenomena and all the yellow marked rectangles are showing you the end of that process here. So, P4 ends at this friend this P4 is ending at what I will say the fourth interval and this P3 also ends at some interval like this here. So, we have to choose all these things properly here and if I repeat this thing basically friend we are going to get this kind of execution sequence in the given chart here. So, when this is a good expression how we can treat each process at single interval and we can use the burst time as a mechanism by which we can send a process for execution in the running queue that is in the CPU. Friend this is a method which is called as a the shorted remaining time first method here. So, friend I will construct this Gantt chart here from that given last table here and you see that in this Gantt chart the process P1 is appearing at multiple times here. So, friend where to take this time of completion for this P1 execution here. So, I will take that location on the rightmost side here for the process P1 there. So, friend this chart says that P1 enters in a CPU at 0th here and that ends at the end of 19th time instant here. So, friend this is a Gantt chart for this one. So, you are going to take that NPA is legal which is on the right hand side of that process here. Now, again friend we got two parameters by which we can measure the performance one is called the turn around time that is a difference in CT that is a time of completion and time of arrival and second is the burst time that is a turn around time and the burst time difference here. Again from the given chart we can have this entries. So, you have to use Gantt chart. So, from the Gantt chart here as I said earlier P1 entered at 0 here but that completes execution at 19th here. So, friend you just see that even this P1 has got burst of only 7 it is finished at 19th time instant here because in between you are finding some smaller process are arriving in the ready queue. So, I can't keep them waiting for longer time period here. It means that the longer process require more time to execute here. This is a property of the shortest remaining time first algorithm. And if I suppose say I will take this average TAT. So, it comes as 7 millisecond or somebody can say also 7 time instance here and for the average waiting time it is coming as a 4 millisecond or the 4 time units I can say. Now, before I close friend here this is the biggest benefit I find here. In this case the smaller process will not wait longer here. They have to only wait for one time instant here. So, friend in this case we are going to overcome a very severe problem of this starvation here. So, it is finding a very good use in the practicals there. Friend these are my references of this PPT or this discussion and thank you for watching this video. I hope this video is helping you to understand the concept of this SRT of mechanism.