TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

True LRU: LRU is false

2 pointsby falsandtruover 1 year ago

1 comment

falsandtruover 1 year ago
LRU and Clock are significantly low performance due to their wrong algorithm based on false recency. True recency outperforms false recency.<p>There are three kinds of recency relationships between entries, used and used, used and unused, and unused and unused. However, LRU and Clock violate some recency. True LRU outperforms LRU and Clock by observing all recency.<p>The fundamental error is that new entries are considered most recently used. In fact, they have never been used in the cache. Therefore, new entries must to be added after the entries actually used.<p><pre><code> Sequence: 1, 2, 3, 3, 2, 4 LRU MRU |4 2 3 1| LRU Hit |0 1 1 0| ^ Violation of the recency between used and unused. Clock N-1 |4 3 2 1| 0 Hit |0 1 1 0| ^ Violation of the recency between used and used. True LRU MRU |2 3 4 1| LRU Hit |1 1 0 0| ^ ^ ^ Ideal recency.</code></pre>
评论 #39294061 未加载