lru algorithm

22
LRU Algorithm Least Recently Used

Upload: aquarius

Post on 17-Jan-2016

30 views

Category:

Documents


0 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: LRU Algorithm

LRU AlgorithmLeast Recently Used

Page 2: LRU Algorithm

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.

Page 3: LRU Algorithm

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.

Page 4: LRU Algorithm

There are more instances

that troubles occur which we

are supposed to solve in order

to regulate or stabilize

operations.

Ellen
Page 5: LRU Algorithm

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.

Ellen
Page 6: LRU Algorithm

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.

Page 7: LRU Algorithm

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.

Page 8: LRU Algorithm

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.

Page 9: LRU Algorithm

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.

Page 10: LRU Algorithm

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.

Page 11: LRU Algorithm

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.

Page 12: LRU Algorithm

To know what is easier to use

between LFU,LRU or FIFO.

To prove that LRU is effective in

lessening error and data traffic.

Objectives(cont)

Page 13: LRU Algorithm

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.

Page 14: LRU Algorithm

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.

Ellen
Page 15: LRU Algorithm

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.

Process

Page 16: LRU Algorithm

a) Divide the main memory

block by the number of sets.

The remainder determines

which set it would belongs.

Page 17: LRU Algorithm

b) Every time a block is stored,

the time increases. But if

there is a cache hit, the counter

will be incremented.

Page 18: LRU Algorithm

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.

Page 19: LRU Algorithm

MM Blocks: 1,2,3,4,1,5,5,7,6,4

Example:

Ellen
Page 20: LRU Algorithm

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.

Conclusion

Page 21: LRU Algorithm

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.

Page 22: LRU Algorithm

THANK YOU !Prepared by :

Balatico, Rey Steve P.Bibit, Mae RoseArce, Crissel Lyka Q.Coloma, Madeline C.Lacar, Larissa Vivien S.Manglal-lan, Rizaldy Jr.Salacup, KathleenSoriano, Ethelyn Joyce

BSCS II-A