Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pseudo Least Recently Used Binary Tree

The logic behind Pseudo LRU is to use less bits and to speed up the replacement of the block. The logic is given as "let 1 represent that the left side has been referenced more recently than the right side, and 0 vice-versa" But I am unable to understand the implementation given in the following diagram:

Pseudo LRU Binary Tree

Details are given at : http://courses.cse.tamu.edu/ejkim/614/CSCE614-2011c-HW4-tutorial.pptx

like image 251
shingaridavesh Avatar asked Jun 25 '14 12:06

shingaridavesh


People also ask

How does pseudo LRU work?

Pseudo-LRU or PLRU is a family of cache algorithms which improve on the performance of the Least Recently Used (LRU) algorithm by replacing values using approximate measures of age rather than maintaining the exact age of every value in the cache.

How many bits is LRU?

We need one bit per set to identify which of these blocks is the LRU block. Note that if block 0 is the LRU block, then block 1 is the MRU (most recently used) block, and vice versa.

What is LRU and Lfu cache?

LRU is a cache eviction algorithm called least recently used cache. Look at this resource. LFU is a cache eviction algorithm called least frequently used cache. It requires three data structures. One is a hash table that is used to cache the key/values so that given a key we can retrieve the cache entry at O(1).

Is LRU better than random?

LRU and 2-random are pretty close, with LRU edging out 2-random for the smaller caches and 2-random edging out LRU for the larger caches. As we might expect, LRU does worse than 2-random when the miss rates are high, and better when the miss rates are low.


1 Answers

I'm also studying about Pseudo-LRU. Here is my understand. Hope it's helpful.

  • "Hit CL1": there's a referent to CL1, and hit LRU state (B0 and B1) are changed to inform CL1 is recently referred.

  • "Hit CL0": there's a referent to CL0, and hit LRU state (B1) is updated to inform that CL0 is recently used (than CL1)

  • "Miss; CL2 replace" There's a miss, and LRU is requested for replacement index. As current state, CL2 is chose. LRU state (B0 and B2) are updated to inform CL2 is recently used. (it's also cause next replacement will be CL1)

like image 79
Duc Tran Avatar answered Oct 29 '22 00:10

Duc Tran