Android Multi-task mechanism science-no obsessive-compulsive disorder, no need to clear memory

Source: Internet
Author: User
Keywords No need run popular science
Tags android application applications class clear computer cpu help
class= "Post_content" itemprop= "Articlebody" >

Think of that year, the habit of clearing memory. When Android was not born, when we used Windows, we had to turn off all the unused processes so that we wouldn't "take up memory" or "CPU", and the computer wouldn't "card". (Most of the "Security software" is to help users in the Windows of the memory, clean garbage and famous) This is the historical reason for the memory ...

Android, however, is a completely different memory management mechanism than Windows.

background:

Android's Linux based kernel inherits and improves the Linux memory management mechanism.

Android's memory management mechanism:

How much memory is used, and the free memory is all cached. That is, when a process stops moving, Windows clears it out of memory, but Android keeps the process in memory so that it will be very fast the next time it starts, because it eliminates the time it takes to read from the storage device again, and only if there is not enough memory to start a new process, Android To clear some processes that reside in memory to stop the activity.

Each process is independent of the Java virtual machine and does not interfere with each other. Make sure that Android is stable, and that even if a single process crashes, the entire system will not crash and there will never be an out-of-memory hint.

That explains why Android's remaining memory is always very small. "But the process runs in the background and consumes the traffic." "This continues to explain ...

Android's multitasking mechanism:

When a process is switched to the background, the system pauses the process. Does not consume CPU resources, retains only the running state in memory, and sets the priority according to the application itself.

Seven priority:

Foreground process. As the name suggests, your current screen is showing the process.

Visible processes. Standby processes are required at any time, such as input methods that need to be summoned at any time.

Main service. Systems must be serviced, such as telephones.

Secondary services. A service that is closely related to the system, such as a mail push service for Gmail.

Background process. Also as the name suggests, is just you switch to the background of the process.

Content Supply node. No application entities, only provide content for other applications to use, such as Calendar supply node, mail supply node.

Empty process. There is nothing in the running process, and some applications will still host an empty process in the process after exiting, which is to improve the application's next boot speed or record some historical information.

Conclusion

In summary, a normal user application either becomes a background process after exiting or becomes an empty process. These processes have been paused to run without consuming CPU resources and power. When the user needs to open another application when there is not enough memory, it automatically clears, so there is no need to clean the memory at all. Instead, sometimes the system needs to use a lot of power and CPU to restart the necessary processes after the memory is cleaned.

But why do some applications still consume electricity and traffic after they are turned off? The only answer is that this is a restless application. Application authors apply a wide variety of primary and secondary services for applications when they write applications, causing the user to continue running after exiting. (So in the background, the most solid is the "XX battery Doctor" and "XX cell phone Assistant" in your Drop-down notification column.) This phenomenon is particularly common in some domestic applications. In the face of these messy and heartless application and application of the author, decisively unload it and rushed into the gutter inside go to it, a bad comment!

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.