Special Days (May 1, 2015 Labor Day) commemorate the return and the new journey, using the LRU and LFU two small algorithm principles and differences to stimulate

Source: Internet
Author: User

A long time did not write a new blog, the reasons for a lot of good-sounding reason is work busy, busy life, all kinds of tired, straightforward point is actually become lazy, so did not write.

In the quiet for such a long period of time, finally again to start again, for their current state, feel the first to have a precipitate, then is to empty themselves, only to empty their side can continue to progress.


Later a period of time updated blog content body is related to the Android framework of the problem analysis, mechanism implementation principle, source code call analysis, and then accompanied by some common small algorithms, language characteristics, program principles.

Today, we first introduce LRU and LFU, both in the Android framework and the application of the most commonly used cache algorithm idea principle, in fact, the principle of these caching algorithms and Linux virtual memory page replacement algorithm idea is consistent, but the specific difference.

lfu (least frequently used ) : using the least frequency algorithm, Ideas and principles are If a data is rarely used in the most recent period of time, the likelihood of being used in the future is also very small, and The purpose of this algorithm is straightforward to understand that when the cached content needs to be updated and is already full, Quickly find and replace content that is used as often as the lowest number of times in the current entire cache.

LRU (least  recently used): Most recent unused algorithm, The idea and principle is If a data is in the last is not accessed, the likelihood of its being accessed in the future is also very small, and the purpose of is straightforward to understand that when the cache content needs to be updated and is already full, quickly find and replace content that is not used until the longest time in the current entire cache.


Reference Links:

Http://www.cnblogs.com/dolphin0520/p/3749259.html

Http://www.cnblogs.com/dolphin0520/p/3741519.html

Http://blog.sina.com.cn/s/blog_631d3a630101mhup.html

http://qyappchentao.sinaapp.com/linux-mem-al/

Http://blog.sina.com.cn/s/blog_50197c290101ft7a.html

http://blog.csdn.net/summerhust/article/details/6867171



Special Days (May 1, 2015 Labor Day) commemorate the return and the new journey, using the LRU and LFU two small algorithm principles and differences to stimulate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.