Android takes a different process management strategy from Linux, and unlike Linux, which ends the process after the process activity has stopped, Android keeps the processes in memory until the system needs more memory. These processes, which are kept in memory, typically do not affect the speed of the overall system, and increase the startup speed of the process when the user activates the processes again.
When does Android end the process? Which process does it end? The common understanding was that Android was based on a list of the most recently used programs called LRU (last recently used), sorted the program, and ended the oldest process. But there's actually more detail in it.
1. The importance of the process is evaluated and the importance is expressed in terms of the value "Oom_adj", which is given to each process (the system will determine which processes need to end according to "Oom_adj"), in general, the greater the value of "Oom_adj", The process is selected by the system to terminate the higher possible)
2. The "Oom_adj" value of the foreground program is 0, which means it will not be terminated by the system, once it is inaccessible, a higher "Oom_adj" is obtained, and the value of "Oom_adj" is determined by the location of the software in the LRU list;
3.Android is different from Linux, has its own unique process Management module, this module is more customizable, can be based on the "Oom_adj" value of the scope to determine the process management policy, such as can be set "when memory is less than X, the end of" Oom_adj "greater than Y process". This gives the process management script the option to write more.
Android divides the process into six major categories:1. Foreground process (foreground): The process currently being displayed on the screen and some system processes. For example, a system process such as Dialer Storage,google Search is the foreground process, and for example, when you run a program, such as a browser, when the browser interface is displayed in the foreground, the browser belongs to the foreground process (foreground). But once you press home to return to the main screen, the browser becomes a daemon (background). The last process we want to terminate is the foreground process.
2. Visible process (visible): visible process is some no longer the foreground, but the user is still visible process, for example: Widgets, Input method, etc., are visible. Although this part of the process is not in the foreground, but also closely related to our use, we do not want them to be terminated (you certainly do not want the clock, weather, news and other widgets are terminated, then they will not sync, you do not want the input method is terminated, or you need to restart input input every time)
3. Secondary services (secondary server): Some of the services currently running (major services, such as dialing, are not likely to be terminated by process management, so this is only a minor service), for example: Google Enterprise Suite, gmail internal storage, contact internal storage and so on. Although this part of the service is a secondary service, but some of the system functions are still closely related, we often need to use them, so we also hope they are terminated
4. Background process: We usually understand the process of switching to the background after startup, such as a browser, a reader, and so on. When the program is displayed on the screen, the process that he runs is the foreground process (foreground), and once we press home to return to the main interface (note that by pressing home, not pressing back), the program resides in the background and becomes the background process (background). Background process Management policy has a variety of: in a more positive way, once the program arrives in the background immediately terminate, this way will increase the speed of the program, but can not speed up the program to start again, there are more negative ways, as much as possible to retain the background program, although it may affect the speed of a single program, However, the speed is increased when you start a program that has started again. This will require users to find a balance based on their own usage habits.
5. Content provider: There is no program entity, the provision of content for other programs to use, such as calendar providers, mail providers and so on. This type of procedure should have a higher priority when the process is terminated
6. Null process (empty): There is nothing in the process of running, some programs, such as BTE, after the program exits, will still reside in the process of an empty process, the process is not any data running, the role is often to improve the program's next boot speed or record some of the history of the program information. This part of the process is undoubtedly the first to be terminated.
Welcome to scan QR Code, follow the public number
Android process Classification and management