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 the phone lag, memory is almost gone. Google claims to be able to perform Android 4.4 smoothly in 512M of memory. What on earth did it do?

To summarize, it has done four main things:

1. Optimize kernel, use Activitymanager to reduce direct memory recycle

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

3. Enable KSM (Kernel samepage merging)

4. Enable Zram to replace swap partitions

In these few things, individuals only have third and fourth things that look more plausible.


things to optimize the kernel:

From Google's official site in English, the translation of the meaning is probably: change the threshold, reduce the direct memory recovery. Because direct memory reclamation requires additional IO operations, it takes a lot of time. Use spare time to add background recycling .

As we all know, it is very time-consuming to read and write to eMMC, because memory reads and writes faster than EMMC read and write speed, so reducing interaction with EMMC can save a lot of time. Reduce the lag, but each person's usage habits are different. How to change the algorithm to reduce the direct memory recovery? I don't know, but I think this optimization is tantamount to talking nonsense. How exactly, after use to know.


About LMK:

The Linux kernel. Use Oom to reclaim memory, that is, when memory is not enough. Call an algorithm that takes a lower priority than those that are not used. Are released, freeing up a portion of the memory so that the memory becomes larger, and Android, which optimizes the oom mechanism. It's called LMK.

It felt. Assuming that when the oom occurs, memory is already very low, this time to release memory, the system response time will become very long, resulting in a poor user experience, so LMK made a change. Check spare memory regularly. When there is less than a certain cut, kill some processes. Free up some space. This ensures that there is always a large spare memory in the system. can reduce the lag. It makes sense that the following chapters will tell the LMK in detail.


Ksm:

This thing came out as early as 2009. But the response is more prosaic, because KSM merges the same page. That is, merge replica memory. Can save unnecessary memory. However, by using this method, the power consumption will be added and will only be opened when forced.


What is Zram:

To be clear, Zram is an improvement in swap. In general, when the swap is to replace the data to the external disk (mobile phone is EMMC, the computer is the hard disk), which will reduce the efficiency, so smart developers get along with a method, that is to replace the things to be compressed and put in memory, so that consumes only the decompression time, This time is much less than the time spent interacting with external disks.

is a more reliable way, in the following chapters, it will be specific to the invocation process and how to open it.


So Lmk,ksm and Zram is the author feel more reliable way, the following several chapters. will tell them how they are to be enabled, respectively. As well as detailed invocation procedures and principles.

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

Related Article

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.