WO2019036906A1 - Android system-based low memory killer system and method - Google Patents

Android system-based low memory killer system and method Download PDF

Info

Publication number
WO2019036906A1
WO2019036906A1 PCT/CN2017/098520 CN2017098520W WO2019036906A1 WO 2019036906 A1 WO2019036906 A1 WO 2019036906A1 CN 2017098520 W CN2017098520 W CN 2017098520W WO 2019036906 A1 WO2019036906 A1 WO 2019036906A1
Authority
WO
WIPO (PCT)
Prior art keywords
processes
memory
priority
package name
low
Prior art date
Application number
PCT/CN2017/098520
Other languages
French (fr)
Chinese (zh)
Inventor
邓强
Original Assignee
深圳传音通讯有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳传音通讯有限公司 filed Critical 深圳传音通讯有限公司
Priority to PCT/CN2017/098520 priority Critical patent/WO2019036906A1/en
Publication of WO2019036906A1 publication Critical patent/WO2019036906A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the invention relates to a system memory management mechanism of an intelligent mobile terminal, in particular to a low memory killing system and method based on an Android system.
  • the Android (Android) system currently used in smart mobile terminals such as mobile phones is an open source operating system based on Linux system development.
  • the memory management of Linux system has its unique dynamic storage management mechanism, but the Android system is further optimized based on the memory management mechanism of Linux.
  • the Linux system will end the process after the process activity has stopped, and the Android system will keep these processes in memory.
  • the Android system is a multi-tasking system, which means that multiple processes can be run simultaneously. In general, it takes a certain amount of time to start a process, so in order to speed up the process, whenever the user exits a process, the Android system does not immediately stop the process completely (commonly known as killing the process). So that when the user chooses to run the process next time, they can start quickly. However, as more and more processes are reserved in the Android system, the memory will definitely be insufficient. At this time, the Android system will start the automatic killing process of the process, which is the most used and the least important to use.
  • Low Memory Low Memory Killer
  • the Android system has a total of six types of processes, and the possibility of being detected and stopped by the low memory killing mechanism is arranged from low to high, in order: foreground process, visible process, secondary process, background process, content provider And an empty process. That is to say, when the memory of the Android system is insufficient, the first process to be killed is an empty process (if it exists). If the empty process is still unable to guarantee enough memory space to maintain normal system operation after being killed, the second one will be the content provider. And so on, the next third will be the background process.
  • the front-end process, the visible process, and the secondary process are three types of processes in system memory management. In the process, the possibility of being killed by the low memory killing mechanism is very small, because once these processes are killed, it will result in a very poor user experience.
  • the Android system has a rule to reclaim the memory space. It has a predetermined threshold for the scheduling of the memory space. Only when the memory space of the system is lower than the threshold, the Android system will start the low memory killing mechanism.
  • the default rule order is to stop running the system that is considered to be the least important process, thus freeing up memory space.
  • the directory file of the smart mobile terminal using the Android system that is, the directory file of Sys/Module/Lowmemorykiller/Parameters/Minfree, and the corresponding threshold is recorded therein.
  • the running memory of the Android system is less than 211Mb
  • the low memory killing mechanism needs to kill the empty process
  • the running memory of the Android system is less than 176Mb
  • the low memory killing mechanism not only needs to kill the empty process, but also needs to be combined. Kill the content provider.
  • FIG. 1 it is a flowchart of the low memory killing mechanism in the prior art.
  • the specific killing process includes the following steps:
  • the low memory killing mechanism is only a mechanical traversal process list, select one of them. The lowest priority process is checked and killed. After the completion, it is judged whether the currently available memory has reached the expected level. If the expected memory has not been reached, repeat the above steps until the available memory reaches the expected value. Therefore, it has the following defects:
  • the object of the present invention is to provide a low memory killing system and method based on the Android system, which can quickly and effectively recover the system memory space by troubleshooting the associated process to completely remove the stubborn process cluster with correlation, so that the system can get the problem of the card. Timely mitigation, effectively improving the user experience and reducing system power consumption.
  • the present invention provides a low memory killing system based on an Android system, comprising: a memory detecting module, detecting in real time whether the memory space of the Android system reaches a set expected value; a low memory driving module, and a memory detecting module Connection, when the memory space of the Android system does not reach the set expected value, the lowest priority process is selected in all currently running processes; the process management service module is connected with the low memory driver module, and the priority is the lowest.
  • the process matches all currently running other processes, finds all associated processes that are related to the lowest priority process, and obtains a stubborn process cluster; the process kills the module, connects with the process management service module, and kills the stubborn process. All associated processes included in the cluster release the memory space occupied by the processes.
  • the low memory driver module includes: a first traversal unit connected to the memory detection module, and traversing and obtaining a list of processes of all currently running processes when the memory space of the Android system does not reach the set expected value; priority a sorting unit, configured to store a preset rule for sorting processes according to priority from high to low; a process screening unit respectively connected to the first traversal unit and the priority sorting unit, and provided by the priority sorting unit
  • the prioritization rule from the list of processes obtained by the first traversal unit, filters the process with the lowest priority.
  • the process management service module includes: a package name storage unit, connected to the process screening unit to obtain package name information of a process with the lowest priority; and a second traversal unit connected to the package name storage unit to traverse all processes currently running The process list, and obtain the package name information of each process in the process list; the comparison unit is respectively connected with the package name storage unit and the second traversal unit, and the package name information of each process in the process list is separately selected from the filtered The packet name information of the process with the lowest priority is compared, and the associated process in which all the package name information matches the process with the lowest priority is detected; the sensing judgment module is respectively connected with the comparison unit and the package name storage unit, and is currently not used by the user.
  • the package name information of the perceived association process is stored in the package name storage unit to obtain a stubborn process cluster.
  • the process killing module is connected to the package name storage unit in the process management service module, and all the processes corresponding to all the package name information stored therein are checked and killed.
  • the invention also provides a low memory killing method based on the Android system, based on the foregoing low memory killing system implementation, comprising the following steps:
  • the memory detection module detects in real time whether the memory space of the Android system reaches the set expected value; when the expected value is not reached, the execution of S2 is continued;
  • the low memory driver module filters out the lowest priority process among all currently running processes
  • the process management service module matches the lowest priority process with all currently running other processes, and finds all associated processes that are related to the lowest priority process, and obtains a stubborn process cluster;
  • the process killing module kills all associated processes included in the stubborn process cluster, releases the memory space occupied by the processes, and returns to execute S1.
  • the S1 includes the following steps:
  • the memory detection module compares the detected actual value of the current memory space of the Android system with the preset expected value; when the actual value of the memory space is greater than or equal to the expected value, returns to execute S12; when the actual value of the memory space is small Continue to execute S2 at the expected value.
  • the S2 includes the following steps:
  • the priority sorting unit stores a preset rule for sorting processes according to priority from high to low;
  • the first traversal unit traverses and acquires a list of processes of all processes currently running.
  • the process screening unit selects, according to the priority ordering rule stored in the priority sorting unit, the process with the lowest priority from the process list obtained by the first traversal unit.
  • the process is divided into large classes, and sorted according to the priority from high to low: foreground process, visible process, secondary process, background process, content provider and empty process;
  • each major class of processes is further divided into small classes, and sorted according to the priority from high to low: the process with the most recent maximum probability being restarted, and the recent Processes with a higher probability of being restarted, and processes that have not been restarted in the near future;
  • each process included in each small class process is sorted according to the priority from high to low.
  • the process with the shortest average startup time has the lowest priority and the average startup time is the most.
  • a long process with the highest priority is the highest priority.
  • the S3 includes the following steps:
  • the package name storage unit obtains the package name information of the process with the lowest priority.
  • the second traversal unit traverses the process list of all processes currently running, and obtains package name information of each process in the process list.
  • the comparison unit compares the package name information of each process in the process list with the package name information of the selected lowest priority process, and determines whether the package name information of the two matches, and if yes, confirms that the process is The associated process that matches the lowest priority process until all processes in the process list are checked;
  • the perceptual judgment module determines whether each associated process is perceived by the user; if yes, the associated process is added to the whitelist and discarded to clean up; if not, the package name information of the associated process is stored in the package name storage. In the unit, get a stubborn process cluster.
  • the rule for determining whether the association process is perceived by the user is specifically:
  • S343. Determine whether the associated process is a process of an invisible interface that is currently in an operating state. If yes, determine that the associated process is perceived by the user. If not, determine that the associated process is not perceived by the user.
  • the low memory memory killing system and method based on the Android system of the present invention has the following advantages compared with the prior art: it is related to the process of checking and killing by thoroughly checking the association process. All the stubborn process clusters, avoid repeated repeated invalid killing work, and quickly and effectively recover the system memory space, so that the system Karton problem is relieved in time, effectively improve the user experience, and reduce system power consumption.
  • FIG. 1 is a flow chart of a low memory killing mechanism based on an Android system in the prior art
  • FIG. 2 is a schematic diagram of a working architecture of a low memory killing system based on an Android system in the present invention
  • FIG. 3 is a schematic structural diagram of a low memory killing system based on an Android system in the present invention.
  • FIG. 4 is a schematic structural view of a low memory drive module in the present invention.
  • FIG. 5 is a schematic structural diagram of a process management service module in the present invention.
  • FIG. 6 is a basic flowchart of a low memory killing method based on an Android system in the present invention.
  • FIG. 7 is a detailed flowchart of a low memory killing method based on Android system in the present invention.
  • the terms “including”, “comprising”, “having”, or any other variants are intended to encompass a non-exclusive inclusion, such that a process, method, article, or terminal device that includes a plurality of elements includes not only those elements but also Includes other elements not explicitly listed, or elements that are inherent to such a process, method, item, or terminal device.
  • An element defined by the phrase “including” or “comprising” does not exclude the presence of additional elements in the process, method, article or terminal device including the element.
  • “greater than”, “less than”, “exceeded”, etc. are understood as not including the number; “above”, “below”, “inside”, etc. are understood to include the number.
  • FIG. 2 is a schematic diagram of a working architecture of a low-memory killing system based on an Android system provided by the present invention; wherein the Android system is generally applied to a mobile phone, or a tablet computer, or a smart wearable device (including smart
  • a mobile intelligent terminal such as a watch or a smart bracelet includes: a kernel driver layer (Kernel), which is a hardware driver running layer of a mobile intelligent terminal, and is an abstraction layer between hardware and software processes; a framework layer is The link layer between the application layer and the kernel driver layer; the application layer (App), where each application process in the mobile smart terminal runs.
  • Kernel kernel driver layer
  • App application layer
  • the schematic diagram of a low-memory killing system based on the Android system includes: a memory detecting module 1 , which detects in real time whether the memory space of the Android system reaches a set expected value; a low memory driver Module 2, which is disposed in the kernel driver layer of the Android system, is connected to the memory detecting module 1 and is filtered out in all currently running processes when the memory space of the Android system does not reach the set expected value.
  • the process with the lowest priority; the Process Management Service (AMS) module 3 is set in the framework layer of the Android system and is connected to the low memory driver module 2, and the process with the lowest priority and all other processes currently running. Perform matching, find all associated processes that are related to the lowest priority process, and obtain stubborn process clusters; process killing module 4, connect with process management service module 3, and kill all associated processes included in the stubborn process cluster , free up the memory space occupied by these processes.
  • AMS Process Management Service
  • the memory detecting module 1 the expected value (threshold value) of the memory space required for the normal operation of the Android system is stored. After detecting the actual value of the current memory space of the Android system, the memory detecting module 1 compares with the preset expected value; if the actual value of the memory space is greater than the expected value, the current memory space of the Android system reaches the set expectation. The value, that is, the memory space is sufficient; if the actual value of the memory space is less than the expected value, the current memory space of the Android system does not reach the set expected value, that is, the memory space is insufficient, and the memory detection module 1 will trigger the low memory driver. Module 2 starts, and needs to kill the lowest priority process or all associated processes related to the process, thereby freeing up the memory space occupied by the processes, so that the Android system can obtain the memory space required for normal operation.
  • FIG. 4 it is a schematic structural diagram of the low memory drive module 2, including: a first traversal unit 21 connected to the memory detection module 1 and traversing when the memory space of the Android system does not reach the set expected value. And obtaining a process list of all processes currently running; a priority sorting unit 22, configured to store a preset rule for sorting the processes according to priority from high to low; the process screening unit 23, respectively, and the first The traversing unit 21 and the priority sorting unit 22 are connected, and the process with the lowest priority is selected from the process list acquired by the first traversing unit 21 according to the priority ordering rule provided in the prioritizing unit 22.
  • the rules for sorting the processes according to the priorities from high to low are stored in the priority sorting unit 22, and specifically include: first, classifying the processes according to the Android system, and sorting the processes according to the priority from high to low. It is: foreground process, visible process, secondary process, background process, content provider and empty process; then, according to the number of startups of each process and the time consumed by each startup, each class process is further divided into subclasses.
  • the processes included in each small class process are sorted according to the priority from high to low, wherein the process with the shortest average startup time is given priority.
  • the process with the lowest level and the longest average startup time has the highest priority.
  • Foreground App refers to the process and some system processes currently displayed on the screen of the intelligent mobile terminal; in principle, such processes are almost impossible to be killed by the low memory killing system;
  • Representative process The app that the user is currently using to read the news, or the app that the user is currently using to browse the web.
  • Background Process is the process that is normally understood to be switched to the background after startup. That is to say, when the process is displayed on the screen of the smart mobile terminal, the process that it runs is the foreground process, and once the user presses the Home button (non-Back return key) to return to the main interface, the process is resident. In the background, become a background process. Usually such background processes are the target objects of the low memory killing system;
  • Representative process A game app that the user is running before. Because the user has other usage requirements for the smart mobile terminal, after pressing the Home button, the game app is switched to the background process.
  • Content Provider refers to no process entity, only provide content for other processes to use. In general, such a process is also the target of a low-memory killing system, which is very likely to be investigated and terminated.
  • the present invention prioritizes the priority of these six types of processes, in the actual application process, the foreground process, the visible process, and the secondary process are basically non-existent (but not absolutely) the possibility of being killed, and all the killing objects are concentrated in the three processes of background processes, content providers and empty processes.
  • the process first sorts the priorities according to the categories, further processing of each process included in each category is further performed.
  • the specific ordering rules are:
  • the average startup time of the process is calculated according to the following formula:
  • t avg represents the average startup time of the process
  • n represents the total number of times the process has recently started
  • t n represents the startup time of the process from the current time in the n starts.
  • each small class of processes included in each major process is sorted according to the priority from high to low: the process with the most recent maximum probability being restarted, the process with a recent high probability of being restarted, and will not be restarted in the near future. Process.
  • the priority is sorted from high to low according to the average startup time t avg of each process, wherein the process with the shortest startup time t avg has the lowest priority.
  • the process with the longest start-up time t avg has the highest priority.
  • the first traversal unit 21 traverses all the running process lists obtained, and there is only one empty process; the priority ordering unit 22 The priority ranking rule stored in the process belongs to the process with the lowest priority, and is directly filtered by the process screening unit 23.
  • the first traversal unit 21 traverses the obtained list of all running processes, there is no empty process, but there is only one content. Provider; according to the priority ranking rule stored in the prioritization unit 22, since there is no empty process running, the content provider becomes the process with the lowest priority and is filtered by the process screening unit 23.
  • the first traversal unit 21 traverses the obtained list of all running processes, there is no empty process, and there is no content provider. However, there are 3 background processes, and the 3 background processes belong to the process whose recent maximum probability is restarted, the process whose recent probability is restarted, and the process which will not be restarted in the near future;
  • the stored prioritization rule in which the process that will not be restarted in the near future belongs to the process with the lowest priority, is thus filtered by the process screening unit 23.
  • the first traversal unit 21 traverses the list of all running processes acquired, there is no empty process, and there is no content provider. However, there are 3 background processes, and these 3 background processes belong to the process that will not be restarted in the near future.
  • the priority is further sorted according to the average startup time of each process, and the process with the shortest average startup time is The lowest priority will be filtered by the process screening unit 23. When the average startup time of a process is the shortest, it indicates the initiation of the process.
  • the fastest speed, temporarily stop running, the time spent on the next restart is the shortest; therefore, the process that keeps the slow start speed continues to run in the background, selects the fastest startup process to check and kill, temporarily releases the memory. Space, even if the subsequent user starts the process again, it will not cause the startup time to be too long, so that the user experience can be improved.
  • FIG. 5 it is a schematic structural diagram of the process management service module 3, including: a package name storage unit 31, connected to the process screening unit 23, and acquiring package name information of a process with the lowest priority; the second traversal unit 32 Connected to the package name storage unit 31, after the package name storage unit 31 acquires the package name information of the process with the lowest priority, traverses the process list of all processes currently running, and acquires the package name information of each process in the process list.
  • the comparison unit 33 is connected to the package name storage unit 31 and the second traversal unit 32, respectively, and compares the package name information of each process in the process list with the package name information of the selected lowest priority process, and performs troubleshooting.
  • the perception determination module 34 is connected to the comparison unit 33 and the package name storage unit 31, respectively, and stores the package name information of the associated process that is not currently perceived by the user to In the package name storage unit 31, a stubborn process cluster is obtained.
  • the rule that the sensing determining module 34 determines whether the associated process is perceived by the user is: determining whether the associated process and the foreground process currently in the operating state belong to the same task, and if so, determining that the associated process is perceived by the user; otherwise, further determining Whether the associated process is a process of a visible interface in a non-operational state, and if so, the associated process is considered to be perceived by the user; otherwise, the process of determining whether the associated process is an invisible interface of the currently operating state is continued, and if so, the associated process is considered The user perceives, otherwise the associated process is considered not to be perceived by the user.
  • the process of the visible interface of the non-operational state may specifically be a process related to the use of the user, such as an input method.
  • the process of the invisible interface of the operating state may specifically be a process of playing music, or a process of performing a download task, etc., which does not need to be visible in the interface of the smart mobile terminal, but is currently being operated by the user. process.
  • the process killing module 4 is connected to the package name storage unit 31 in the process management service module 3, and all the processes corresponding to all the package name information stored therein are checked and killed, so as to completely eliminate the stubborn process cluster and prevent the stubborn process. Start again.
  • the present invention further provides a low memory killing method based on an Android system, which is based on the aforementioned low Memory killing system implementation, suitable for mobile smart devices such as mobile phones, or tablets, or smart wearable devices (including smart watches or smart bracelets), including the following steps:
  • the memory detection module 1 detects in real time whether the memory space of the Android system reaches the set expected value; when the expected value is not reached, triggering to start the low memory drive module 2, and continue to execute S2;
  • the low memory driver module 2 screens out the lowest priority process among all currently running processes
  • the process management service module 3 matches the lowest priority process with all currently running other processes, and finds all associated processes that are related to the lowest priority process to obtain a stubborn process cluster.
  • the process killing module 4 kills all associated processes included in the stubborn process cluster, releases the memory space occupied by the processes, and returns to execute S1.
  • the S1 includes the following steps:
  • the memory detecting module 1 compares the detected actual value of the current memory space of the Android system with the preset expected value.
  • the actual value of the memory space is greater than or equal to the expected value, it indicates that the current memory space of the Android system reaches the set expected value, that is, the memory space is sufficient, and the execution returns to S12;
  • the current memory space of the Android system does not reach the set expected value, that is, the memory space is insufficient, and S2 is continued.
  • the S2 includes the following steps:
  • the priority sorting unit 22 stores a preset rule for sorting the processes according to the priority from high to low;
  • the first traversal unit 21 traverses and acquires a process list of all processes currently running.
  • the process screening unit 23 selects the process with the lowest priority from the process list acquired by the first traversal unit 21 according to the priority ordering rule stored in the priority sorting unit 22.
  • the process is divided into large classes and sorted according to the priority from high to low: foreground process, visible process, secondary process, background process, content provider and empty process;
  • each major class of processes is further divided into small classes, and sorted according to the priority from high to low: the process with the most recent maximum probability being restarted, and the recent Processes with a higher probability of being restarted, and processes that have not been restarted in the near future;
  • each process included in each small class process is sorted according to the priority from high to low.
  • the process with the shortest average startup time has the lowest priority and the average startup time is the most.
  • a long process with the highest priority is the highest priority.
  • the present invention prioritizes the priority of these six types of processes, in the actual application process, the foreground process, the visible process, and the secondary process are basically non-existent (but It is not absolute) the possibility of being killed, and all the killing objects are concentrated in the three processes of background processes, content providers and empty processes.
  • t avg represents the average startup time of the process
  • t c represents the current time
  • t n represents the last startup time of the process from the current time in n starts
  • n represents the total number of times the process has recently started
  • the S3 includes the following steps:
  • the package name storage unit 31 acquires package name information of the process with the lowest priority.
  • the second traversal unit 32 traverses the process list of all processes currently running, and obtains package name information of each process in the process list.
  • the comparing unit 33 compares the package name information of each process in the process list with the package name information of the selected lowest priority process, and determines whether the package name information of the two matches, and if yes, confirms the process. Is the associated process that matches the lowest priority process until all processes in the process list are checked.
  • the perceptual judgment module 34 determines whether each associated process is perceived by the user; if yes, the associated process is added to the whitelist and discarded to clean up; if not, the package name information of the associated process is stored to the package name. In the storage unit 31, a stubborn process cluster is obtained.
  • the rule for determining whether the association process is perceived by the user is specifically:
  • S343. Determine whether the associated process is a process of an invisible interface that is currently in an operating state. If yes, determine that the associated process is perceived by the user. If not, determine that the associated process is not perceived by the user.
  • the process of the visible interface of the non-operational state may specifically be a process related to the use of the user, such as an input method.
  • the process of the invisible interface of the operating state may specifically be a process of playing music, or a process of performing a download task, etc., which does not need to be visible in the interface of the smart mobile terminal, but is currently being operated by the user. process.
  • the memory detecting module 1 detects that the memory space of the Android system does not reach the set expected value, triggering and starting the low memory driving module 2; the low memory driving module 2 filters out all current
  • the only one empty process in the running process list is the process with the lowest priority. After the process management service module 3 is checked, no related process has been found. Therefore, the process killing module 4 will be empty. Process killing cleanup.
  • the memory detection module 1 detects that the memory space of the Android system has not reached the set expected value, and continues to be filtered by the low memory driver module 2, and no empty process is found, and no content is found.
  • the donor but finds 4 background processes, in which 4 low-priority processes that will not be restarted in the near future are filtered out, and then the average startup time is selected in the 2 processes.
  • the process which is the lowest priority process, is reported to the process management service module 3. After the process management service module 3 is checked, a number of associated processes with which correlations are found are found, and all associated processes are not perceived by the user, so the process killing module 4 includes the stubborn process cluster (including the lowest priority process and its All associated processes) are all cleaned up.
  • the low memory driver module 2 filters out another background process whose average startup time is long and will not be restarted in the near future is the lowest priority process, and is managed by the process.
  • the service module 3 is checked, an associated process with which it has relevance is found. However, the association process is determined to be perceived by the user after being judged, so the associated process is abandoned and killed, and the final process killing module 4 only kills the process with the lowest priority. Subsequently, it was found that the memory space of the Android system has reached the set expected value, and the process of killing and killing the process will not be performed temporarily.
  • the low-memory killing system and method based on the Android system triggers a low-memory driver module by setting a connection communication channel of the process management service module 3 between the low-memory driver module 2 and each process.
  • the process management service module 3 matches all the processes with the lowest priority by matching the package name information.
  • the sexual association process acquires the stubborn process cluster, so that the process killing module 4 can clean up and clean it up at one time, prevent the stubborn process cluster from starting again, and effectively improve the effect of memory recycling.
  • the associated process needs to be judged by the user, and when it is found that it is being perceived by the user, it is forgotten to be cleaned up.
  • the low memory killing system and method based on the Android system of the present invention has the following advantages: by checking the association process, completely removing all stubborn process clusters that are related to the process that needs to be killed and killed. Avoid repeated repeated invalidation and killing work, and quickly and effectively recover the system memory space, so that the system can be relieved in time, effectively improve the user experience, and reduce system power consumption.

Abstract

An Android system-based low memory killer system and method, said method comprising: S1. a memory detection module detecting, in real time, whether a memory space of an Android system reaches a set expected value; executing S2 when the expected value is not reached; S2. the low memory drive module screening, from all the currently running processes, out a process having the lowest priority; S3. a process management service module matching the process having the lowest priority with other currently running processes, and screening out associated processes correlated with the process having the lowest priority, so as to acquire a persistent process cluster; S4. a process killer module killing the persistent process cluster, freeing up a memory space occupied by these processes, and returning to execute S1. By screening out the associated processes to completely remove the correlated persistent process clusters, the invention can quickly and effectively recycle the memory space of the system, promptly solving the problem of the system getting stuck, effectively improving the user experience, and reducing the system power consumption.

Description

基于安卓系统的低内存查杀系统和方法Low memory killing system and method based on Android system 技术领域Technical field
本发明涉及智能移动终端的系统内存管理机制,具体是指一种基于安卓系统的低内存查杀系统和方法。The invention relates to a system memory management mechanism of an intelligent mobile terminal, in particular to a low memory killing system and method based on an Android system.
背景技术Background technique
目前在手机等智能移动终端中所普遍使用的Android(安卓)系统,是基于Linux系统开发的开源操作系统。Linux系统的内存管理有其独特的动态存储管理机制,但是Android系统在Linux的内存管理机制的基础上对其进行了进一步的优化。Linux系统会在进程活动停止后就结束该进程,而Android系统会把这些进程都保留在内存中。The Android (Android) system currently used in smart mobile terminals such as mobile phones is an open source operating system based on Linux system development. The memory management of Linux system has its unique dynamic storage management mechanism, but the Android system is further optimized based on the memory management mechanism of Linux. The Linux system will end the process after the process activity has stopped, and the Android system will keep these processes in memory.
因此,Android系统是一个多任务系统,也就是说可以同时运行多个进程。一般来说,启动运行一个进程是需要消耗一定的时间的,因此为了加快进程的运行速度,每当用户退出一个进程时,Android系统并不会立即将该进程完全停止运行(俗称杀掉进程),这样当用户下次再选择运行该进程时,就可以快速启动。但是,随着Android系统中保留的进程越来越多,内存肯定会出现不足的情况,这个时候,Android系统将会开始进行进程的自动查杀过程,对于使用物理内存最多、并且重要性最小的进程(或者按照规定的优先级)进行查杀操作,回收对应进程占用的内存,以达到对系统内存优化的目的,缓解系统的卡顿问题,而这个功能被称为低内存查杀(Low Memory Killer,LMK)机制。Therefore, the Android system is a multi-tasking system, which means that multiple processes can be run simultaneously. In general, it takes a certain amount of time to start a process, so in order to speed up the process, whenever the user exits a process, the Android system does not immediately stop the process completely (commonly known as killing the process). So that when the user chooses to run the process next time, they can start quickly. However, as more and more processes are reserved in the Android system, the memory will definitely be insufficient. At this time, the Android system will start the automatic killing process of the process, which is the most used and the least important to use. The process (or according to the specified priority) to perform the killing operation, recovering the memory occupied by the corresponding process, to achieve the purpose of optimizing the system memory, and alleviating the problem of the system, and this function is called low memory killing (Low Memory) Killer, LMK) mechanism.
目前Android系统一共拥有六类进程,并且按照被低内存查杀机制排查出并停止运行的可能性从低到高排列,依次为:前台进程、可见进程、次要进程、后台进程、内容提供者和空进程。也就是说,当Android系统的内存发生不足的情况时,最先被查杀的是空进程(如果存在的话)。如果空进程被查杀后依然无法保证足够的内存空间来维持正常的系统运行,那么第二被查杀的将是内容提供者。依次类推,接下去第三被查杀的将是后台进程。但是,一般情况下,前台进程、可见进程和次要进程这三类进程,在系统内存管理的 过程中,被低内存查杀机制查杀的可能性非常小,因为一旦这些进程被杀,将造成极差的用户体验。At present, the Android system has a total of six types of processes, and the possibility of being detected and stopped by the low memory killing mechanism is arranged from low to high, in order: foreground process, visible process, secondary process, background process, content provider And an empty process. That is to say, when the memory of the Android system is insufficient, the first process to be killed is an empty process (if it exists). If the empty process is still unable to guarantee enough memory space to maintain normal system operation after being killed, the second one will be the content provider. And so on, the next third will be the background process. However, in general, the front-end process, the visible process, and the secondary process are three types of processes in system memory management. In the process, the possibility of being killed by the low memory killing mechanism is very small, because once these processes are killed, it will result in a very poor user experience.
Android系统设计有一个规则来回收内存空间,其对于内存空间的调度设有一个预定的阀值,只有当系统的内存空间低于该阀值时,Android系统才会启动低内存查杀机制,按预设的规则顺序来停止运行系统认为当前最不重要的进程,从而释放内存空间。The Android system has a rule to reclaim the memory space. It has a predetermined threshold for the scheduling of the memory space. Only when the memory space of the system is lower than the threshold, the Android system will start the low memory killing mechanism. The default rule order is to stop running the system that is considered to be the least important process, thus freeing up memory space.
现有技术中,一般只需要打开使用Android系统的智能移动终端的以下这个目录文件,即Sys/Module/Lowmemorykiller/Parameters/Minfree这个目录文件,相应的阀值就被记录在其中。例如,当Android系统的运行内存小于211Mb时,低内存查杀机制需要杀死空进程;而当Android系统的运行内存小于176Mb时,低内存查杀机制不仅需要杀死空进程,还需要一并杀死内容提供者。In the prior art, it is generally only necessary to open the following directory file of the smart mobile terminal using the Android system, that is, the directory file of Sys/Module/Lowmemorykiller/Parameters/Minfree, and the corresponding threshold is recorded therein. For example, when the running memory of the Android system is less than 211Mb, the low memory killing mechanism needs to kill the empty process; when the running memory of the Android system is less than 176Mb, the low memory killing mechanism not only needs to kill the empty process, but also needs to be combined. Kill the content provider.
但是,目前某些应用进程通过某些技术手段,能够达到常驻系统,不能彻底查杀,死而复生的目的。且这类进程大有愈演愈烈的趋势,变的越来越多,造成泛滥的情况,从而大大降低了低内存查杀机制的实际效果。通常该些顽固进程达到杀不死的方法是:当进程启动运行时,将会同时启动两个或多个进程,形成互相关联的进程组。当触发低内存查杀机制时,在杀死一个优先级最低的进程之后,其他仍存活的关联进程将重新运行一个替代进程,导致低内存查杀机制一直尝试去杀该进程(重启后变身为另一个替代进程),达不到回收对应进程所占用内存的预期效果。However, at present, some application processes can reach the resident system through certain technical means, and cannot completely kill and kill, and the purpose of resurrection. And such processes have become more and more intensive, more and more, resulting in flooding, which greatly reduces the actual effect of low memory killing mechanism. Usually, the method of killing these stubborn processes is: when the process starts running, two or more processes will be started at the same time to form a process group associated with each other. When the low memory killing mechanism is triggered, after killing a process with the lowest priority, the other still-lived associated processes will re-run an alternate process, causing the low memory killing mechanism to try to kill the process (changing after the restart) For another alternative process, the expected effect of reclaiming the memory used by the corresponding process is not achieved.
如图1所示,为现有技术中的低内存查杀机制的流程图,当Android系统因内存不足而触发低内存查杀机制启动时,其具体查杀过程包含以下步骤:As shown in FIG. 1 , it is a flowchart of the low memory killing mechanism in the prior art. When the Android system triggers the low memory killing mechanism to start due to insufficient memory, the specific killing process includes the following steps:
S1、遍历当前正在运行的所有进程列表;S1, traversing the list of all processes currently running;
S2、根据设定的优先级,从中筛选出符合条件的优先级最低的进程;S2: selecting, according to the set priority, a process with the lowest priority that meets the condition;
S3、杀死(kill)该进程,即使得该进程停止运行,释放该进程占用的内存,使得内存更新;S3, killing the process, that is, causing the process to stop running, releasing the memory occupied by the process, so that the memory is updated;
S4、判断更新后的内存大小是否满足系统运行的需要;如是,则结束低内存查杀机制;如否,则返回S1,继续查杀进程。S4. Determine whether the updated memory size satisfies the needs of the system operation; if yes, end the low memory killing mechanism; if not, return to S1 to continue the killing process.
在现有的技术方案中,由于低内存查杀机制只是机械的去遍历进程列表,选择其中一 个优先级最低的进程进行查杀,完成之后,判断当前可用内存是否达到预期,如果尚未达到预期则重复上述步骤,直到可用内存达到预期值。因此具有以下缺陷:In the existing technical solution, since the low memory killing mechanism is only a mechanical traversal process list, select one of them. The lowest priority process is checked and killed. After the completion, it is judged whether the currently available memory has reached the expected level. If the expected memory has not been reached, repeat the above steps until the available memory reaches the expected value. Therefore, it has the following defects:
1、因为系统中存在很多上述的顽固进程,查杀之后,又会被其关联进程重启,无法彻底查杀干净;1. Because there are many stubborn processes mentioned above in the system, after the killing, they will be restarted by their associated processes, and they cannot be completely cleaned up;
2、由于顽固进程无法彻底查杀干净,导致低内存查杀机制会重复查杀同一进程(或其替代进程),造成内存空间无法快速释放,使得系统持续卡顿;2, because the stubborn process can not be completely cleaned up, resulting in low memory killing mechanism will repeatedly kill the same process (or its replacement process), resulting in memory space can not be quickly released, making the system continue to jam;
3、由于顽固进程无法彻底查杀干净,导致低内存查杀机制会重复查杀同一进程(或其替代进程),造成智能移动终端功耗较大的问题,使得电量快速下降;3. Since the stubborn process cannot be completely cleaned up, the low memory killing mechanism will repeatedly kill the same process (or its replacement process), resulting in a problem of large power consumption of the intelligent mobile terminal, causing the power to drop rapidly;
4、智能移动终端因内存不足而经常卡顿的问题,会形成较差的用户体验,造成产品口碑下降,影响公司长远健康发展。4. The problem that smart mobile terminals are often stuck due to insufficient memory will result in a poor user experience, resulting in a decline in product reputation and affecting the long-term healthy development of the company.
基于上述,目前亟需提出一种新型的基于安卓系统的低内存查杀系统和方法,能够有效加强低内存情况下的进程查杀效果,彻底杀死具有关联进程的顽固进程,提高查杀效率,快速释放系统内存。Based on the above, it is urgent to propose a new low-memory killing system and method based on Android system, which can effectively enhance the process killing effect under low memory conditions, completely kill stubborn processes with associated processes, and improve the efficiency of killing. , quickly release system memory.
发明的公开Disclosure of invention
本发明的目的是提供一种基于安卓系统的低内存查杀系统和方法,通过排查关联进程以彻底清除具有相关性的顽固进程簇,能够快速有效的回收系统内存空间,使得系统卡顿问题得到及时缓解,有效提升用户体验,并且降低系统功耗。The object of the present invention is to provide a low memory killing system and method based on the Android system, which can quickly and effectively recover the system memory space by troubleshooting the associated process to completely remove the stubborn process cluster with correlation, so that the system can get the problem of the card. Timely mitigation, effectively improving the user experience and reducing system power consumption.
为实现上述目的,本发明提供一种基于安卓系统的低内存查杀系统,包含:内存检测模块,实时检测安卓系统的内存空间是否达到设定的预期值;低内存驱动模块,与内存检测模块连接,当安卓系统的内存空间未达到设定的预期值时,在当前所有正在运行的进程中筛选出优先级最低的进程;进程管理服务模块,与低内存驱动模块连接,将优先级最低的进程与当前所有正在运行的其他进程进行匹配,排查出与该优先级最低的进程具有相关性的全部关联进程,获取顽固进程簇;进程查杀模块,与进程管理服务模块连接,查杀顽固进程簇所包含的所有关联进程,释放该些进程占用的内存空间。To achieve the above object, the present invention provides a low memory killing system based on an Android system, comprising: a memory detecting module, detecting in real time whether the memory space of the Android system reaches a set expected value; a low memory driving module, and a memory detecting module Connection, when the memory space of the Android system does not reach the set expected value, the lowest priority process is selected in all currently running processes; the process management service module is connected with the low memory driver module, and the priority is the lowest. The process matches all currently running other processes, finds all associated processes that are related to the lowest priority process, and obtains a stubborn process cluster; the process kills the module, connects with the process management service module, and kills the stubborn process. All associated processes included in the cluster release the memory space occupied by the processes.
所述的低内存驱动模块包含:第一遍历单元,与内存检测模块连接,当安卓系统的内存空间未达到设定的预期值时,遍历并获取当前正在运行的所有进程的进程列表;优先级 排序单元,用于存储预先设定的将进程按照优先级由高到低排序的规则;进程筛选单元,分别与所述的第一遍历单元以及优先级排序单元连接,按照优先级排序单元中提供的优先级排序规则,从第一遍历单元获取的进程列表中,筛选得到优先级最低的进程。The low memory driver module includes: a first traversal unit connected to the memory detection module, and traversing and obtaining a list of processes of all currently running processes when the memory space of the Android system does not reach the set expected value; priority a sorting unit, configured to store a preset rule for sorting processes according to priority from high to low; a process screening unit respectively connected to the first traversal unit and the priority sorting unit, and provided by the priority sorting unit The prioritization rule, from the list of processes obtained by the first traversal unit, filters the process with the lowest priority.
所述的进程管理服务模块包含:包名存储单元,与进程筛选单元连接,获取优先级最低的进程的包名信息;第二遍历单元,与包名存储单元连接,遍历当前正在运行的所有进程的进程列表,并获取进程列表中每个进程的包名信息;比较单元,分别与包名存储单元以及第二遍历单元连接,将进程列表中的每个进程的包名信息分别与筛选出的优先级最低的进程的包名信息进行比较,排查出所有包名信息与优先级最低的进程相匹配的关联进程;感知判断模块,分别与比较单元以及包名存储单元连接,将当前未被用户感知的关联进程的包名信息存储至包名存储单元中,获得顽固进程簇。The process management service module includes: a package name storage unit, connected to the process screening unit to obtain package name information of a process with the lowest priority; and a second traversal unit connected to the package name storage unit to traverse all processes currently running The process list, and obtain the package name information of each process in the process list; the comparison unit is respectively connected with the package name storage unit and the second traversal unit, and the package name information of each process in the process list is separately selected from the filtered The packet name information of the process with the lowest priority is compared, and the associated process in which all the package name information matches the process with the lowest priority is detected; the sensing judgment module is respectively connected with the comparison unit and the package name storage unit, and is currently not used by the user. The package name information of the perceived association process is stored in the package name storage unit to obtain a stubborn process cluster.
所述的进程查杀模块与进程管理服务模块中的包名存储单元连接,将存储其中的所有包名信息对应的进程全部查杀。The process killing module is connected to the package name storage unit in the process management service module, and all the processes corresponding to all the package name information stored therein are checked and killed.
本发明还提供一种基于安卓系统的低内存查杀方法,基于前述的低内存查杀系统实现,包含以下步骤:The invention also provides a low memory killing method based on the Android system, based on the foregoing low memory killing system implementation, comprising the following steps:
S1、内存检测模块实时检测安卓系统的内存空间是否达到设定的预期值;当未达到预期值时,继续执行S2;S1, the memory detection module detects in real time whether the memory space of the Android system reaches the set expected value; when the expected value is not reached, the execution of S2 is continued;
S2、低内存驱动模块在当前所有正在运行的进程中筛选出优先级最低的进程;S2. The low memory driver module filters out the lowest priority process among all currently running processes;
S3、进程管理服务模块将优先级最低的进程与当前所有正在运行的其他进程进行匹配,排查出与该优先级最低的进程具有相关性的全部关联进程,获取顽固进程簇;S3. The process management service module matches the lowest priority process with all currently running other processes, and finds all associated processes that are related to the lowest priority process, and obtains a stubborn process cluster;
S4、进程查杀模块查杀顽固进程簇所包含的所有关联进程,释放该些进程占用的内存空间,并返回执行S1。S4. The process killing module kills all associated processes included in the stubborn process cluster, releases the memory space occupied by the processes, and returns to execute S1.
所述的S1中,具体包含以下步骤:The S1 includes the following steps:
S11、将预先设定的安卓系统正常运行所需的内存空间的预期值预先存储于内存检测模块中;S11. Pre-store the expected value of the memory space required for the preset Android system to operate normally in the memory detection module;
S12、内存检测模块将检测到的当前安卓系统的内存空间实际值,与该预先设定的预期值进行比较;当内存空间实际值大于等于预期值,返回执行S12;当内存空间实际值小 于预期值,继续执行S2。S12. The memory detection module compares the detected actual value of the current memory space of the Android system with the preset expected value; when the actual value of the memory space is greater than or equal to the expected value, returns to execute S12; when the actual value of the memory space is small Continue to execute S2 at the expected value.
所述的S2中,具体包含以下步骤:The S2 includes the following steps:
S21、优先级排序单元存储预先设定的将进程按照优先级由高到低排序的规则;S21. The priority sorting unit stores a preset rule for sorting processes according to priority from high to low;
S22、第一遍历单元遍历并获取当前正在运行的所有进程的进程列表;S22. The first traversal unit traverses and acquires a list of processes of all processes currently running.
S23、进程筛选单元按照优先级排序单元中存储的优先级排序规则,从第一遍历单元获取的进程列表中,筛选得到优先级最低的进程。S23. The process screening unit selects, according to the priority ordering rule stored in the priority sorting unit, the process with the lowest priority from the process list obtained by the first traversal unit.
所述的S21中,将进程按照优先级由高到低排序的规则具体为:In the S21, the rules for sorting the processes according to the priority from high to low are as follows:
首先,按照安卓系统将进程划分大类,并按照优先级由高到低粗排序为:前台进程、可见进程、次要进程、后台进程、内容提供者和空进程;First, according to the Android system, the process is divided into large classes, and sorted according to the priority from high to low: foreground process, visible process, secondary process, background process, content provider and empty process;
然后,按照每个进程的启动次数以及每一次启动所消耗的时间,将每大类进程进一步划分小类,并按照优先级由高到低细排序为:近期最大概率被重新启动的进程、近期较大概率被重新启动的进程、以及近期不被重新启动的进程;Then, according to the number of startups of each process and the time consumed by each startup, each major class of processes is further divided into small classes, and sorted according to the priority from high to low: the process with the most recent maximum probability being restarted, and the recent Processes with a higher probability of being restarted, and processes that have not been restarted in the near future;
最后,按照每个进程的平均启动时长,将每小类进程中所包含的各个进程按照优先级由高到低精细排序,其中,平均启动时长最短的进程,其优先级最低,平均启动时长最长的进程,其优先级最高。Finally, according to the average startup time of each process, each process included in each small class process is sorted according to the priority from high to low. The process with the shortest average startup time has the lowest priority and the average startup time is the most. A long process with the highest priority.
所述的S3中,具体包含以下步骤:The S3 includes the following steps:
S31、包名存储单元获取优先级最低的进程的包名信息;S31. The package name storage unit obtains the package name information of the process with the lowest priority.
S32、第二遍历单元遍历当前正在运行的所有进程的进程列表,并获取进程列表中每个进程的包名信息;S32. The second traversal unit traverses the process list of all processes currently running, and obtains package name information of each process in the process list.
S33、比较单元将进程列表中的每个进程的包名信息分别与筛选出的优先级最低的进程的包名信息进行比较,判断两者的包名信息是否匹配;如是,则确认该进程是与优先级最低的进程相匹配的关联进程,直至进程列表中的全部进程均排查完毕;S33. The comparison unit compares the package name information of each process in the process list with the package name information of the selected lowest priority process, and determines whether the package name information of the two matches, and if yes, confirms that the process is The associated process that matches the lowest priority process until all processes in the process list are checked;
S34、感知判断模块判断每个关联进程是否被用户感知;如是,则将该关联进程加入白名单并放弃对其查杀清理;如否,则将该关联进程的包名信息存储至包名存储单元中,获得顽固进程簇。S34: The perceptual judgment module determines whether each associated process is perceived by the user; if yes, the associated process is added to the whitelist and discarded to clean up; if not, the package name information of the associated process is stored in the package name storage. In the unit, get a stubborn process cluster.
所述的S34中,判断关联进程是否被用户感知的规则具体为: In the S34, the rule for determining whether the association process is perceived by the user is specifically:
S341、判断关联进程与当前正在操作状态的前台进程是否属于同一任务;若是,则确定关联进程被用户感知;若否,则继续执行S342;S341, determining whether the associated process and the foreground process of the current operating state belong to the same task; if yes, determining that the associated process is perceived by the user; if not, proceeding to S342;
S342、判断关联进程是否为非操作状态的可见界面的进程;若是,则确定关联进程被用户感知;若否,则继续执行S343;S342, determining whether the associated process is a process of the visible interface of the non-operational state; if yes, determining that the associated process is perceived by the user; if not, proceeding to S343;
S343、判断关联进程是否为当前正在操作状态的不可见界面的进程,若是,则确定关联进程被用户感知,若否,则确定关联进程未被用户感知。S343. Determine whether the associated process is a process of an invisible interface that is currently in an operating state. If yes, determine that the associated process is perceived by the user. If not, determine that the associated process is not perceived by the user.
综上所述,本发明所述的基于安卓系统的低内存查杀系统和方法,与现有技术相比,具有以下优点:通过排查关联进程,彻底清除与该需要查杀的进程具有相关性的所有顽固进程簇,避免反复执行重复无效的查杀工作,并且快速有效的回收系统内存空间,使得系统卡顿问题得到及时缓解,有效提升用户体验,并且降低系统功耗。In summary, the low memory memory killing system and method based on the Android system of the present invention has the following advantages compared with the prior art: it is related to the process of checking and killing by thoroughly checking the association process. All the stubborn process clusters, avoid repeated repeated invalid killing work, and quickly and effectively recover the system memory space, so that the system Karton problem is relieved in time, effectively improve the user experience, and reduce system power consumption.
附图的简要说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图进行简单介绍,显而易见的,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art description will be briefly described below. It is obvious that the drawings in the following description are Some of the embodiments of the invention may be obtained by those of ordinary skill in the art in view of the drawings without departing from the scope of the invention.
图1为现有技术中的基于Android系统的低内存查杀机制的流程图;1 is a flow chart of a low memory killing mechanism based on an Android system in the prior art;
图2为本发明中的基于Android系统的低内存查杀系统的工作架构示意图;2 is a schematic diagram of a working architecture of a low memory killing system based on an Android system in the present invention;
图3为本发明中的基于Android系统的低内存查杀系统的结构示意图;3 is a schematic structural diagram of a low memory killing system based on an Android system in the present invention;
图4为本发明中的低内存驱动模块的结构示意图;4 is a schematic structural view of a low memory drive module in the present invention;
图5为本发明中的进程管理服务模块的结构示意图;5 is a schematic structural diagram of a process management service module in the present invention;
图6为本发明中的基于Android系统的低内存查杀方法的基本流程图;6 is a basic flowchart of a low memory killing method based on an Android system in the present invention;
图7为本发明中的基于Android系统的低内存查杀方法的详细流程图。FIG. 7 is a detailed flowchart of a low memory killing method based on Android system in the present invention.
实现本发明的最佳方式The best way to implement the invention
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本 发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the drawings in the embodiments of the present invention. Is this Some embodiments, rather than all of the embodiments, are invented. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
需要说明的是,在本文中,诸如“第一”、“第二”、“第三”等关系术语(如果存在)仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。应该理解这样使用的术语在适当情况下可以互换,以便这里描述的本发明的实施例,例如能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”、“包含”、“具有”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括……”或“包含……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的要素。此外,在本文中,“大于”、“小于”、“超过”等理解为不包括本数;“以上”、“以下”、“以内”等理解为包括本数。It should be noted that, herein, relational terms such as "first," "second," "third," and the like, if any, are used merely to distinguish one entity or operation from another. There is no requirement or implied that there is any such actual relationship or order between these entities or operations. It is to be understood that the terms so used are interchangeable, as appropriate, such that the embodiments of the invention described herein can be implemented, for example, in a sequence other than those illustrated or described herein. In addition, the terms "including", "comprising", "having", or any other variants are intended to encompass a non-exclusive inclusion, such that a process, method, article, or terminal device that includes a plurality of elements includes not only those elements but also Includes other elements not explicitly listed, or elements that are inherent to such a process, method, item, or terminal device. An element defined by the phrase "including" or "comprising" does not exclude the presence of additional elements in the process, method, article or terminal device including the element. In addition, in this document, “greater than”, “less than”, “exceeded”, etc. are understood as not including the number; “above”, “below”, “inside”, etc. are understood to include the number.
以下结合图2~图7,以具体地实施例对本发明的技术方案进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。The technical solutions of the present invention will be described in detail below with reference to FIGS. 2 to 7 in a specific embodiment. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in some embodiments.
如图2所示,为本发明所提供的基于Android系统的低内存查杀系统的工作架构示意图;其中,所述的Android系统一般应用于手机、或平板电脑、或智能可穿戴设备(包括智能手表或智能手环)等的移动智能终端,包含:内核驱动层(Kernel),是移动智能终端的硬件驱动程序运行层,是硬件和软件进程之间的抽象层;框架层(Framework),是连接应用程序层与内核驱动层之间的链接层;应用程序层(App),移动智能终端中的各个应用进程均在该层运行。FIG. 2 is a schematic diagram of a working architecture of a low-memory killing system based on an Android system provided by the present invention; wherein the Android system is generally applied to a mobile phone, or a tablet computer, or a smart wearable device (including smart A mobile intelligent terminal such as a watch or a smart bracelet includes: a kernel driver layer (Kernel), which is a hardware driver running layer of a mobile intelligent terminal, and is an abstraction layer between hardware and software processes; a framework layer is The link layer between the application layer and the kernel driver layer; the application layer (App), where each application process in the mobile smart terminal runs.
如图3所示,为本发明所提供的基于Android系统的低内存查杀系统的结构示意图,包含:内存检测模块1,实时检测Android系统的内存空间是否达到设定的预期值;低内存驱动模块2,设置在的Android系统的内核驱动层中,与所述的内存检测模块1连接,当Android系统的内存空间未达到设定的预期值时,在当前所有正在运行的进程中筛选出 优先级最低的进程;进程管理服务(AMS,Activity Manager Service)模块3,设置在Android系统的框架层中,与低内存驱动模块2连接,将优先级最低的进程与当前所有正在运行的其他进程进行匹配,排查出与该优先级最低的进程具有相关性的全部关联进程,获取顽固进程簇;进程查杀模块4,与进程管理服务模块3连接,查杀顽固进程簇所包含的所有关联进程,释放该些进程占用的内存空间。As shown in FIG. 3 , the schematic diagram of a low-memory killing system based on the Android system provided by the present invention includes: a memory detecting module 1 , which detects in real time whether the memory space of the Android system reaches a set expected value; a low memory driver Module 2, which is disposed in the kernel driver layer of the Android system, is connected to the memory detecting module 1 and is filtered out in all currently running processes when the memory space of the Android system does not reach the set expected value. The process with the lowest priority; the Process Management Service (AMS) module 3 is set in the framework layer of the Android system and is connected to the low memory driver module 2, and the process with the lowest priority and all other processes currently running. Perform matching, find all associated processes that are related to the lowest priority process, and obtain stubborn process clusters; process killing module 4, connect with process management service module 3, and kill all associated processes included in the stubborn process cluster , free up the memory space occupied by these processes.
在所述的内存检测模块1内,存储有预先设定的Android系统正常运行所需的内存空间的预期值(阈值)。内存检测模块1在检测到当前Android系统的内存空间实际值后,与该预先设定的预期值进行比较;如果内存空间实际值大于预期值,则说明Android系统当前的内存空间达到设定的预期值,即内存空间充足;如果内存空间实际值小于预期值,则说明Android系统当前的内存空间未达到设定的预期值,即内存空间不足,此时该内存检测模块1将会触发低内存驱动模块2启动,需要查杀优先级最低的进程或与该进程相关的所有关联进程,从而释放该些进程所占用的内存空间,使得Android系统能够获得正常运行所需的内存空间。In the memory detecting module 1, the expected value (threshold value) of the memory space required for the normal operation of the Android system is stored. After detecting the actual value of the current memory space of the Android system, the memory detecting module 1 compares with the preset expected value; if the actual value of the memory space is greater than the expected value, the current memory space of the Android system reaches the set expectation. The value, that is, the memory space is sufficient; if the actual value of the memory space is less than the expected value, the current memory space of the Android system does not reach the set expected value, that is, the memory space is insufficient, and the memory detection module 1 will trigger the low memory driver. Module 2 starts, and needs to kill the lowest priority process or all associated processes related to the process, thereby freeing up the memory space occupied by the processes, so that the Android system can obtain the memory space required for normal operation.
如图4所示,为所述的低内存驱动模块2的结构示意图,包含:第一遍历单元21,与内存检测模块1连接,当Android系统的内存空间未达到设定的预期值时,遍历并获取当前正在运行的所有进程的进程列表;优先级排序单元22,用于存储预先设定的将进程按照优先级由高到低排序的规则;进程筛选单元23,分别与所述的第一遍历单元21以及优先级排序单元22连接,按照优先级排序单元22中提供的优先级排序规则,从第一遍历单元21获取的进程列表中,筛选得到优先级最低的进程。As shown in FIG. 4 , it is a schematic structural diagram of the low memory drive module 2, including: a first traversal unit 21 connected to the memory detection module 1 and traversing when the memory space of the Android system does not reach the set expected value. And obtaining a process list of all processes currently running; a priority sorting unit 22, configured to store a preset rule for sorting the processes according to priority from high to low; the process screening unit 23, respectively, and the first The traversing unit 21 and the priority sorting unit 22 are connected, and the process with the lowest priority is selected from the process list acquired by the first traversing unit 21 according to the priority ordering rule provided in the prioritizing unit 22.
其中,所述的优先级排序单元22中存储的将进程按照优先级由高到低排序的规则,具体包括:首先,按照Android系统将进程划分大类,并按照优先级由高到低粗排序为:前台进程、可见进程、次要进程、后台进程、内容提供者和空进程;然后,按照每个进程的启动次数以及每一次启动所消耗的时间,将每大类进程进一步划分小类,并按照优先级由高到低细排序为:近期最大概率被重新启动的进程、近期较大概率被重新启动的进程、以及近期不被重新启动的进程;最后,按照每个进程的平均启动时长,将每小类进程中所包含的各个进程按照优先级由高到低精细排序,其中,平均启动时长最短的进程,其优先 级最低,而平均启动时长最长的进程,其优先级最高。The rules for sorting the processes according to the priorities from high to low are stored in the priority sorting unit 22, and specifically include: first, classifying the processes according to the Android system, and sorting the processes according to the priority from high to low. It is: foreground process, visible process, secondary process, background process, content provider and empty process; then, according to the number of startups of each process and the time consumed by each startup, each class process is further divided into subclasses. And sorted according to the priority from high to low: the process with the most recent maximum probability being restarted, the process with a recent high probability of being restarted, and the process that has not been restarted recently; finally, according to the average startup time of each process , the processes included in each small class process are sorted according to the priority from high to low, wherein the process with the shortest average startup time is given priority. The process with the lowest level and the longest average startup time has the highest priority.
其中,先详细介绍一下Android系统的6个大类进程,分别为:Among them, first introduce the six major processes of the Android system in detail, namely:
1、前台进程(Foreground App):是指目前正在智能移动终端的屏幕上显示的进程和一些系统进程;这类进程原则上来说几乎没有被低内存查杀系统查杀的可能性;1. Foreground App: refers to the process and some system processes currently displayed on the screen of the intelligent mobile terminal; in principle, such processes are almost impossible to be killed by the low memory killing system;
代表进程:用户当前正在使用的阅读新闻的App,或者用户当前正在使用的浏览网页的App。Representative process: The app that the user is currently using to read the news, or the app that the user is currently using to browse the web.
2、可见进程(Visible App):这部分进程虽然不在智能移动终端的前台显示,但与用户的使用却是密切相关的,原则上也是属于用户并不希望被停止运行的进程,所以,在通常情况下是不会被低内存查杀系统所查杀终止的;2, visible process (Visible App): Although this part of the process is not displayed in the foreground of the intelligent mobile terminal, but it is closely related to the user's use, in principle, it belongs to the process that the user does not want to be stopped, so usually In the case, it will not be terminated by the low memory killing system;
代表进程:输入法。Representative process: input method.
3、次要进程(Secondary App):这部分进程虽然属于次要进程,但与一些常用的系统功能依然息息相关,用户仍然还是会时常需要使用它们,所以也不太希望被低内存查杀系统所查杀终止;3, Secondary Process (Secondary App): Although this part of the process belongs to the secondary process, but it is still closely related to some commonly used system functions, users still need to use them from time to time, so they are not expected to be low memory killing system Termination of killing;
代表进程:联系人存储功能。Representative process: contact storage function.
4、后台进程(Background App):就是通常意义上所理解的启动后被切换到后台的进程。也就是说,当该进程显示在智能移动终端的屏幕上时,其所运行的进程即为前台进程,而一旦用户按Home键(非Back返回键)返回主界面后,该进程就被驻留在后台,成为后台进程。通常这类后台进程,是属于低内存查杀系统的目标对象;4, Background Process (Background App): is the process that is normally understood to be switched to the background after startup. That is to say, when the process is displayed on the screen of the smart mobile terminal, the process that it runs is the foreground process, and once the user presses the Home button (non-Back return key) to return to the main interface, the process is resident. In the background, become a background process. Usually such background processes are the target objects of the low memory killing system;
代表进程:用户之前正在运行的某游戏App,由于用户对智能移动终端有其他使用需求,在按了Home键后,该游戏App被切换为后台进程。Representative process: A game app that the user is running before. Because the user has other usage requirements for the smart mobile terminal, after pressing the Home button, the game app is switched to the background process.
5、内容提供者(Content Provider):是指没有进程实体,仅提供内容供其他进程使用的。一般情况下,这类进程也是低内存查杀系统的目标对象,是非常有可能被排查并终止运行的;5, Content Provider (Content Provider): refers to no process entity, only provide content for other processes to use. In general, such a process is also the target of a low-memory killing system, which is very likely to be investigated and terminated.
代表进程:日历供应节点。Representative process: calendar provisioning node.
6:空进程(Empty App):在进程退出后,依然会在进程中驻留一个空进程,这个进程里没有任何数据在运行,作用往往是提高该进程下次的启动速度或者记录进程的一些历 史信息。毫无疑问,这类型的进程属于低内存查杀系统的首要排查目标,是应该最先被终止运行以释放内存的。6: Empty App (Empty App): After the process exits, there will still be an empty process in the process. There is no data running in this process. The effect is often to increase the next startup speed of the process or record some processes. Calendar History information. There is no doubt that this type of process is the primary troubleshooting target of the low-memory killing system, and should be terminated first to release memory.
根据上述,虽然本发明对于这6类进程进行了优先权由高到低的排序,但是在实际的应用过程中,其中的前台进程、可见进程和次要进程,基本上不存在(但并不绝对)被查杀的可能性,而所有的查杀对象,几乎全部集中在后台进程、内容提供者和空进程这3类进程中。According to the above, although the present invention prioritizes the priority of these six types of processes, in the actual application process, the foreground process, the visible process, and the secondary process are basically non-existent (but not Absolutely) the possibility of being killed, and all the killing objects are concentrated in the three processes of background processes, content providers and empty processes.
在将进程首先按照类别进行优先权的粗排序之后,还需要进一步对每一类别所包含的各个进程进行进一步的细排序,具体的排序规则为:After the process first sorts the priorities according to the categories, further processing of each process included in each category is further performed. The specific ordering rules are:
首先,根据预先统计的每个进程近期的启动次数以及每次启动时所消耗的时间,分别计算每个进程的平均启动时长,基于每个进程的平均启动时长,来确定近期最大概率将会被重新启动的进程、近期较大概率将被重新启动的进程、以及近期将不被重新启动的进程。First, according to the pre-stated number of recent startups of each process and the time consumed by each startup, calculate the average startup duration of each process separately, and determine the recent maximum probability based on the average startup duration of each process. The process that is restarted, the process that will be restarted in the near future, and the process that will not be restarted in the near future.
具体的,根据下式计算进程的平均启动时长:Specifically, the average startup time of the process is calculated according to the following formula:
Figure PCTCN2017098520-appb-000001
Figure PCTCN2017098520-appb-000001
其中,tavg表示进程的平均启动时长;n表示进程近期启动的总次数;tn表示进程在n次启动中距离当前时间最近一次的启动时长。Where t avg represents the average startup time of the process; n represents the total number of times the process has recently started; t n represents the startup time of the process from the current time in the n starts.
进行以下判断:Make the following judgments:
当tavg-(tc-tn)>0且|(tavg-(tc-tn))|≤tavg-tc时,确定该进程属于近期最大概率被重新启动的进程;When t avg -(t c -t n )>0 and |(t avg -(t c -t n ))| t avg -t c , it is determined that the process belongs to a process in which the recent maximum probability is restarted;
当tavg-(tc-tn)≤0且|(tavg-(tc-tn))|≤tavg-tc时,确定该进程属于近期较大概率被重新启动的进程;此时表示预估计的进程启动的时间点己错过,但该进程还尚未被启动,此时进程很可能会稍后立即启动;因此,将该类进程确定为近期较大概率被重新启动的进程;When t avg -(t c -t n )≤0 and |(t avg -(t c -t n ))| ≤ t avg -t c , it is determined that the process belongs to a process in which a recent large probability is restarted; At this point, the time point at which the pre-estimated process started is missed, but the process has not yet been started, and the process is likely to start immediately later; therefore, the process is determined to be a process with a relatively high probability of being restarted in the near future. ;
当tavg-(tc-tn)>0且|(tavg-(tc-tn))|>tavg-tc时,确定该进程属于近期将不被重新启动的进程; When t avg -(t c -t n )>0 and |(t avg -(t c -t n ))|>t avg -t c , it is determined that the process belongs to a process that will not be restarted in the near future;
其中,tc表示当前时间。Where t c represents the current time.
接着,将每大类进程中所包含的每小类进程按照优先级由高到低排序为:近期最大概率被重新启动的进程、近期较大概率被重新启动的进程、近期将不被重新启动的进程。Then, each small class of processes included in each major process is sorted according to the priority from high to low: the process with the most recent maximum probability being restarted, the process with a recent high probability of being restarted, and will not be restarted in the near future. Process.
最后,对于每小类进程中所包含的各个进程,按照每个进程的平均启动时长tavg进行优先级由高到低精细排序,其中,平均启动时长tavg最短的进程,其优先级最低,而平均启动时长tavg最长的进程,其优先级最高。Finally, for each process included in each small class process, the priority is sorted from high to low according to the average startup time t avg of each process, wherein the process with the shortest startup time t avg has the lowest priority. The process with the longest start-up time t avg has the highest priority.
在本发明的一个优选实施例中,当低内存驱动模块2被触发启动后,第一遍历单元21遍历获取的所有正在运行的进程列表中,存在唯一1个空进程;按照优先级排序单元22中所存储的优先级排序规则,该空进程属于优先级最低的进程,当直接被进程筛选单元23筛选出。In a preferred embodiment of the present invention, after the low memory driver module 2 is triggered to be started, the first traversal unit 21 traverses all the running process lists obtained, and there is only one empty process; the priority ordering unit 22 The priority ranking rule stored in the process belongs to the process with the lowest priority, and is directly filtered by the process screening unit 23.
在本发明的第二个优选实施例中,当低内存驱动模块2被触发启动后,第一遍历单元21遍历获取的所有正在运行的进程列表中,不存在空进程,但是存在唯一1个内容提供者;按照优先级排序单元22中所存储的优先级排序规则,由于并不存在正在运行的空进程,因此该内容提供者成为优先级最低的进程,从而被进程筛选单元23筛选出。In the second preferred embodiment of the present invention, after the low memory driver module 2 is triggered to be started, the first traversal unit 21 traverses the obtained list of all running processes, there is no empty process, but there is only one content. Provider; according to the priority ranking rule stored in the prioritization unit 22, since there is no empty process running, the content provider becomes the process with the lowest priority and is filtered by the process screening unit 23.
在本发明的第三个优选实施例中,当低内存驱动模块2被触发启动后,第一遍历单元21遍历获取的所有正在运行的进程列表中,不存在空进程,不存在内容提供者,但是存在3个后台进程,并且这3个后台进程分别属于近期最大概率被重新启动的进程、近期较大概率被重新启动的进程和近期将不被重新启动的进程;按照优先级排序单元22中所存储的优先级排序规则,其中的近期将不被重新启动的进程属于优先级最低的进程,从而被进程筛选单元23筛选出。In the third preferred embodiment of the present invention, after the low memory driver module 2 is triggered to be started, the first traversal unit 21 traverses the obtained list of all running processes, there is no empty process, and there is no content provider. However, there are 3 background processes, and the 3 background processes belong to the process whose recent maximum probability is restarted, the process whose recent probability is restarted, and the process which will not be restarted in the near future; The stored prioritization rule, in which the process that will not be restarted in the near future belongs to the process with the lowest priority, is thus filtered by the process screening unit 23.
在本发明的第四个优选实施例中,当低内存驱动模块2被触发启动后,第一遍历单元21遍历获取的所有正在运行的进程列表中,不存在空进程,不存在内容提供者,但是存在3个后台进程,并且这3个后台进程均属于近期将不被重新启动的进程,此时需要根据每个进程的平均启动时长来进一步排序优先级,其中平均启动时长最短的进程,其优先级最低,将会被进程筛选单元23筛选出。当进程的平均启动时长最短时,说明该进程的启 动速度最快,暂时停止运行的话,下次重新启动时所消耗的时间最短;因此选择保留启动速度较慢的进程在后台继续运行,筛选出启动速度最快的进程查杀掉,暂时释放内存空间,即使后续用户再次启动进程,也不会导致启动时间过长,使得用户体验能够得到一定的提升。In the fourth preferred embodiment of the present invention, after the low memory driver module 2 is triggered to be started, the first traversal unit 21 traverses the list of all running processes acquired, there is no empty process, and there is no content provider. However, there are 3 background processes, and these 3 background processes belong to the process that will not be restarted in the near future. In this case, the priority is further sorted according to the average startup time of each process, and the process with the shortest average startup time is The lowest priority will be filtered by the process screening unit 23. When the average startup time of a process is the shortest, it indicates the initiation of the process. The fastest speed, temporarily stop running, the time spent on the next restart is the shortest; therefore, the process that keeps the slow start speed continues to run in the background, selects the fastest startup process to check and kill, temporarily releases the memory. Space, even if the subsequent user starts the process again, it will not cause the startup time to be too long, so that the user experience can be improved.
如图5所示,为所述的进程管理服务模块3的结构示意图,包含:包名存储单元31,与进程筛选单元23连接,获取优先级最低的进程的包名信息;第二遍历单元32,与包名存储单元31连接,当包名存储单元31获取优先级最低的进程的包名信息后,遍历当前正在运行的所有进程的进程列表,并获取进程列表中每个进程的包名信息;比较单元33,分别与包名存储单元31以及第二遍历单元32连接,将进程列表中的每个进程的包名信息分别与筛选出的优先级最低的进程的包名信息进行比较,排查出所有包名信息与优先级最低的进程相匹配的关联进程;感知判断模块34,分别与比较单元33以及包名存储单元31连接,将当前未被用户感知的关联进程的包名信息存储至包名存储单元31中,获得顽固进程簇。As shown in FIG. 5, it is a schematic structural diagram of the process management service module 3, including: a package name storage unit 31, connected to the process screening unit 23, and acquiring package name information of a process with the lowest priority; the second traversal unit 32 Connected to the package name storage unit 31, after the package name storage unit 31 acquires the package name information of the process with the lowest priority, traverses the process list of all processes currently running, and acquires the package name information of each process in the process list. The comparison unit 33 is connected to the package name storage unit 31 and the second traversal unit 32, respectively, and compares the package name information of each process in the process list with the package name information of the selected lowest priority process, and performs troubleshooting. An association process in which all the package name information matches the process with the lowest priority; the perception determination module 34 is connected to the comparison unit 33 and the package name storage unit 31, respectively, and stores the package name information of the associated process that is not currently perceived by the user to In the package name storage unit 31, a stubborn process cluster is obtained.
其中,所述的感知判断模块34判断关联进程是否被用户感知的规则为:判断该关联进程与当前正在操作状态的前台进程是否属于同一任务,若是,则认为关联进程被用户感知;否则进一步判断该关联进程是否为非操作状态的可见界面的进程,若是,则认为关联进程被用户感知;否则继续判断该关联进程是否为当前正在操作状态的不可见界面的进程,若是,则认为关联进程被用户感知,否则认为关联进程未被用户感知。The rule that the sensing determining module 34 determines whether the associated process is perceived by the user is: determining whether the associated process and the foreground process currently in the operating state belong to the same task, and if so, determining that the associated process is perceived by the user; otherwise, further determining Whether the associated process is a process of a visible interface in a non-operational state, and if so, the associated process is considered to be perceived by the user; otherwise, the process of determining whether the associated process is an invisible interface of the currently operating state is continued, and if so, the associated process is considered The user perceives, otherwise the associated process is considered not to be perceived by the user.
其中,所述的非操作状态的可见界面的进程具体可以是输入法等与用户的使用息息相关的进程。而所述的操作状态的不可见界面的进程具体可以是正在播放音乐的进程,或者正在执行下载任务的进程等,其无需在智能移动终端的界面中可视,但却是用户当前正在操作的进程。The process of the visible interface of the non-operational state may specifically be a process related to the use of the user, such as an input method. The process of the invisible interface of the operating state may specifically be a process of playing music, or a process of performing a download task, etc., which does not need to be visible in the interface of the smart mobile terminal, but is currently being operated by the user. process.
所述的进程查杀模块4与进程管理服务模块3中的包名存储单元31连接,将存储其中的所有包名信息对应的进程全部查杀,达到彻底清除顽固进程簇的目的,防止顽固进程再次启动。The process killing module 4 is connected to the package name storage unit 31 in the process management service module 3, and all the processes corresponding to all the package name information stored therein are checked and killed, so as to completely eliminate the stubborn process cluster and prevent the stubborn process. Start again.
如图6所示,本发明还提供一种基于Android系统的低内存查杀方法,基于前述的低 内存查杀系统实现,适用于手机、或平板电脑、或智能可穿戴设备(包括智能手表或智能手环)等的移动智能终端,包含以下步骤:As shown in FIG. 6, the present invention further provides a low memory killing method based on an Android system, which is based on the aforementioned low Memory killing system implementation, suitable for mobile smart devices such as mobile phones, or tablets, or smart wearable devices (including smart watches or smart bracelets), including the following steps:
S1、内存检测模块1实时检测Android系统的内存空间是否达到设定的预期值;当未达到预期值时,触发启动低内存驱动模块2,并继续执行S2;S1, the memory detection module 1 detects in real time whether the memory space of the Android system reaches the set expected value; when the expected value is not reached, triggering to start the low memory drive module 2, and continue to execute S2;
S2、低内存驱动模块2在当前所有正在运行的进程中筛选出优先级最低的进程;S2, the low memory driver module 2 screens out the lowest priority process among all currently running processes;
S3、进程管理服务模块3将优先级最低的进程与当前所有正在运行的其他进程进行匹配,排查出与该优先级最低的进程具有相关性的全部关联进程,获取顽固进程簇;S3. The process management service module 3 matches the lowest priority process with all currently running other processes, and finds all associated processes that are related to the lowest priority process to obtain a stubborn process cluster.
S4、进程查杀模块4查杀顽固进程簇所包含的所有关联进程,释放该些进程占用的内存空间,并返回执行S1。S4. The process killing module 4 kills all associated processes included in the stubborn process cluster, releases the memory space occupied by the processes, and returns to execute S1.
所述的S1中,具体包含以下步骤:The S1 includes the following steps:
S11、将预先设定的Android系统正常运行所需的内存空间的预期值预先存储于内存检测模块1中;S11. Pre-store the expected value of the memory space required for the normal operation of the Android system in the memory detecting module 1;
S12、内存检测模块1将检测到的当前Android系统的内存空间实际值,与该预先设定的预期值进行比较;S12. The memory detecting module 1 compares the detected actual value of the current memory space of the Android system with the preset expected value.
当内存空间实际值大于等于预期值,则说明Android系统当前的内存空间达到设定的预期值,即内存空间充足,返回执行S12;When the actual value of the memory space is greater than or equal to the expected value, it indicates that the current memory space of the Android system reaches the set expected value, that is, the memory space is sufficient, and the execution returns to S12;
当内存空间实际值小于预期值,则说明Android系统当前的内存空间未达到设定的预期值,即内存空间不足,继续执行S2。When the actual value of the memory space is less than the expected value, the current memory space of the Android system does not reach the set expected value, that is, the memory space is insufficient, and S2 is continued.
如图7所示,所述的S2中,具体包含以下步骤:As shown in FIG. 7, the S2 includes the following steps:
S21、优先级排序单元22存储预先设定的将进程按照优先级由高到低排序的规则;S21. The priority sorting unit 22 stores a preset rule for sorting the processes according to the priority from high to low;
S22、第一遍历单元21遍历并获取当前正在运行的所有进程的进程列表;S22. The first traversal unit 21 traverses and acquires a process list of all processes currently running.
S23、进程筛选单元23按照优先级排序单元22中存储的优先级排序规则,从第一遍历单元21获取的进程列表中,筛选得到优先级最低的进程。S23. The process screening unit 23 selects the process with the lowest priority from the process list acquired by the first traversal unit 21 according to the priority ordering rule stored in the priority sorting unit 22.
所述的S21中,将进程按照优先级由高到低排序的规则具体为:In the S21, the rules for sorting the processes according to the priority from high to low are as follows:
首先,按照Android系统将进程划分大类,并按照优先级由高到低粗排序为:前台进程、可见进程、次要进程、后台进程、内容提供者和空进程; First, according to the Android system, the process is divided into large classes and sorted according to the priority from high to low: foreground process, visible process, secondary process, background process, content provider and empty process;
然后,按照每个进程的启动次数以及每一次启动所消耗的时间,将每大类进程进一步划分小类,并按照优先级由高到低细排序为:近期最大概率被重新启动的进程、近期较大概率被重新启动的进程、以及近期不被重新启动的进程;Then, according to the number of startups of each process and the time consumed by each startup, each major class of processes is further divided into small classes, and sorted according to the priority from high to low: the process with the most recent maximum probability being restarted, and the recent Processes with a higher probability of being restarted, and processes that have not been restarted in the near future;
最后,按照每个进程的平均启动时长,将每小类进程中所包含的各个进程按照优先级由高到低精细排序,其中,平均启动时长最短的进程,其优先级最低,平均启动时长最长的进程,其优先级最高。Finally, according to the average startup time of each process, each process included in each small class process is sorted according to the priority from high to low. The process with the shortest average startup time has the lowest priority and the average startup time is the most. A long process with the highest priority.
需要说明的是,虽然本发明对于这6类进程进行了优先权由高到低的排序,但是在实际的应用过程中,其中的前台进程、可见进程和次要进程,基本上不存在(但并不绝对)被查杀的可能性,而所有的查杀对象,几乎全部集中在后台进程、内容提供者和空进程这3类进程中。It should be noted that although the present invention prioritizes the priority of these six types of processes, in the actual application process, the foreground process, the visible process, and the secondary process are basically non-existent (but It is not absolute) the possibility of being killed, and all the killing objects are concentrated in the three processes of background processes, content providers and empty processes.
其中,对每大类进程划分小类的具体方法为:Among them, the specific method for subclassing each major class of processes is:
当tavg-(tc-tn)>0且|(tavg-(tc-tn))|≤tavg-tc时,确定该进程属于近期最大概率被重新启动的进程;When t avg -(t c -t n )>0 and |(t avg -(t c -t n ))| t avg -t c , it is determined that the process belongs to a process in which the recent maximum probability is restarted;
当tavg-(tc-tn)≤0且|(tavg-(tc-tn))|≤tavg-tc时,确定该进程属于近期较大概率被重新启动的进程;When t avg -(t c -t n )≤0 and |(t avg -(t c -t n ))| ≤ t avg -t c , it is determined that the process belongs to a process in which a recent large probability is restarted;
当tavg-(tc-tn)>0且|(tavg-(tc-tn))|>tavg-tc时,确定该进程属于近期将不被重新启动的进程;When t avg -(t c -t n )>0 and |(t avg -(t c -t n ))|>t avg -t c , it is determined that the process belongs to a process that will not be restarted in the near future;
其中,tavg表示进程的平均启动时长;tc表示当前时间;tn表示进程在n次启动中距离当前时间最近一次的启动时长;n表示进程近期启动的总次数;Where t avg represents the average startup time of the process; t c represents the current time; t n represents the last startup time of the process from the current time in n starts; n represents the total number of times the process has recently started;
并且,进程的平均启动时长tavg的计算方式为:Moreover, the average startup time t avg of the process is calculated as:
Figure PCTCN2017098520-appb-000002
Figure PCTCN2017098520-appb-000002
如图7所示,所述的S3中,具体包含以下步骤:As shown in FIG. 7, the S3 includes the following steps:
S31、包名存储单元31获取优先级最低的进程的包名信息; S31. The package name storage unit 31 acquires package name information of the process with the lowest priority.
S32、第二遍历单元32遍历当前正在运行的所有进程的进程列表,并获取进程列表中每个进程的包名信息;S32. The second traversal unit 32 traverses the process list of all processes currently running, and obtains package name information of each process in the process list.
S33、比较单元33将进程列表中的每个进程的包名信息分别与筛选出的优先级最低的进程的包名信息进行比较,判断两者的包名信息是否匹配;如是,则确认该进程是与优先级最低的进程相匹配的关联进程,直至进程列表中的全部进程均排查完毕;S33. The comparing unit 33 compares the package name information of each process in the process list with the package name information of the selected lowest priority process, and determines whether the package name information of the two matches, and if yes, confirms the process. Is the associated process that matches the lowest priority process until all processes in the process list are checked.
S34、感知判断模块34判断每个关联进程是否被用户感知;如是,则将该关联进程加入白名单并放弃对其查杀清理;如否,则将该关联进程的包名信息存储至包名存储单元31中,获得顽固进程簇。S34. The perceptual judgment module 34 determines whether each associated process is perceived by the user; if yes, the associated process is added to the whitelist and discarded to clean up; if not, the package name information of the associated process is stored to the package name. In the storage unit 31, a stubborn process cluster is obtained.
所述的S34中,判断关联进程是否被用户感知的规则具体为:In the S34, the rule for determining whether the association process is perceived by the user is specifically:
S341、判断关联进程与当前正在操作状态的前台进程是否属于同一任务;若是,则确定关联进程被用户感知;若否,则继续执行S342;S341, determining whether the associated process and the foreground process of the current operating state belong to the same task; if yes, determining that the associated process is perceived by the user; if not, proceeding to S342;
S342、判断关联进程是否为非操作状态的可见界面的进程;若是,则确定关联进程被用户感知;若否,则继续执行S343;S342, determining whether the associated process is a process of the visible interface of the non-operational state; if yes, determining that the associated process is perceived by the user; if not, proceeding to S343;
S343、判断关联进程是否为当前正在操作状态的不可见界面的进程,若是,则确定关联进程被用户感知,若否,则确定关联进程未被用户感知。S343. Determine whether the associated process is a process of an invisible interface that is currently in an operating state. If yes, determine that the associated process is perceived by the user. If not, determine that the associated process is not perceived by the user.
其中,所述的非操作状态的可见界面的进程具体可以是输入法等与用户的使用息息相关的进程。而所述的操作状态的不可见界面的进程具体可以是正在播放音乐的进程,或者正在执行下载任务的进程等,其无需在智能移动终端的界面中可视,但却是用户当前正在操作的进程。The process of the visible interface of the non-operational state may specifically be a process related to the use of the user, such as an input method. The process of the invisible interface of the operating state may specifically be a process of playing music, or a process of performing a download task, etc., which does not need to be visible in the interface of the smart mobile terminal, but is currently being operated by the user. process.
在本发明的一个优选实施例中,当内存检测模块1检测到Android系统的内存空间未达到设定的预期值时,触发并启动低内存驱动模块2;该低内存驱动模块2筛选出当前所有正在运行的进程列表中的唯一1个空进程为优先级最低的进程,在经过进程管理服务模块3的排查后,未发现存在与其具有相关性的关联进程,因此进程查杀模块4将该空进程查杀清理。In a preferred embodiment of the present invention, when the memory detecting module 1 detects that the memory space of the Android system does not reach the set expected value, triggering and starting the low memory driving module 2; the low memory driving module 2 filters out all current The only one empty process in the running process list is the process with the lowest priority. After the process management service module 3 is checked, no related process has been found. Therefore, the process killing module 4 will be empty. Process killing cleanup.
但是该空进程查杀清理后,内存检测模块1检测到Android系统的内存空间仍然未达到设定的预期值,此时继续由低内存驱动模块2进行筛选,未找到空进程,未找到内容提 供者,但是找到4个后台进程,在这4个后台进程中,筛选出2个优先级低的近期将不被重新启动的进程,再在这2个进程中挑选出平均启动时长较短的进程,作为优先级最低的进程被上报至进程管理服务模块3。经该进程管理服务模块3排查后,发现若干与其具有相关性的关联进程,并且所有关联进程均未被用户感知,因此进程查杀模块4将该顽固进程簇(包括优先级最低的进程以及其所有关联进程)全部查杀清理。However, after the empty process is cleaned up, the memory detection module 1 detects that the memory space of the Android system has not reached the set expected value, and continues to be filtered by the low memory driver module 2, and no empty process is found, and no content is found. The donor, but finds 4 background processes, in which 4 low-priority processes that will not be restarted in the near future are filtered out, and then the average startup time is selected in the 2 processes. The process, which is the lowest priority process, is reported to the process management service module 3. After the process management service module 3 is checked, a number of associated processes with which correlations are found are found, and all associated processes are not perceived by the user, so the process killing module 4 includes the stubborn process cluster (including the lowest priority process and its All associated processes) are all cleaned up.
由于Android系统的内存空间仍然未达到设定的预期值,低内存驱动模块2筛选出另一个平均启动时长较长的近期将不被重新启动的后台进程为优先级最低的进程,并且经进程管理服务模块3排查后,发现1个与其具有相关性的关联进程。但是,这个关联进程经判断后确定为被用户感知,因此该关联进程被放弃查杀清理,最终进程查杀模块4只将该优先级最低的进程查杀。随后判断发现Android系统的内存空间已经达到设定的预期值,暂时将不再进行进程的查杀清理步骤。Since the memory space of the Android system still does not reach the set expected value, the low memory driver module 2 filters out another background process whose average startup time is long and will not be restarted in the near future is the lowest priority process, and is managed by the process. After the service module 3 is checked, an associated process with which it has relevance is found. However, the association process is determined to be perceived by the user after being judged, so the associated process is abandoned and killed, and the final process killing module 4 only kills the process with the lowest priority. Subsequently, it was found that the memory space of the Android system has reached the set expected value, and the process of killing and killing the process will not be performed temporarily.
综上所述,本发明所提供的基于安卓系统的低内存查杀系统和方法,通过在低内存驱动模块2以及各个进程间设置进程管理服务模块3的连接通讯通道,当触发低内存驱动模块2时,其会将准备查杀的优先级最低的进程上报至进程管理服务模块3,并且由进程管理服务模块3通过进行包名信息的匹配,排查出全部与该优先级最低的进程具有相关性的关联进程,获取顽固进程簇,从而使得进程查杀模块4能够一次性将其彻底查杀清理干净,防止顽固进程簇再次启动,有效提升内存回收的效果。其中,为了不影响用户的正常使用和体验,对于排查出的关联进程需要进行用户感知的判断,当发现其正在被用户感知时,则放弃对其进行查杀清理。In summary, the low-memory killing system and method based on the Android system provided by the present invention triggers a low-memory driver module by setting a connection communication channel of the process management service module 3 between the low-memory driver module 2 and each process. At 2 o'clock, it reports the process with the lowest priority to the process management service module 3, and the process management service module 3 matches all the processes with the lowest priority by matching the package name information. The sexual association process acquires the stubborn process cluster, so that the process killing module 4 can clean up and clean it up at one time, prevent the stubborn process cluster from starting again, and effectively improve the effect of memory recycling. In order to not affect the normal use and experience of the user, the associated process needs to be judged by the user, and when it is found that it is being perceived by the user, it is forgotten to be cleaned up.
本发明所述的基于安卓系统的低内存查杀系统和方法,与现有技术相比,具有以下优点:通过排查关联进程,彻底清除与该需要查杀的进程具有相关性的所有顽固进程簇,避免反复执行重复无效的查杀工作,并且快速有效的回收系统内存空间,使得系统卡顿问题得到及时缓解,有效提升用户体验,并且降低系统功耗。Compared with the prior art, the low memory killing system and method based on the Android system of the present invention has the following advantages: by checking the association process, completely removing all stubborn process clusters that are related to the process that needs to be killed and killed. Avoid repeated repeated invalidation and killing work, and quickly and effectively recover the system memory space, so that the system can be relieved in time, effectively improve the user experience, and reduce system power consumption.
本领域内的技术人员应明白,上述各实施例可提供为方法、装置、或计算机程序产品。这些实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。上述各实施例涉及的方法中的全部或部分步骤可以通过程序来指令相关的硬件完 成,所述的程序可以存储于计算机设备可读取的存储介质中,用于执行上述各实施例方法所述的全部或部分步骤。Those skilled in the art will appreciate that the various embodiments described above can be provided as a method, apparatus, or computer program product. These embodiments may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware aspects. All or part of the steps involved in the above embodiments may be programmed to execute related hardware. The program may be stored in a storage medium readable by the computer device for performing all or part of the steps described in the methods of the above embodiments.
上述各实施例是参照根据实施例所述的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到计算机设备的处理器以产生一个机器,使得通过计算机设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The above embodiments are described with reference to flowcharts and/or block diagrams of methods, apparatus (systems), and computer program products according to the embodiments. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a computer device to produce a machine such that instructions executed by a processor of the computer device are generated for implementing one or more blocks or processes in a flow or flow diagram and/or block diagram of the flowchart The device for the function specified in the box.
尽管本发明的内容已经通过上述优选实施例作了详细介绍,但应当认识到上述的描述不应被认为是对本发明的限制。在本领域技术人员阅读了上述内容后,对于本发明的多种修改和替代都将是显而易见的。因此,本发明的保护范围应由所附的权利要求来限定。 Although the present invention has been described in detail by the preferred embodiments thereof, it should be understood that the foregoing description should not be construed as limiting. Various modifications and alterations of the present invention will be apparent to those skilled in the art. Therefore, the scope of the invention should be defined by the appended claims.

Claims (10)

  1. 一种基于安卓系统的低内存查杀系统,其特征在于,包含:A low memory killing system based on Android system, characterized in that it comprises:
    内存检测模块,实时检测安卓系统的内存空间是否达到设定的预期值;The memory detection module detects in real time whether the memory space of the Android system reaches the set expected value;
    低内存驱动模块,与内存检测模块连接,当安卓系统的内存空间未达到设定的预期值时,在当前所有正在运行的进程中筛选出优先级最低的进程;The low memory driver module is connected to the memory detection module. When the memory space of the Android system does not reach the set expected value, the lowest priority process is selected in all currently running processes;
    进程管理服务模块,与低内存驱动模块连接,将优先级最低的进程与当前所有正在运行的其他进程进行匹配,排查出与该优先级最低的进程具有相关性的全部关联进程,获取顽固进程簇;The process management service module is connected to the low memory driver module, and matches the lowest priority process with all currently running other processes, and finds all associated processes that are related to the lowest priority process, and obtains a stubborn process cluster. ;
    进程查杀模块,与进程管理服务模块连接,查杀顽固进程簇所包含的所有关联进程,释放该些进程占用的内存空间。The process killing module is connected with the process management service module to kill all associated processes included in the stubborn process cluster and release the memory space occupied by the processes.
  2. 如权利要求1所述的基于安卓系统的低内存查杀系统,其特征在于,所述的低内存驱动模块包含:The low memory memory killing system of the Android system according to claim 1, wherein the low memory driver module comprises:
    第一遍历单元,与内存检测模块连接,当安卓系统的内存空间未达到设定的预期值时,遍历并获取当前正在运行的所有进程的进程列表;The first traversal unit is connected to the memory detecting module, and when the memory space of the Android system does not reach the set expected value, traverses and acquires a list of processes of all processes currently running;
    优先级排序单元,用于存储预先设定的将进程按照优先级由高到低排序的规则;a prioritization unit for storing a preset rule for sorting processes according to priority from high to low;
    进程筛选单元,分别与所述的第一遍历单元以及优先级排序单元连接,按照优先级排序单元中提供的优先级排序规则,从第一遍历单元获取的进程列表中,筛选得到优先级最低的进程。The process screening unit is respectively connected to the first traversal unit and the priority sorting unit, and according to the priority sorting rule provided in the prioritizing unit, the screen with the lowest priority is selected from the process list obtained by the first traversal unit. process.
  3. 如权利要求2所述的基于安卓系统的低内存查杀系统,其特征在于,所述的进程管理服务模块包含:The low memory memory killing system of the Android system according to claim 2, wherein the process management service module comprises:
    包名存储单元,与进程筛选单元连接,获取优先级最低的进程的包名信息;a package name storage unit, connected to the process screening unit, to obtain the package name information of the process with the lowest priority;
    第二遍历单元,与包名存储单元连接,遍历当前正在运行的所有进程的进程列表,并获取进程列表中每个进程的包名信息;a second traversal unit, connected to the package name storage unit, traversing the process list of all processes currently running, and obtaining package name information of each process in the process list;
    比较单元,分别与包名存储单元以及第二遍历单元连接,将进程列表中的每个进 程的包名信息分别与筛选出的优先级最低的进程的包名信息进行比较,排查出所有包名信息与优先级最低的进程相匹配的关联进程;Comparing units, respectively connected to the package name storage unit and the second traversal unit, each of the process list The package name information of the process is compared with the package name information of the selected lowest priority process, and the associated process in which all the package name information matches the process with the lowest priority is found out;
    感知判断模块,分别与比较单元以及包名存储单元连接,将当前未被用户感知的关联进程的包名信息存储至包名存储单元中,获得顽固进程簇。The sensing determination module is respectively connected to the comparison unit and the package name storage unit, and stores the package name information of the associated process that is not currently perceived by the user into the package name storage unit to obtain a stubborn process cluster.
  4. 如权利要求3所述的基于安卓系统的低内存查杀系统,其特征在于,所述的进程查杀模块与进程管理服务模块中的包名存储单元连接,将存储其中的所有包名信息对应的进程全部查杀。The Android system-based low memory killing system according to claim 3, wherein the process killing module is connected to the package name storage unit in the process management service module, and all the package name information stored therein is correspondingly The process is all killed.
  5. 一种基于安卓系统的低内存查杀方法,其特征在于,采用如权利要求1~4中任一项所述的低内存查杀系统实现,包含以下步骤:A low memory killing method based on the Android system, characterized in that the low memory killing system according to any one of claims 1 to 4 is implemented, comprising the following steps:
    S1、内存检测模块实时检测安卓系统的内存空间是否达到设定的预期值;当未达到预期值时,继续执行S2;S1, the memory detection module detects in real time whether the memory space of the Android system reaches the set expected value; when the expected value is not reached, the execution of S2 is continued;
    S2、低内存驱动模块在当前所有正在运行的进程中筛选出优先级最低的进程;S2. The low memory driver module filters out the lowest priority process among all currently running processes;
    S3、进程管理服务模块将优先级最低的进程与当前所有正在运行的其他进程进行匹配,排查出与该优先级最低的进程具有相关性的全部关联进程,获取顽固进程簇;S3. The process management service module matches the lowest priority process with all currently running other processes, and finds all associated processes that are related to the lowest priority process, and obtains a stubborn process cluster;
    S4、进程查杀模块查杀顽固进程簇所包含的所有关联进程,释放该些进程占用的内存空间,并返回执行S1。S4. The process killing module kills all associated processes included in the stubborn process cluster, releases the memory space occupied by the processes, and returns to execute S1.
  6. 如权利要求5所述的基于安卓系统的低内存查杀方法,其特征在于,所述的S1中,具体包含以下步骤:The method of claim 5, wherein the S1 includes the following steps:
    S11、将预先设定的安卓系统正常运行所需的内存空间的预期值预先存储于内存检测模块中;S11. Pre-store the expected value of the memory space required for the preset Android system to operate normally in the memory detection module;
    S12、内存检测模块将检测到的当前安卓系统的内存空间实际值,与该预先设定的预期值进行比较;当内存空间实际值大于等于预期值,返回执行S12;当内存空间实际值小于预期值,继续执行S2。S12. The memory detection module compares the detected actual memory space of the current Android system with the preset expected value; when the actual value of the memory space is greater than or equal to the expected value, the process returns to execute S12; when the actual value of the memory space is less than expected Value, continue to execute S2.
  7. 如权利要求5所述的基于安卓系统的低内存查杀方法,其特征在于,所述的S2中,具体包含以下步骤:The method of claim 5, wherein the S2 includes the following steps:
    S21、优先级排序单元存储预先设定的将进程按照优先级由高到低排序的规则; S21. The priority sorting unit stores a preset rule for sorting processes according to priority from high to low;
    S22、第一遍历单元遍历并获取当前正在运行的所有进程的进程列表;S22. The first traversal unit traverses and acquires a list of processes of all processes currently running.
    S23、进程筛选单元按照优先级排序单元中存储的优先级排序规则,从第一遍历单元获取的进程列表中,筛选得到优先级最低的进程。S23. The process screening unit selects, according to the priority ordering rule stored in the priority sorting unit, the process with the lowest priority from the process list obtained by the first traversal unit.
  8. 如权利要求7所述的基于安卓系统的低内存查杀方法,其特征在于,所述的S21中,将进程按照优先级由高到低排序的规则具体为:The low-memory-based killing method of the Android system according to claim 7, wherein in the S21, the rules for sorting the processes according to the priority from high to low are as follows:
    首先,按照安卓系统将进程划分大类,并按照优先级由高到低粗排序为:前台进程、可见进程、次要进程、后台进程、内容提供者和空进程;First, according to the Android system, the process is divided into large classes, and sorted according to the priority from high to low: foreground process, visible process, secondary process, background process, content provider and empty process;
    然后,按照每个进程的启动次数以及每一次启动所消耗的时间,将每大类进程进一步划分小类,并按照优先级由高到低细排序为:近期最大概率被重新启动的进程、近期较大概率被重新启动的进程、以及近期不被重新启动的进程;Then, according to the number of startups of each process and the time consumed by each startup, each major class of processes is further divided into small classes, and sorted according to the priority from high to low: the process with the most recent maximum probability being restarted, and the recent Processes with a higher probability of being restarted, and processes that have not been restarted in the near future;
    最后,按照每个进程的平均启动时长,将每小类进程中所包含的各个进程按照优先级由高到低精细排序,其中,平均启动时长最短的进程,其优先级最低,平均启动时长最长的进程,其优先级最高。Finally, according to the average startup time of each process, each process included in each small class process is sorted according to the priority from high to low. The process with the shortest average startup time has the lowest priority and the average startup time is the most. A long process with the highest priority.
  9. 如权利要求7所述的基于安卓系统的低内存查杀方法,其特征在于,所述的S3中,具体包含以下步骤:The method of claim 7, wherein the S3 includes the following steps:
    S31、包名存储单元获取优先级最低的进程的包名信息;S31. The package name storage unit obtains the package name information of the process with the lowest priority.
    S32、第二遍历单元遍历当前正在运行的所有进程的进程列表,并获取进程列表中每个进程的包名信息;S32. The second traversal unit traverses the process list of all processes currently running, and obtains package name information of each process in the process list.
    S33、比较单元将进程列表中的每个进程的包名信息分别与筛选出的优先级最低的进程的包名信息进行比较,判断两者的包名信息是否匹配;如是,则确认该进程是与优先级最低的进程相匹配的关联进程,直至进程列表中的全部进程均排查完毕;S33. The comparison unit compares the package name information of each process in the process list with the package name information of the selected lowest priority process, and determines whether the package name information of the two matches, and if yes, confirms that the process is The associated process that matches the lowest priority process until all processes in the process list are checked;
    S34、感知判断模块判断每个关联进程是否被用户感知;如是,则将该关联进程加入白名单并放弃对其查杀清理;如否,则将该关联进程的包名信息存储至包名存储单元中,获得顽固进程簇。S34: The perceptual judgment module determines whether each associated process is perceived by the user; if yes, the associated process is added to the whitelist and discarded to clean up; if not, the package name information of the associated process is stored in the package name storage. In the unit, get a stubborn process cluster.
  10. 如权利要求9所述的基于安卓系统的低内存查杀方法,其特征在于,所述的S34中,判断关联进程是否被用户感知的规则具体为: The low-memory-based killing method of the Android system according to claim 9, wherein in the S34, the rule for determining whether the associated process is perceived by the user is specifically:
    S341、判断关联进程与当前正在操作状态的前台进程是否属于同一任务;若是,则确定关联进程被用户感知;若否,则继续执行S342;S341, determining whether the associated process and the foreground process of the current operating state belong to the same task; if yes, determining that the associated process is perceived by the user; if not, proceeding to S342;
    S342、判断关联进程是否为非操作状态的可见界面的进程;若是,则确定关联进程被用户感知;若否,则继续执行S343;S342, determining whether the associated process is a process of the visible interface of the non-operational state; if yes, determining that the associated process is perceived by the user; if not, proceeding to S343;
    S343、判断关联进程是否为当前正在操作状态的不可见界面的进程,若是,则确定关联进程被用户感知,若否,则确定关联进程未被用户感知。 S343. Determine whether the associated process is a process of an invisible interface that is currently in an operating state. If yes, determine that the associated process is perceived by the user. If not, determine that the associated process is not perceived by the user.
PCT/CN2017/098520 2017-08-22 2017-08-22 Android system-based low memory killer system and method WO2019036906A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/098520 WO2019036906A1 (en) 2017-08-22 2017-08-22 Android system-based low memory killer system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/098520 WO2019036906A1 (en) 2017-08-22 2017-08-22 Android system-based low memory killer system and method

Publications (1)

Publication Number Publication Date
WO2019036906A1 true WO2019036906A1 (en) 2019-02-28

Family

ID=65439363

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/098520 WO2019036906A1 (en) 2017-08-22 2017-08-22 Android system-based low memory killer system and method

Country Status (1)

Country Link
WO (1) WO2019036906A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103544063A (en) * 2013-09-30 2014-01-29 三星电子(中国)研发中心 Method and device for removing processes applied to Android platform
CN104391743A (en) * 2014-11-26 2015-03-04 北京奇虎科技有限公司 Method and device for optimizing running speed of mobile terminal
CN104503841A (en) * 2014-12-15 2015-04-08 北京奇虎科技有限公司 Process clearing method and process clearing device
US20150347181A1 (en) * 2014-05-30 2015-12-03 Apple Inc. Resource management with dynamic resource policies

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103544063A (en) * 2013-09-30 2014-01-29 三星电子(中国)研发中心 Method and device for removing processes applied to Android platform
US20150347181A1 (en) * 2014-05-30 2015-12-03 Apple Inc. Resource management with dynamic resource policies
CN104391743A (en) * 2014-11-26 2015-03-04 北京奇虎科技有限公司 Method and device for optimizing running speed of mobile terminal
CN104503841A (en) * 2014-12-15 2015-04-08 北京奇虎科技有限公司 Process clearing method and process clearing device

Similar Documents

Publication Publication Date Title
CN106354562B (en) Memory cleaning system and memory cleaning method
CN109213539B (en) Memory recovery method and device
CN103164268B (en) System optimization method and device
CN107526640B (en) Resource management method, resource management device, mobile terminal and computer-readable storage medium
US9164748B2 (en) Information backup method and apparatus
WO2017211226A1 (en) Method for displaying media file, terminal, and storage medium
CN103092700A (en) Internal memory cleaning method and cleaning device and terminal device
CN103699420A (en) System recovery method and system recovery device
EP1589432A2 (en) Information processor capable of using past processing space
CN106445604A (en) Clearing method and device for applications
CN111258921A (en) Method and device for recycling garbage memory, electronic equipment and storage medium
CN108804207A (en) A kind of process management-control method based on android system
TW201621623A (en) System, method and terminal for cleaning memory
CN107615250A (en) A kind of processing method, device and intelligent terminal for application
CN109117263B (en) Method and device for releasing memory of user terminal
CN112650575A (en) Resource scheduling method and device and cloud service system
CN110737606B (en) Memory recovery processing method and device, electronic equipment and storage medium
WO2017185263A1 (en) Memory reclaiming method and apparatus
CN110162563A (en) A kind of data storage method, system and electronic equipment and storage medium
WO2019036906A1 (en) Android system-based low memory killer system and method
CN112307381A (en) Page loading method and device, storage medium and electronic equipment
CN111221650A (en) System resource recovery method and device based on process type association
CN104834553A (en) Service concurrent processing method for user terminal and user terminal
JP5801517B2 (en) Task processing method and apparatus
CN110532095B (en) Memory optimization method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17922459

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17922459

Country of ref document: EP

Kind code of ref document: A1