 R. Vakdharikar, working as an assistant professor in computer science and engineering department at Walthamstow Technology, Solapur. Today, we are going to see the first in first out page replacement algorithm. Learning outcomes. At the end of this session, students will be able to solve the first in first out problems from the page replacement algorithm. So, now directly we will jump to the problem statement. Already we have discussed how this particular algorithm is going to be work in our previous video. Fine. So, let us start for the solving this example. Now, here in this page, these are nothing but our pages, fine. These are the pages and we need to calculate the page faults, okay. And now, we need to take the input from the user, that is nothing but the page frame size, sorry, frame size and now here we will have the frame size is equals to 3, fine. So, now here let us say to solve this example, basically this type of questions are going to be used in a gate. So, these are the very important algorithms and we need to calculate these also, right. So, here we need to calculate the page faults. So, how we are going to do that one, fine. So, let us say we will have this one frame, fine. So, already we have seen what is mean by frame and how it is going to be used, right. So, now this is our frame and in this frame the frame size is 3. So, we are going to place it as a, keep it as a 3, fine. So, what we will do? I will just copy and paste, I will create some frames for the further solutions, fine. So, here we got some frames, fine. So, now initially my frame size is 3. So, here we have given the size is 3. So, let us say. First upon initially all these frames are empty, right. So, these frames are empty frames. So, if the frame size is empty, if the frame is empty, sorry, if the frame is empty. So, the size of the frame, that number of page faults are going to be happen at the initial moment, means what? Initially here our page frame size is 3. So, and initially this frame is empty, means what? In this frame we do not have any pages. So, there is no page, heat is going to be happen, right. So, let us see here. Now, this is nothing but our page heat again, we are going to calculate that one, fine. So, let us start for the inserting these pages. So, first upon we go for the first page. Now, it will check, the first page it will be check, is there the page number one is available in our frame, okay. Now, means what? If frame is not available, sorry, if that page is not available into the frame at that time, we will call it as a page fault, right. Here we got our first page fault, fine. Then we are going to insert this page number three, right. So, now here this is the page number three. Again before inserting into the frames, we are going to check the availability of that page into the frame. Obviously, initial moment the frame is empty, so here we do not have the page number three into the frame, fine. So now here we got the page fault again, right. So now here we got this page fault again, fine. After that we are going to insert the page number zero. Now before inserting we are going to check the availability of this page. So now see here, we do not have any page, right. So we need to add that page into the frame and again here we need to mark it as a page fault, right. So now the next one is three. So now before inserting into the frame we need to check that page number three is available in our frame. So now here it is going to be compared one, three and zero, yes we got the three here, right. So now here the page hit is happens, right. We will tick mark as a page hit and cross mark for the page fault, fine. So now next, next we are going to check the file. So now here we are going to check whether that file is available into our frames. No, we do not have any file page number. So now here again it is a page fault happens, right. So now the questions comes here. So the frame size is three and we need to remove one page from our frame. So which one is going to be removed in, right. So this is our first in first out, right. First in first out page replacement, right. So now what we need to check here, we need to check the first page which has entered into the frame. Now we need to check this list from the starting, right. Now we are going to check from this side, from left to right we are moving, right. So now here we need to check the first, that is page number one, we have inserted the page number one at the first, right. So we need to remove that one. So we need to replace that one by five, right. So here we will add five and remove the one and the next we will keep it as it is that is three and zero into our frames, right. So now next again, next page we got the page number six. So now here again we need to check here whether that page number six is available. No, we do not have any page number six into our frame. So again this is nothing but the page fault, right. So again the question comes here, which page we should remove from this one, right. So which one we are going to remove then. So now already one we have removed, right. So now three and zero are there, five, three and zero. So now out of these three pages which one the first has come into the list. So now again we are going to check from the left to right. So now one is not there, now three, three is there, right. Then after three we are getting zero and after zero we are getting the five, means the first time we got the three page number, third page number, right. So here we need to replace that page number three. So now here our page, our frame becomes five, then six and then zero, right. So now again we need to check here. So next page, we will take the next page that is seven. So now we are going to check the seven is available, no seven is not available, means what again page fault has occurred, right. So now what we need to do then, we need to again perform the same operation, we need to apply the same logic here, we need to remove the page that is the first page that is inserted into the frame. So now five, six and zero are there. So now we are going to check, one is not there, three is not there, zero, yes zero is there, right. So zero has came before the five and six. So here we need to remove the zero from our list, right. So now what we will do then, we will keep it as five as it is, then six and then we need to add seven, right. So now here page fault has been occurs, right. So next again we need to check here, one. So now that one is not into our frame, so again here page fault has been occurs, right. Again we need to perform the replacement of the page. So which page we need to replace then, right. So we need to check from this here. So don't get confused that we have already inserted into the frame that is the first, no we have inserted and we have removed that one, right. Now currently in our frame we will have the five, six, seven page numbers. So now we need to check here. So out of these page numbers five, six and seven, which one has come earlier that is nothing but the five, right. So now here we need to remove that five and from the frame and we need to replace it with the one. Then we got six and then we got seven, fine. So we need one more frame here and I think so we need one more frame there, sorry. So now again if you look it here, we got one more page fault, right. So now here which one is going to replace then, obviously we need to replace the six, right. So now here it becomes one, six we need to remove, right. So it's three and then now it's a seven. So now next we need to check that is zero. Zero is not there. So again page fault happens, right. So again we need to remove, right. So which one we need to remove that is seven, right. So now what we will get one, three and zero. So in this way we need to perform the page replacement, right by using first and first out. So now here we need to check out the total number of page fault and page hits, right. So out of these pages one, two, three, four, five, six, seven, eight, nine, ten, ten pages we are getting the only single page hit, right. So here we got the single page hit, fine. So now what are the page faults then? We got the total nine page faults, right. So these type of questions are very important because in the gate they are going to ask these these type of questions. So find out the total number of page hit and page faults for the given page numbers, okay. So in this way we need to solve, fine. So let's move ahead. So what if the number of page frames are increased, think and write the answer. Now currently we will have the frame size three. So what if the frame size becomes five with the same page numbers? Think and write. Better way solve this example, then you will get the answer. So it is possible to have more number of page faults, right. How? Because when page frame is going to be large, frame size is large. So at that time number of page faults are going to happen, right. You need to solve that example for that one, okay. Now Belladdy anomaly. So Belladdy anomaly what says, the Belladdy anomaly proves that it is possible to have the more number of page faults when increasing the number of page frames while using the first and first page replacement. Already the answer is given, right. Belladdy's anomaly has already proved that if the frame size is greater, it's a large frame size, then at that time page faults are increased. We got the references from the operating system concepts by Galvin. Thank you.