The skillful woman can cook for less rice (1)--android survival under small memory

Source: Internet
Author: User

Often hear around with Android friends complaining about mobile phone lag, memory is almost gone, and Google claims in 512M memory can also run Android 4.4 smoothly, what it did?

To summarize, it has done four main things:

1. Optimize the kernel and use Activitymanager to reduce direct memory recycling

2. Optimize the critical value of the LMK (Low memory Killer)

3. Enable KSM (Kernel samepage merging)

4. Enable Zram to replace swap partitions

These few things, individuals only third and fourth things look more plausible.


things to optimize the kernel:

From Google's official website in English, the translation of the meaning is probably: Modify the threshold, reduce direct memory recovery, because direct memory recovery will require additional IO operations, time-consuming, take advantage of idle times to increase background recycling .

It is well known that the eMMC read and write time, is very time-consuming, because the memory read and write speed is higher than eMMC read and write speed of a few order of magnitude, so reduce interaction with EMMC can save a lot of time, reduce the lag, but everyone's usage is different, how to modify the algorithm so that the reduction of direct memory recovery? I do not know, but I think this optimization is tantamount to talking nonsense, in the end how to use the later know.


About LMK:

Linux kernel, with Oom to reclaim memory, that is, when the memory is not enough, call an algorithm, those that do not, the priority level is lower, are released, so that the memory becomes larger, and Android, the oom mechanism to do an optimization, it is called LMK.

It is believed that if the memory is very low when the oom occurs, this time to release the memory, the system response time will become very long, resulting in a very poor user experience, so LMK made a change, timed check the free memory, when less than a certain cutting value, kill some of the process, free up some space, This ensures that there is always a large amount of free memory in the system, which can reduce the card. It makes sense that the following chapters will tell the LMK carefully.


Ksm:

This thing came out as early as 2009, but the reflection is relatively dull, because KSM merges the same page, that is, the merge replica memory, can save unnecessary memory, but in this way, it will increase the power consumption, will only open when the last resort.


What is Zram:

To be clear, Zram is an improvement of the swap, when the swap is usually taken out of the data to be stored on the external disk (mobile phone is EMMC, the computer is the hard disk), which will reduce efficiency, so smart developers get along a way, That's what's going to be replaced. Compression is also placed in memory, which consumes only the decompression time, which is much less than the time it takes to interact with the external disk. is a more reliable way, the following chapters will tell you more about the calling process and how to open it.


So Lmk,ksm and Zram is the author believes that the more reliable way, the following chapters, will tell them how to be enabled, as well as the specific call process and principles.

The skillful woman can cook for less rice (1)--android survival under small memory

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.