Replacement Algo
Replacement Algo
1) Replacement Algorithms
3) LRU,LFU,FIFO,Random
Replacement Algorithms
Need of Replacement algorithms ?
.Cache memory is much faster than main memory, but it is also much smaller.
In order to take advantage of the speed of the cache memory, it is necessary to
store frequently accessed data in the cache.
• Cache memory has limited space, so when the cache becomes full, data that
is not frequently accessed must be removed to make space for new data. This is
where the replacement algorithm comes in.
• The replacement algorithm decides which data to remove from the cache
when new data needs to be stored. This decision is important because it can
have a significant impact on the performance of the microprocessor.
Advantages of Replacement Algorithm:
1.Minimizes cache misses: The primary goal of a replacement algorithm is to minimize the
number of cache misses. A good replacement algorithm should be able to predict which data is
most likely to be accessed in the future and keep that data in the cache memory to reduce the
number of cache misses.
2.Maximizes cache hits: A good replacement algorithm should also be able to maximize the
number of cache hits. This means that the algorithm should be able to identify which data is
frequently accessed and keep that data in the cache memory as much as possible.
3.Fast and efficient: The replacement algorithm should be fast and efficient so that it doesn't
slow down the microprocessor. This is particularly important for microprocessors that need to
process data in real-time or in time-sensitive applications.
4.Adaptive: The replacement algorithm should be able to adapt to changes in the data being
processed. For example, if the data being processed changes frequently, the algorithm should
be able to adjust its predictions and keep the most relevant data in the cache memory.
WHY CACHE MEMORY IS USED
Basics of Replacement Algorithms
1.LRU
2.LFU
3.FIFO
4.RANDOM
Details of Replacement Algorithms
1.Least Recently Used (LRU): This algorithm keeps track of the usage
history of each item and removes the least recently used item when space
is needed.
~SYRLE14
~SYRLE15
~SYRLE16