 Hello friends, myself Rohit Kumar R. Vaktharikar working as an assistant professor in computer science and engineering department at Walsh Institute of Technology, Solapur. Learning outcomes. At the end of the session students will be able to solve the least recently used page replacement algorithm. Already we have seen this page replacement algorithm introduction in our previous videos. So today in this video we are going to solve this problem statement. So now let's see here we will have the page references or string 130353 with the three page frames. So let's find out the number of page faults and we will also find out the number of page hits for this problem statement. So basically this type of problem statements are also going to be asked in the gate examinations. So it's a very important thing to understand this. So let's start for the solving the problem statement. So let's see here in this example we will have some pages. So now here we need to find out the number of page faults. So considered page frame size is, so our frame size is equals to 3. So now if you consider this frame size is equal to 3. So now here we need to get the trip frame size. We have already seen also what is mean by page frame and page pages and all. So now here let's say we will have this three allocated space for the frame. So now what we are going to do we are going to perform the list recently used. So initially this frame is a empty. So this is our frame and this is empty one and the size is 3. So we need to perform the page replacement. What we are going to do we are going to place all these pages into our frame. So let's start. So now what is the objective of this problem statement? We need to find number of page faults and number of page it. So now what is mean by page hit and page fault? We have already discussed in our previous videos. So now let's start. So initially here the frame is empty. So already we have all this discussed. If the frame size is 3 and the frame is empty then the first three pages are going to be page fault because currently we do not have that pages in our friends. Let's say now we will take this frame sorry page one. So now let's say while CPU accessing this page one so it is going to first check into the frame. So whether this one is available in our frame no. So here we got our first page fault. Page fault means if that particular page is not available in our page frame. So at that time we can call it as a page fault. So now what we will do we will insert one here page number one. So after that we are going for the page number three. So now here we will check whether the page number three is available in our frame no we do not have the page number three. So now again page fault has occurs. So now again here what happens? It's a three we have inserted now after that we are going to check for the next page that is zero. So now whether the zero is available no we do not have the zero in our frame. So again what page fault has occurs and now here it becomes again zero fine. So now we got our this frame now after that what we need to do we need to check that page three is available in our page frame in our frame yes three is available means what here we got our first page hit fine. So now after that what we are going to do we need to check the five number whether that page number five is available in our frame so now one it is going to be competitive one then three and then zero means what we do not have this page five in our frame. So now here page fault has occurs again. So now we need to perform the replacement here now this is the point where we need to perform the page replacement. So on which basis we are going to perform the page replacement. So now here we are going to see the least recently used page. So now here the least recently used page how we are going to calculate. So now here we need to traverse in a reverse order right and we will check. So now recently three is used right zero has been used and again three we have used and then at the last one is used means what according to our example according to our algorithm we need to replace one from our frame. So let us draw one frame here fine. So let us see let us consider we will have this frame fine. So now what we are going to do we are going to perform the replacement. So now we are going to replace this one why because this is the least recently used page fine. So now what we will do then page is what five is our page is replaced by one has been replaced by five and then here we are getting the three and then zero fine in this way we got our frames. So what we will do we will copy this frame because we need to use it again. So simply what we will do we will create some frames so that it becomes easy to use us fine. So now here what we have done we have replaced one by five and then we will keep three as it is and then zero as it is fine. So now what next so now the five is in our frame so next we are going to check for the six so now whether the six is currently available in this frame no six is not there. So again page fault occurs right. So now here we need to perform the page replacement. So again we need to apply the same logic so which one we are going to replace then. So now here five is recently used then three is recently used and before that zero has been used. So this what we need to replace the page zero from our frame. So now what we will get then we will update and lose five then three and now here we are going to replace the zero by six fine. So after that once again what we need to do we need to check for the next page right. So our next page is what one. So whether this one is available or from no so again this is page fault right. So now here we need to perform the page replacement. So again which page we are going to replace here. So now five has been recently used six has also used. So now the three that is the least recently used. So now here we need to replace this three from our frame. So now the content of our frames are here five and then we are going to replace this with one and then the six okay fine. Now let's go for the next. Now again here we need to check the five the next page is five. So whether the five is available in our frame yes so now it's a page hit fine. So there is no need to perform any page replacement. So now next we will go for the zero now we will check here. So now whether zero is available in our frame so no we do not have the zero in our frame. So now again page fault occurs right. So now what we will do then we need to replace. So which one we are going to replace then now here five is recently used one is recently used right. So now we need to replace this six right. So here we are going to replace the six with the zero fine. So now the frame values becomes five then one and then we got the zero right. So now next I will create one more frame here and now we have the six. So now the next one is six. So what we need to do we need to check whether six is available in our frame no we do not have the six then again here page fault occurs right. So now again we need to perform the replacement of the page. So which one we are going to do then we need to check zero recently used then five is recently used before that one we are used. If we will then we need to replace this one right. So we are going to replace this one by six. So the our content becomes five then six and then zero. So in this way we are going to calculate the number of page faults and page hits. So currently here if you look into the our pages into this frame if you will see this frame the six is available right and after that we are going to replace that six with the zero and next we are going to use the six means what recently the next page is zero. So still we are going to perform the replacement maybe that becomes the use. So this is the one problem so how to solve that one. So that will be going to be covered in an optimal page replacement strategy we see that in our next lecture. So now here let us calculate the total number of page faults and page hit. So now here page faults is equals to so now page faults is equals to what? So here cross marks are nothing but the page faults one two three four five six seven eight. So now here we will total have the eight page faults right. So after that we need to calculate the page hits fine. So page hits are one and two are the total page hits fine. So in this way we are going to calculate the total number of page faults and page hits in our list recently used algorithm. So now think and write is list recently used page replacement algorithm is better than FIFO tell me the answer yes because it gets the less number of page faults. We got these references from the operating system concept from the Galvin. Thank you.