370 likes | 891 Views
LRU Algorithm. Least Recently Used. Introduction. The fact that the world is doomed with computer, people’s daily living and how the world works nowadays become more modernized. Yet, this is the external reality in this computer era.
E N D
LRU Algorithm Least Recently Used
Introduction The fact that the world is doomed with computer, people’s daily living and how the world works nowadays become more modernized. Yet, this is the external reality in this computer era.
We must go deeper by fully understanding the real thing behind the direct usage of computers. The computer world is synthesized, by means of operations done inside for it to function.
There are more instances that troubles occur which we are supposed to solve in order to regulate or stabilize operations.
In order to that, there’s what we call mapping functions which we used to avoid conflict of data processed which involve different replacement algorithms.
One is Least Recently Used (LRU). It used to replace a block that has been in the cache longest with no reference to it. This will be useful to lessen the errors and cache miss.
We are assigned to make a program which executes Least Recently Used (LRU) Algorithm. It used to replace a block that has been in the cache longest with no reference to it. This will be useful to lessen the errors and data traffic.
Statement of the Problem The cache stores some of the data that are transferred from the main memory in order not to search again for it when the same data was again needed.
But there’s this THRASHING where a data that was just removed in the cache is again needed. So, we make use of different replacement algorithms to lessen the error.
LFU considers a counter. FIFO considers time. While LRU considers both time and counter. With these different algorithms, it is hard to know which is the most effective to lessen the errors.
Objectives • To illustrate how Least Recently Used (LRU) Algorithm work. • To understand the logical operations done behind the level of the computer user. • To know and understand the significance of using LRU.
Objectives(cont) • To know what is easier to use between LFU,LRU or FIFO. • To prove that LRU is effective in lessening error and data traffic.
Significance of the Study Knowing and understanding LRU allows us to use the algorithm properly in order for us to achieve the objectives and solve the statement of the problem.
We will be able to differentiate the said algorithm with the other types and for us to identify its strength and weakness in order to select the appropriate algorithm to be used.
Process Least Recently Used (LRU) Algorithm • When a new block is stored in the cache, LRU replaces the block that has not been used for the longest period of time.
Divide the main memory block by the number of sets. The remainder determines which set it would belongs.
b) Every time a block is stored, the time increases. But if there is a cache hit, the counter will be incremented.
c) It would compare the counter of the other blocks in that set and replaces the one with the least counter. d) But if there are two blocks with the same counter, it will then consider the time and replaces the one with the longest time.
Example: MM Blocks: 1,2,3,4,1,5,5,7,6,4
Conclusion Compared to LFU and FIFO, LRU is harder to implement because it considers both time and counter. On the other hand, it is more effective than the other two because there is less thrashing during the process.
Understanding and applying the concepts of LRU Algorithm is very useful and contributed a lot for us to come up a program which executes the said algorithm.
THANK YOU ! Prepared by : Balatico, Rey Steve P. Bibit, Mae Rose Arce, Crissel Lyka Q. Coloma, Madeline C. Lacar, Larissa Vivien S. Manglal-lan, Rizaldy Jr. Salacup, Kathleen Soriano, Ethelyn Joyce BSCS II-A