Convoy Effect in Operating System

One disadvantage of FCFS is there is if there is something called a convoy effect. When a process is having a heavy burst time then all the processes which are after it are going to start that is also called a starvation or convoy effect now let’s see how it is possible here I’ll take you to know two cases to I to just study them to study the effect it will give you a clear understanding.
I have three process and the arrival times are 0 1 1 and then 22 and one are the burst times right so let me show you them first now I am assuming that I am going to start the show dueling at time 0 which one is the first one that air that arrived the first one that arrived is p1 at time 0 therefore I have to schedule p1 and what is the time for this the burst time is 20 so it takes 20 units of time to finish T 1 P 1.

if I start from 0 right and after that what is the Ticats should you I could schedule c p2 and p3 are having same arrival times and I told you that the one with the lower process ID is going to get the highest presidence right but then there is no relation between a convoy effect and then process arriving at the same time here it so happened that the process are arriving at same same time but it doesn’t have anything to do with the convoy effect on work is independent of that right now so see we see that p2 and p3 are arriving at the same time therefore which one is the which one should you shed your first and the p2 right.

so I am going to show you in p2 first fine and what is the what is the first time the burster for p2 is 2 units therefore the total time is 22 got it and then P 3 P 3 will be scheduled and what is the burst effort P 3 it is 1 it therefore it is 23 so one thing you should observe is the total schedule if it is going to start at zero by the time ma they should duel ends this is the should you begin start time and this is the should you’ll end time right so they by the time this total schedule you can add all this and that should be equal to that in case if it is starting with zero in case if there are no gaps in case if there are gaps in the middle it does not hold anyway in this case the schedule is taking a total time of 23 and even the burst time sum is 23.

it happened inside it happened here because there are no gaps here which means CP you need not wait for any process because all the process are ever available by the end of one process next one is available by the end of second one next one is available all the time now let’s write everything one is what is completion time so completion time for p1 is 20 P 2 is 22 P 3 is 23 all right then what is turnaround time so I told you that turnaround time is completion time – arrival time how much is it 20 here 21 here and 22 here right the time just subtracting this one from this one ambition die – arrival time and after finding out this turnaround time you could find out the waiting time what is waiting time waiting time is turnaround time – birth time from this one you have to remove this so which means 0 here and then 19 here and then 21 here right this is the waiting time so how does this go for my effect is here is if you find out the average waiting time of every process average waiting time you take all the waiting terms.

then you can divide it with the number of process which is 0 plus 19 plus 21 by 3 this is the average waiting time now it is nothing but 40 divided by 3 this is the average waiting time for this example for the schedule now let’s do the same mark same processes in a different order if the arrival times are different in such a way that see this here what happened is the one with the largest birth time added first that is the p1 you’ll first now if the same three process or arriving in such a way that the one with the largest burst time has arrived lost which means all the remaining process ever heard early and this one arrived late no now in this one what happens is I’m just drawing the schedule here so what is the first one that has to make the you Ted the process with arrival time zero so we have two choices P 2 and P 3 which one should I choose obviously P 2 because the one with the lesser process ID is going to take the higher precedence right now if it starts at 0 birth time is going to be 2 isn’t it then what is the next one I have only one choice P 3 what is the eggs boss time 1 therefore is going to be 3 and I should this by P 2 and P 3 is both are having the least arrival time and out of them P 2 is having the least process ID that is the P 2 first and and P 3 next and obviously the last one is P 1 its arrival time is one that is very the last one right.


Leave a Comment