WO2012159394A1 - Method and apparatus for managing mobile device memory - Google Patents
Method and apparatus for managing mobile device memory Download PDFInfo
- Publication number
- WO2012159394A1 WO2012159394A1 PCT/CN2011/079602 CN2011079602W WO2012159394A1 WO 2012159394 A1 WO2012159394 A1 WO 2012159394A1 CN 2011079602 W CN2011079602 W CN 2011079602W WO 2012159394 A1 WO2012159394 A1 WO 2012159394A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- application
- memory
- exchanged
- predetermined algorithm
- specified
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0604—Improving or facilitating administration, e.g. storage management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0629—Configuration or reconfiguration of storage systems
- G06F3/0634—Configuration or reconfiguration of storage systems by changing the state or mode of one or more devices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/60—Subscription-based services using application servers or record carriers, e.g. SIM application toolkits
Definitions
- the present invention relates to memory management, and in particular, to a mobile device memory management method and apparatus. Background technique
- Mobile devices such as mobile phones use multi-tasking operating systems and can run multiple tasks at the same time.
- mobile devices such as mobile phones are equipped with large-capacity memory.
- the increase in memory capacity is limited by cost, power consumption, volume, and the like. Therefore, how to reduce memory usage in multitasking becomes an urgent problem to be solved.
- Memory swap is a widely used method for reducing memory usage on PCs and servers. Its basic principle is: When the system is out of memory, some content in the memory is exchanged to the external memory to free up the memory space; when the system needs to run to the content that is exchanged to the external storage, it is exchanged to the external memory. The contents of the content are swapped into memory again; if there is insufficient memory in the process, another exchange process will be involved. Thus, the effective memory space of the system is the sum of the actual memory size plus the space on the external storage that can be used to store the exchanged content. With memory swapping, you can achieve more memory with less memory.
- the memory exchange method on PCs and servers is basically implemented as a basic function of the operating system (ie, virtual memory management) in the kernel of the operating system, which uses the LRU (Least Recently Use) algorithm.
- the content that has not been used for the longest time is preferentially exchanged and exchanged in the smallest unit of memory pages.
- the memory page is the basic unit of operating system management memory.
- the size of a memory page of a 32-bit Linux operating system is generally 4 KB.
- the main technical problem to be solved by the present invention is to provide a method and device for memory management in a mobile device, which reduces the memory usage through memory exchange while minimizing the user experience.
- a mobile device memory management method including: searching for at least one application that is not dependent on a specified application and conforms to a predetermined algorithm as an application to be exchanged; according to the to-be-exchanged The application performs memory swap processing.
- the step of searching for at least one application that is not dependent on the specified application and conforms to the predetermined algorithm as the application to be exchanged includes: searching for an application that conforms to the predetermined algorithm from the currently running application; The application that meets the predetermined algorithm finds an application that has no dependencies on the specified application and uses it as the application to be exchanged.
- the step of performing a memory swap process according to the application to be exchanged includes: selecting an application to be exchanged, and matching a memory page of the process corresponding to the predetermined algorithm in the process corresponding to the selected application Switching to the external memory; determining whether the sum of the amount of memory occupied by the swapped memory page and the current available memory amount of the system is greater than or equal to a preset threshold; if not, proceeding to select one of the applications to be exchanged One step.
- the step of performing a memory swap process according to the application to be exchanged includes: selecting one of the applications to be exchanged, marking the selected application; determining that the marked application corresponds to Whether the sum of the amount of memory occupied by the memory page that meets the predetermined algorithm in the process and the current amount of available memory of the system is greater than or equal to a preset threshold; if not, proceeding to perform the step of selecting one of the applications to be exchanged; , the memory pages that meet the predetermined algorithm in the processes corresponding to all the marked applications are exchanged into the external memory.
- the page of performing memory swap processing is exchanged to the external memory according to the application to be exchanged.
- the method further includes: determining whether the current available memory amount of the system is greater than or equal to Setting a threshold; if less than the preset threshold, performing the searching for an application that is not dependent on the specified application and conforming to the predetermined algorithm as an application step to be exchanged; otherwise, no processing is performed.
- the application that conforms to the predetermined algorithm includes an application that the memory page to which the process corresponding to the application belongs is least recently used by the CPU.
- a mobile device memory management apparatus including: an application management and control module, configured to search for at least one application that is not dependent on a specified application and conforms to a predetermined algorithm as to be exchanged
- the memory switching module is configured to exchange, according to the indication of the application management and control module, a memory page that meets a predetermined algorithm in a process corresponding to the application to be exchanged into the external memory.
- the application program conforming to the predetermined algorithm includes an application program whose memory page belongs to the process corresponding to the application is least used by the CPU.
- the invention has the beneficial effects that: in the memory exchange, both the application to be exchanged according to a predetermined algorithm is considered, and the dependency between the applications is taken into consideration, thereby eliminating invalid memory exchange and improving the user experience of using the device. sense.
- the relationship between the number of memory pages exchanged at a time and the current maximum memory usage of the system is also considered, thereby solving the problem of too frequent memory exchange and reducing the frequency of memory exchange; in another embodiment, before starting the program
- the memory exchange is completed to ensure that there is no memory exchange during the running of the application, thus eliminating the impact of memory swapping on the running process of the application.
- FIG. 1 is a schematic structural diagram of a mobile device memory management apparatus according to an embodiment of the present invention
- FIG. 2 is a schematic flowchart of a mobile device memory management method according to an embodiment of the present invention
- FIG. 3 is a flow chart of a mobile device memory management method according to Embodiment 2 of the present invention
- FIG. 4 is a schematic flowchart of a memory management method for a mobile device according to Embodiment 3 of the present invention
- FIG. 5 is a schematic flowchart of a method for managing a memory of a mobile device according to Embodiment 4 of the present invention
- FIG. 7 is a schematic flowchart of a method for managing a memory of a mobile device according to Embodiment 6 of the present invention
- FIG. 8 is a schematic structural diagram of a memory management device applied to an Android mobile phone according to an embodiment of the present invention
- FIG. 9 is a schematic flowchart of a memory management method in an Android mobile phone corresponding to FIG. 8. detailed description
- the design idea of the embodiment of the present invention is: 1) When selecting a memory page to be exchanged, consider using a predetermined algorithm to select an application, and also considering whether an application to be run may use the selected application, and only satisfy The memory pages of the two conditions (the memory page conforms to the predetermined algorithm and the application corresponding to the memory page has no dependencies on the application to be run) are selected and exchanged; 2) the number of memory pages exchanged is equal to the number of memory pages to be run. The maximum possible memory usage of the application; 3) The memory swap is completed before starting the application that will run.
- the idea point 1) eliminates the invalid memory exchange
- the idea point 2) reduces the memory exchange frequency to only 1 time
- the thought point 3) guarantees that there is no memory exchange during the application running, thus eliminating the memory exchange on the application running process Excuse me.
- a memory management device in a mobile device includes: an application management and control module and a memory switching module.
- the application management and control module is configured to search for at least one application that is not dependent on the specified application and meets a predetermined algorithm as the application to be exchanged; and the memory switching module is configured to manage and control according to the application.
- the page is swapped to the external memory.
- the memory is RAM (random access memory) and the external memory is FLASH.
- An embodiment of the present invention provides a memory management method based on the foregoing memory management apparatus, including: searching for at least one application that is not dependent on a specified application and conforms to a predetermined algorithm as an application to be exchanged; according to the application to be exchanged Perform memory swap processing.
- the predetermined algorithm adopts a least recently used (LRU) algorithm, that is, in this embodiment, the application that conforms to the predetermined algorithm is within the process to which the application corresponds.
- LRU least recently used
- An application that has been recently used by the CPU at least is stored; other algorithms may be used in other embodiments, and the present invention is not limited to the LRU.
- the step of searching for at least one application that is not dependent on the specified application and conforms to the predetermined algorithm as the application to be exchanged includes: searching for an application that conforms to the predetermined algorithm from the currently running application Find an application that is not dependent on the specified application from the found application that matches the predetermined algorithm, and use it as the application to be exchanged.
- an exemplary method is: finding an application that conforms to a predetermined algorithm; determining whether there is a dependency between the found application and the specified application; if there is a dependency, re-finding the next one that meets the predetermined schedule Algorithm application.
- the step includes: exchanging, in a memory corresponding to the predetermined algorithm, a memory page of the process corresponding to the application to be exchanged into the external memory.
- the step includes: selecting an application to be exchanged, exchanging a memory page of the process corresponding to the selected application into a foreign memory; and determining the exchanged Whether the sum of the amount of memory occupied by the memory page and the current amount of available memory of the system is greater than or equal to a preset threshold; if not, the step of selecting one of the applications to be exchanged is continued.
- the embodiment may be optimized, that is, the step includes: selecting one of the applications to be exchanged, marking the selected application; determining that the marked application corresponds to the process Whether the sum of the amount of memory occupied by the memory page of the predetermined algorithm and the current amount of available memory of the system is greater than or equal to a preset threshold; if not, proceeding to perform the step of selecting one of the applications to be exchanged; if yes, The memory pages of the corresponding processes in all the marked applications are exchanged into the external memory.
- the preset threshold is an experimental value
- the preset threshold in the embodiment is the amount of memory required to run when any one of the mobile devices is running.
- the lookup has no dependencies on the specified application and is in accordance with a predetermined calculation.
- the method further includes: determining whether the current available memory amount of the system is greater than or equal to a preset threshold; if less than the preset threshold, performing the searching and specifying The application has no dependencies and the application conforming to the predetermined algorithm acts as the application step to be exchanged; otherwise it is not processed.
- the preset threshold is an experimental value
- the preset threshold in the embodiment is an amount of memory required to satisfy any one of the applications in the mobile device.
- the method further comprises: executing a normal application startup process to start the specified application.
- the mobile device memory management method is described in detail below through several embodiments and in conjunction with FIGS. 2-9.
- the predetermined algorithm uniformly used in the following embodiments is the foregoing LRU algorithm, that is, the least recently used algorithm by the CPU; it should be understood that other embodiments of the present invention may be used, and are not limited to the LRU algorithm.
- this embodiment includes the following steps:
- Step S201 Find an APP according to a predetermined algorithm
- the LRU algorithm is used to find an application (APP), that is, in the currently running application list, the application that belongs to the application corresponding to the process belongs to the least recently used CPU; it can be understood that the currently running application is not necessarily being The application that occupies the CPU, but the application that the operating system created the process for this application;
- Step S202 determining whether the specified application depends on the component of the found application (APP), where the specified application refers to an application other than the currently running application, and an application to be run;
- APP found application
- step S201 If the specified application has a dependency relationship with the application (APP), the application (APP) is excluded, and the process proceeds to step S201 to find the next application that conforms to the LRU algorithm; Excluding an application (APP) means that the memory page to which the process corresponding to the application (APP) belongs is not a memory page that can be exchanged; Step S203: performing memory exchange, specifically, finding the LRU algorithm that matches the search.
- the memory page to which the process corresponding to the application (APP) belongs is used as a memory page that can be exchanged, and is exchanged into the external memory; wherein, the memory page exchanged refers to a process corresponding to the predetermined algorithm in the process corresponding to the application.
- Step S204 The memory exchange process ends.
- This embodiment considers both the advantages of the LRU algorithm and the dependencies of components between applications. Only memory pages that satisfy both conditions are selected for exchange, thereby eliminating invalid memory swapping.
- this embodiment includes the following steps:
- Step S301 The same as step S201 of the first embodiment, that is, searching for an application (APP) conforming to the LRU algorithm in the currently running application list;
- APP application
- Step S302 Determine whether the specified application depends on the component of the found application (APP). Similarly, the specified application here is an application other than the currently running application. If there is a dependency relationship, the application (APP) is excluded, and the process goes to step S301 to find the next application that conforms to the LRU algorithm; if there is no dependency, the process goes to step S303; step S303: the matching plan obtained in step S302 is met.
- the memory page to which the process corresponding to the algorithm and the application corresponding to the dependency does not belong is a memory page that can be exchanged, and the memory exchange module is notified to exchange the memory pages into the external memory; wherein the memory page exchanged refers to the application. a memory page that conforms to a predetermined algorithm among processes corresponding to the program;
- Step S304 adding the current available memory amount of the system to the amount of memory exchanged in step S303, and determining whether the sum of the two is greater than or equal to a preset threshold; where the preset threshold value is as described above, If the sum of the two is greater than or equal to the preset threshold, go to step S305; otherwise, go to step S301 to find the next application that conforms to the LRU algorithm;
- Step S305 The memory exchange process ends.
- This embodiment not only considers the advantages of the LRU algorithm but also considers the dependency relationship of components between applications, and also considers that the amount of memory for memory swapping must satisfy the maximum amount of memory that may be used, thereby eliminating invalid memory swaps; When the amount of memory exchanged for memory meets the maximum amount of memory that can be used, memory swapping is no longer performed, thereby reducing the switching frequency.
- this embodiment includes the following steps:
- Step S401 The same as step S201 of the first embodiment, that is, the application (APP) conforming to the LRU algorithm in the currently running application list.
- APP application conforming to the LRU algorithm in the currently running application list.
- Step S402 Determine whether the specified application depends on the component of the found application (APP). Similarly, the specified application here is an application other than the currently running application. If there is a dependency, the application (APP) is excluded, and step S401 is performed to find the next application that conforms to the LRU algorithm; if there is no dependency, then step S403 is performed; Step S403: marking the matching order obtained in step S402 An application that has an algorithm and does not have a dependency;
- Step S404 The amount of available memory of the system is added to the amount of memory occupied by the memory page that meets the predetermined algorithm in the process corresponding to the application marked in step S403, and it is determined whether the sum of the two is greater than or equal to a preset threshold.
- the preset threshold is an experimental value.
- the preset threshold is a quantity that can satisfy the running time of any application in the mobile device; wherein, the memory page that is exchanged refers to the process corresponding to the application. a memory page of a predetermined algorithm;
- Step S405 The memory pages that meet the predetermined algorithm in the processes corresponding to the respective marked applications are used as memory pages that can be exchanged, and notify the memory switching module to exchange the memory pages into the external memory;
- Step S406 The memory exchange process ends.
- this embodiment considers not only the advantages of the LRU algorithm but also the dependencies of components between applications, and also considers that the amount of memory to be exchanged once for memory must satisfy the maximum amount of memory that can be used, and only three of them are simultaneously satisfied. Conditional memory pages are selected for swapping out, thereby eliminating invalid memory swaps and reducing the switching frequency to only one.
- This embodiment is actually an optimization of the execution of the second embodiment. After all the applications that need to be exchanged are found out through the loop, the memory pages that meet the predetermined algorithm in the processes corresponding to the applications are collectively exchanged to the external memory. Medium, thereby optimizing the efficiency of execution.
- this embodiment includes the following steps:
- Step S501 Determine whether the current memory available amount of the system is greater than or equal to a preset threshold. If yes, go to step S505; otherwise, go to step S502;
- the preset threshold value is as described above, and is not described here;
- Steps S502, S503, S504, and S505 are the same as steps S201, S202, S203, and S204 in the first embodiment, and are not described here.
- the current memory available amount of the system is first considered, and then the memory exchange method as in the first embodiment is performed, thereby further eliminating the invalid memory exchange.
- the embodiment includes the following steps:
- Step S601 determining whether the current memory available amount of the system is greater than or equal to a preset threshold, and if yes, proceeding to step S606; otherwise, proceeding to step S602;
- Steps S602, S603, S604, S605, and S606 are respectively performed in step S301 in the second embodiment.
- S302, S303, S304, and S305 are the same, and are not described here.
- the current memory available amount of the system is first considered, and then the memory exchange method as in the second embodiment is performed, thereby further eliminating the invalid memory exchange.
- Step S701 determining whether the current memory available amount of the system is greater than or equal to a preset threshold, and if yes, proceeding to step S707; otherwise, proceeding to step S702;
- Steps S702 to S707 are the same as steps S401 to S406 of the third embodiment, and are not described herein again.
- the current memory available amount of the system is first considered, and then the memory exchange method as in the third embodiment is performed, thereby further eliminating the invalid memory exchange.
- the memory exchange process as in the above embodiments is executed, and the specified application is executed after the memory exchange is completed. This approach not only eliminates invalid memory swaps, but also ensures that there is no memory swapping during application running, thus eliminating the memory swapping process that is bothering the application.
- the memory switching module is responsible for exchanging the contents of the specified memory page into the external memory, and exchanging the contents of the memory page in the external memory.
- the application management and control module is responsible for selecting the memory page to be exchanged and deciding to swap the memory page.
- the application management and control module only controls the exchange, and the exchange of the exchanged content is automatically done by the memory exchange module (this function is caused by the missing page of the operating system kernel).
- one module can correspond to one independent software module entity (such as function, class, process, thread, etc.), or multiple modules can correspond to one software module entity, or one module corresponds to multiple software module entities.
- the mobile phone memory management method provided by an embodiment of the present invention is further described below by taking an Android mobile phone as an example.
- the Android mobile phone adopts Linux operating system technology and Java technology, which makes the operation of the Android mobile phone very sensitive to the memory size.
- the memory ratio is small, the Android phone will run very slowly. For this reason, Android phones are basically equipped with large-capacity memory.
- the application management and control module consists of two classes: ActivityManagerService and PackageManageService.
- the memory swap module consists of virtual storage management modules in the Linux operating system kernel.
- communication between the application management and control module and the memory switch module is accomplished using the virtual device driver, MMUDriver.
- this example contains the following steps:
- Step S901 ActivityManagerService opens MMUDriver and prepares for memory exchange processing.
- Step S902 The ActivityManagerService checks whether the amount of memory currently available to the system is greater than or equal to a preset threshold. If yes, go to step S909; otherwise, go to step S903.
- the preset threshold is determined experimentally, in principle, to satisfy the amount of memory required for any application running on the mobile phone;
- Step S903 The ActivityManagerService finds an application that conforms to the LRU algorithm from the list of currently running applications;
- Step S904 The ActivityManagerService checks the description information of the current application to be started through the PackageManagerService, and looks at the external application component that it depends on, and can describe the information through the Intent method, and further convert the information into the application name to be relied upon;
- Step S905 The ActivityManagerService queries the currently running application list, sorts the table according to the principle of the LRU algorithm (referred to as an LRU table), and selects the first application that is not in step S904 from the LRU table (that is, Some memory pages to which the application corresponds to the process are most recently used by the CPU and their components are not dependent on) as the application to be exchanged;
- Step S906 The ActivityManagerService sends the process number (PID) corresponding to the application selected in step S905 to the MMUDriver driver in the manner of writing the MMUDriver, and then waits for the MMUDriver driver to return the processing result by reading the MMUDriver driver;
- Step S907 MMUDriver After receiving the process ID sent by ActivityManagerService in step S906, the driver calls the function of the Linux kernel with the process number, so that the virtual storage management module of the kernel exchanges the content of the memory page occupied by the process according to the predetermined algorithm into the external memory. After completing this operation, the MMUDriver driver writes back a status value to the upper layer;
- Step S908 ActivityManagerService in step S906 - waiting for the return result of the MMUDriver driver, when the result feedback, the ActivityManagerService cancels the wait, reads the status value of the MMUDriver drive write back, and continues to perform the following operations: Check whether the current free memory of the system is If the value is greater than or equal to the preset threshold, if yes, go to step S909; otherwise, exclude the application just swapped out from the LRU table, go to step S903;
- Step S909 The execution application is started, and the process ends.
- the ActivityManagerService can first loop through all the applications that need to be exchanged, and then notify the MMUDriver driver to exchange the memory pages of the processes corresponding to the predetermined algorithms into the processes corresponding to the predetermined algorithms. In the outer memory.
- the embodiment of the present invention reduces the invalid memory exchange by improving the traditional memory exchange method, and reduces the influence of the traditional memory exchange method on the smoothness of the application running, thereby using the memory on the mobile device such as a mobile phone.
- the amount is reduced without affecting the user body Test.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Software Systems (AREA)
- Stored Programmes (AREA)
Abstract
A method and apparatus for managing a mobile device memory. The method comprises: searching for at least one application being independent from an appointed application and conforming to a predetermined algorithm; using the found application as an application to be exchanged; and performing memory exchange according to the application to be exchanged. While the memory exchange is performed, this solution not only considers the search for the predetermined algorithm of the application to be exchanged, but also considers the dependence between applications. This solution eliminates ineffective memory exchange and improves the user experience of using a device.
Description
一种移动设备内存管理方法及装置 技术领域 Mobile device memory management method and device
本发明涉及内存管理, 尤其涉及一种移动设备内存管理方法及装置。 背景技术 The present invention relates to memory management, and in particular, to a mobile device memory management method and apparatus. Background technique
随着 3G和智能机时代的来临, 手机等移动设备上的应用程序越来越 多, 这类手机等移动设备采用多任务的操作系统, 可以同时运行多个任务。 为了提高多任务的用户体验, 手机等移动设备配备了大容量内存。 但是, 内存容量的增加受到成本、 功耗、 体积等的限制。 因此, 如何在多任务情 况下降低内存使用量成为亟待解决的问题。 With the advent of 3G and smart phones, there are more and more applications on mobile devices such as mobile phones. Mobile devices such as mobile phones use multi-tasking operating systems and can run multiple tasks at the same time. In order to improve the multi-tasking user experience, mobile devices such as mobile phones are equipped with large-capacity memory. However, the increase in memory capacity is limited by cost, power consumption, volume, and the like. Therefore, how to reduce memory usage in multitasking becomes an urgent problem to be solved.
内存交换是在 PC机和服务器上广泛使用的一种用来降低内存使用量 的方法。 它的基本原理是: 当系统内存不足时, 把内存中的一些内容交换 到外存中, 从而腾出内存空间; 当系统需要运行到被交换到外存的内容时, 就把交换到外存中的内容再次交换到内存中; 在这个过程中如果发生内存 不足, 就会涉及到另一次交换过程。 这样, 系统的有效内存空间大小就是 实际内存大小加上外存上可以用来存放交换内容的空间之和。 通过内存交 换, 可以实现用较少的内存达到更大内存的效果。 目前, PC机和服务器上 的内存交换方法基本上是作为操作系统的一个基本功能(即虚拟存储器管 理)模块在操作系统的内核中实现, 其使用 LRU ( Least Recently Use, 最 近最少使用) 算法, 将最近最长时间不使用的内容优先交换出去, 并以内 存页为最小单位进行交换。 内存页是操作系统管理内存的基本单位, 32位 的 Linux操作系统的一个内存页的大小一般为 4KB。 Memory swap is a widely used method for reducing memory usage on PCs and servers. Its basic principle is: When the system is out of memory, some content in the memory is exchanged to the external memory to free up the memory space; when the system needs to run to the content that is exchanged to the external storage, it is exchanged to the external memory. The contents of the content are swapped into memory again; if there is insufficient memory in the process, another exchange process will be involved. Thus, the effective memory space of the system is the sum of the actual memory size plus the space on the external storage that can be used to store the exchanged content. With memory swapping, you can achieve more memory with less memory. Currently, the memory exchange method on PCs and servers is basically implemented as a basic function of the operating system (ie, virtual memory management) in the kernel of the operating system, which uses the LRU (Least Recently Use) algorithm. The content that has not been used for the longest time is preferentially exchanged and exchanged in the smallest unit of memory pages. The memory page is the basic unit of operating system management memory. The size of a memory page of a 32-bit Linux operating system is generally 4 KB.
然而, PC机和服务器上使用的内存交换方式存在以下问题: However, the memory exchange methods used on PCs and servers have the following problems:
1 ) 当把最近最长时间不使用的内存页交换出去时, 有可能发生当前要
运行的应用程序就要使用刚被交换出去的内存页, 于是这部分被交换出去 的内存页中的内容又马上要交换到内存中来; 应当理解, 本文中所指的交 换内存页是指交换内存页中的内容; 1) When swapping out memory pages that have not been used for the longest time, it is possible that the current The running application will use the memory page that has just been swapped out, so the contents of the memory page that is partially exchanged are immediately exchanged into the memory; it should be understood that the swap memory page referred to in this document refers to the exchange. The contents of the memory page;
2 ) 为了提高内存使用率, 操作系统每次会选择尽可能少交换内存页, 于是当前要运行的应用程序在正常运行过程中可能又会发生内存不足的情 况, 于是系统又会进行内存交换, 以便让应用程序能够正常运行下去。 2) In order to improve the memory usage, the operating system will choose to exchange memory pages as little as possible every time. Therefore, the currently running application may run out of memory during normal operation, and the system will perform memory swapping. In order to let the application run normally.
这两个问题导致无效的内存交换和内存交换过于频繁, 而且, 在进行 内存交换时, 系统不能执行任何其它的操作。 因此, 过多和频繁的内存交 换就会使应用程序运行变慢, 运行不流畅, 运行过程中时不时出现短促的 停顿, 这会极大降低用户体验。 PC机和服务器由于 CPU性能强劲, 这种 运行变慢和运行不流畅对用户体验的影响相对轻微, 而手机等移动设备的 CPU性能相对较弱,运行变慢和运行不流畅对用户体验的影响就会很明显, 从而导致用户体验变得很差。 正是由于这个原因, 在手机等移动设备上都 没有使用内存交换来降低内存使用量。 发明内容 These two problems cause invalid memory swaps and memory swaps to be too frequent, and the system cannot perform any other operations while memory swapping is in progress. As a result, excessive and frequent memory swaps can slow down applications, run unsmoothly, and cause short pauses from time to time, which can greatly reduce the user experience. Due to the strong CPU performance of PCs and servers, this slower operation and less smooth operation have a relatively minor impact on the user experience, while the CPU performance of mobile devices such as mobile phones is relatively weak, slower and less fluent on the user experience. It will be obvious, resulting in a poor user experience. For this reason, memory swapping is not used on mobile devices such as mobile phones to reduce memory usage. Summary of the invention
本发明要解决的主要技术问题是, 提供一种移动设备中内存管理的方 法及装置, 在通过内存交换降低内存使用量的同时, 尽量不影响用户体验。 The main technical problem to be solved by the present invention is to provide a method and device for memory management in a mobile device, which reduces the memory usage through memory exchange while minimizing the user experience.
根据本发明的一种实施方式, 提供一种移动设备内存管理方法, 包括: 查找与指定应用程序无依赖关系且符合预定算法的至少一个应用程序作为 待交换的应用程序; 根据所述待交换的应用程序执行内存交换处理。 According to an embodiment of the present invention, a mobile device memory management method is provided, including: searching for at least one application that is not dependent on a specified application and conforms to a predetermined algorithm as an application to be exchanged; according to the to-be-exchanged The application performs memory swap processing.
进一步地, 所述查找与指定应用程序无依赖关系且符合预定算法的至 少一个应用程序作为待交换的应用程序这一步驟包括: 从当前运行的应用 程序中查找符合预定算法的应用程序; 从查找到的符合预定算法的应用程 序中查找与指定应用程序无依赖关系的应用程序, 将其作为待交换的应用 程序。
一种实施例中, 根据所述待交换的应用程序执行内存交换处理这一步 驟包括: 选中一个所述待交换的应用程序, 将该选中的应用程序所对应的 进程中符合预定算法的内存页交换到外存中; 判断被交换出去的内存页所 占的内存量与系统当前的可用内存量之和是否大于等于预设阈值; 如果不 是, 则继续执行选中一个所述待交换的应用程序这一步驟。 Further, the step of searching for at least one application that is not dependent on the specified application and conforms to the predetermined algorithm as the application to be exchanged includes: searching for an application that conforms to the predetermined algorithm from the currently running application; The application that meets the predetermined algorithm finds an application that has no dependencies on the specified application and uses it as the application to be exchanged. In an embodiment, the step of performing a memory swap process according to the application to be exchanged includes: selecting an application to be exchanged, and matching a memory page of the process corresponding to the predetermined algorithm in the process corresponding to the selected application Switching to the external memory; determining whether the sum of the amount of memory occupied by the swapped memory page and the current available memory amount of the system is greater than or equal to a preset threshold; if not, proceeding to select one of the applications to be exchanged One step.
另一种实施例中, 根据所述待交换的应用程序执行内存交换处理这一 步驟包括: 选中一个所述待交换的应用程序, 标记该选中的应用程序; 判 断该标记的应用程序所对应的进程中符合预定算法的内存页所占的内存量 与系统当前的可用内存量之和是否大于等于预设阈值; 如果不是, 则继续 执行选中一个所述待交换的应用程序这一步驟; 如果是, 则将所有标记的 应用程序各自对应的进程中符合预定算法的内存页交换到外存中。 In another embodiment, the step of performing a memory swap process according to the application to be exchanged includes: selecting one of the applications to be exchanged, marking the selected application; determining that the marked application corresponds to Whether the sum of the amount of memory occupied by the memory page that meets the predetermined algorithm in the process and the current amount of available memory of the system is greater than or equal to a preset threshold; if not, proceeding to perform the step of selecting one of the applications to be exchanged; , the memory pages that meet the predetermined algorithm in the processes corresponding to all the marked applications are exchanged into the external memory.
又一种实施例中, 根据所述待交换的应用程序执行内存交换处理这一 页交换到外存中。 In still another embodiment, the page of performing memory swap processing is exchanged to the external memory according to the application to be exchanged.
优选地, 在所述查找与指定应用程序无依赖关系且符合预定算法的至 少一个应用程序作为待交换的应用程序这一步驟之前, 所述还包括: 判断 系统当前的可用内存量是否大于等于预设阈值; 若小于所述预设阈值, 则 执行所述查找与指定应用程序无依赖关系且符合预定算法的应用程序作为 待交换的应用程序步驟; 否则不作处理。 Preferably, before the step of searching for at least one application that is not dependent on the specified application and conforms to the predetermined algorithm as the application to be exchanged, the method further includes: determining whether the current available memory amount of the system is greater than or equal to Setting a threshold; if less than the preset threshold, performing the searching for an application that is not dependent on the specified application and conforming to the predetermined algorithm as an application step to be exchanged; otherwise, no processing is performed.
优选地, 所述符合预定算法的应用程序包括应用程序对应的进程所属 的内存页最近最少被 CPU使用的应用程序。 Preferably, the application that conforms to the predetermined algorithm includes an application that the memory page to which the process corresponding to the application belongs is least recently used by the CPU.
优选地, 在根据所述待交换的应用程序执行内存交换处理这一步驟之 后, 所述方法还包括: 执行正常的应用程序启动流程启动所述指定应用程 序。
根据本发明的另一种实施方式, 提供一种移动设备内存管理装置, 包 括: 应用管理与控制模块, 用于查找与指定应用程序无依赖关系且符合预 定算法的至少一个应用程序作为待交换的应用程序; 内存交换模块, 用于 根据所述应用管理与控制模块的指示, 将所述待交换的应用程序所对应的 进程中符合预定算法的内存页交换到外存中。 Preferably, after the step of performing the memory swap process according to the application to be exchanged, the method further comprises: executing a normal application startup process to start the specified application. According to another embodiment of the present invention, a mobile device memory management apparatus is provided, including: an application management and control module, configured to search for at least one application that is not dependent on a specified application and conforms to a predetermined algorithm as to be exchanged The memory switching module is configured to exchange, according to the indication of the application management and control module, a memory page that meets a predetermined algorithm in a process corresponding to the application to be exchanged into the external memory.
进一步地, 所述符合预定算法的应用程序包括应用程序对应的进程所 属的内存页最近最少被 CPU使用的应用程序。 Further, the application program conforming to the predetermined algorithm includes an application program whose memory page belongs to the process corresponding to the application is least used by the CPU.
本发明的有益效果在于: 在进行内存交换时既考虑了按预定算法查找 待交换的应用程序, 又考虑到应用程序间的依赖性, 从而消除了无效的内 存交换, 提高了用户使用设备的体验感。 一种实施例中还考虑了一次交换 出去的内存页数量与系统当前最大内存使用量的关系, 从而解决了内存交 换过于频繁问题, 降低内存交换频率; 又一种实施例中考虑在启动程序前 完成内存交换, 保证在应用程序运行过程中没有内存交换, 从而消除内存 交换对应用程序运行过程的影响。 附图说明 The invention has the beneficial effects that: in the memory exchange, both the application to be exchanged according to a predetermined algorithm is considered, and the dependency between the applications is taken into consideration, thereby eliminating invalid memory exchange and improving the user experience of using the device. sense. In one embodiment, the relationship between the number of memory pages exchanged at a time and the current maximum memory usage of the system is also considered, thereby solving the problem of too frequent memory exchange and reducing the frequency of memory exchange; in another embodiment, before starting the program The memory exchange is completed to ensure that there is no memory exchange during the running of the application, thus eliminating the impact of memory swapping on the running process of the application. DRAWINGS
图 1是本发明实施例提供的移动设备内存管理装置的结构示意图; 图 2是本发明实施例一移动设备内存管理方法的流程示意图; 图 3是本发明实施例二移动设备内存管理方法的流程示意图; 图 4是本发明实施例三移动设备内存管理方法的流程示意图; 图 5是本发明实施例四移动设备内存管理方法的流程示意图; 图 6是本发明实施例五移动设备内存管理方法的流程示意图; 图 7是本发明实施例六移动设备内存管理方法的流程示意图; 图 8是本发明一种实施例应用于 Android手机中的内存管理装置的结构 示意图; 1 is a schematic structural diagram of a mobile device memory management apparatus according to an embodiment of the present invention; FIG. 2 is a schematic flowchart of a mobile device memory management method according to an embodiment of the present invention; FIG. 3 is a flow chart of a mobile device memory management method according to Embodiment 2 of the present invention; FIG. 4 is a schematic flowchart of a memory management method for a mobile device according to Embodiment 3 of the present invention; FIG. 5 is a schematic flowchart of a method for managing a memory of a mobile device according to Embodiment 4 of the present invention; FIG. 7 is a schematic flowchart of a method for managing a memory of a mobile device according to Embodiment 6 of the present invention; FIG. 8 is a schematic structural diagram of a memory management device applied to an Android mobile phone according to an embodiment of the present invention;
图 9是与图 8相对应的 Android手机中内存管理方法的流程示意图。
具体实施方式 FIG. 9 is a schematic flowchart of a memory management method in an Android mobile phone corresponding to FIG. 8. detailed description
下面通过具体实施方式结合附图对本发明作进一步详细说明。 The present invention will be further described in detail below with reference to the accompanying drawings.
本发明实施例的设计思想是: 1 )选择要交换出去的内存页时, 既考 虑使用预定算法来选择应用程序, 也考虑将要运行的应用程序是否可能会 使用该选择的应用程序, 只有同时满足两个条件 (内存页符合预定算法且 内存页对应的应用程序与将要运行的应用程序无依赖关系 ) 的内存页才被 选择交换出去; 2 )—次交换出去的内存页数量要满足将要运行的应用程序 可能的最大内存使用量; 3 )内存交换在启动将要运行的应用程序之前完成。 其中, 思想点 1 ) 消除了无效的内存交换, 思想点 2 ) 降低内存交换频率到 只有 1次, 思想点 3 )保证在应用程序运行过程中没有内存交换, 从而消除 内存交换对应用程序运行过程的打扰。 一种实施例中将这三点结合起来, 就可以既使用内存交换来降低内存使用量, 又不会降低应用程序运行的速 度和流畅性, 消除了传统内存交换技术在移动设备如手机上的缺点。 The design idea of the embodiment of the present invention is: 1) When selecting a memory page to be exchanged, consider using a predetermined algorithm to select an application, and also considering whether an application to be run may use the selected application, and only satisfy The memory pages of the two conditions (the memory page conforms to the predetermined algorithm and the application corresponding to the memory page has no dependencies on the application to be run) are selected and exchanged; 2) the number of memory pages exchanged is equal to the number of memory pages to be run. The maximum possible memory usage of the application; 3) The memory swap is completed before starting the application that will run. Among them, the idea point 1) eliminates the invalid memory exchange, the idea point 2) reduces the memory exchange frequency to only 1 time, the thought point 3) guarantees that there is no memory exchange during the application running, thus eliminating the memory exchange on the application running process Excuse me. In one embodiment, by combining these three points, it is possible to use both memory swapping to reduce memory usage without slowing down the speed and fluency of the application, and eliminating the traditional memory switching technology on mobile devices such as mobile phones. Disadvantages.
如图 1所示, 本发明一种实施例提供的移动设备中内存管理装置包括: 应用管理与控制模块和内存交换模块。 其中, 应用管理与控制模块, 用于 查找与指定应用程序无依赖关系且符合预定算法的至少一个应用程序作为 待交换的应用程序; 所述内存交换模块, 用于根据所述应用管理与控制模 页交换到外存中。 一种实施例中, 内存是 RAM (随机存取存储器), 外存 是 FLASH (闪存)。 As shown in FIG. 1, a memory management device in a mobile device according to an embodiment of the present invention includes: an application management and control module and a memory switching module. The application management and control module is configured to search for at least one application that is not dependent on the specified application and meets a predetermined algorithm as the application to be exchanged; and the memory switching module is configured to manage and control according to the application. The page is swapped to the external memory. In one embodiment, the memory is RAM (random access memory) and the external memory is FLASH.
本发明实施方式提供了基于上述内存管理装置的内存管理方法, 包括: 查找与指定应用程序无依赖关系且符合预定算法的至少一个应用程序作为 待交换的应用程序; 根据所述待交换的应用程序执行内存交换处理。 An embodiment of the present invention provides a memory management method based on the foregoing memory management apparatus, including: searching for at least one application that is not dependent on a specified application and conforms to a predetermined algorithm as an application to be exchanged; according to the application to be exchanged Perform memory swap processing.
一种实施例中, 预定算法采用最近最少使用 (LRU )算法, 也就是说, 在该实施例中, 符合预定算法的应用程序为应用程序对应的进程所属的内
存页最近最少被 CPU使用的应用程序;其他实施例中还可以使用其他算法, 本发明不限于 LRU这种算法。 In one embodiment, the predetermined algorithm adopts a least recently used (LRU) algorithm, that is, in this embodiment, the application that conforms to the predetermined algorithm is within the process to which the application corresponds. An application that has been recently used by the CPU at least is stored; other algorithms may be used in other embodiments, and the present invention is not limited to the LRU.
一种实施例中, 所述查找与指定应用程序无依赖关系且符合预定算法 的至少一个应用程序作为待交换的应用程序这一步驟包括: 从当前运行的 应用程序中查找符合预定算法的应用程序; 从查找到的符合预定算法的应 用程序中查找与指定应用程序无依赖关系的应用程序, 将其作为待交换的 应用程序。 对于该步驟, 一种示例性做法是: 查找符合预定算法的一个应 用程序; 判断该查找到的应用程序与指定应用程序之间是否存在依赖关系; 若存在依赖关系, 则重新查找下一个符合预定算法的应用程序。 一种实施例中, 该步驟包括: 将所述待交换的应用程序所对应的进程 中符合预定算法的内存页交换到外存中。 In an embodiment, the step of searching for at least one application that is not dependent on the specified application and conforms to the predetermined algorithm as the application to be exchanged includes: searching for an application that conforms to the predetermined algorithm from the currently running application Find an application that is not dependent on the specified application from the found application that matches the predetermined algorithm, and use it as the application to be exchanged. For this step, an exemplary method is: finding an application that conforms to a predetermined algorithm; determining whether there is a dependency between the found application and the specified application; if there is a dependency, re-finding the next one that meets the predetermined schedule Algorithm application. In an embodiment, the step includes: exchanging, in a memory corresponding to the predetermined algorithm, a memory page of the process corresponding to the application to be exchanged into the external memory.
另一种实施例中, 该步驟包括: 选中一个所述待交换的应用程序, 将 该选中的应用程序所对应的进程中符合预定算法的内存页交换到外存中; 判断该被交换出去的内存页所占的内存量与系统当前的可用内存量之和是 否大于等于预设阈值; 如果不是, 则继续执行选中一个所述待交换的应用 程序这一步驟。 出于执行效率上的考虑, 可将该实施例进行优化, 即该步 驟包括: 选中一个所述待交换的应用程序, 标记该选中的应用程序; 判断 该标记的应用程序所对应的进程中符合预定算法的内存页所占的内存量与 系统当前的可用内存量之和是否大于等于预设阈值; 如果不是, 则继续执 行选中一个所述待交换的应用程序这一步驟; 如果是, 则将所有标记的应 用程序各自对应的进程中符合预定算法的内存页交换到外存中。 这里, 预 设阈值为实验值, 实施例中预设阈值是能满足移动设备中任意一个应用程 序运行时需要的内存量。 In another embodiment, the step includes: selecting an application to be exchanged, exchanging a memory page of the process corresponding to the selected application into a foreign memory; and determining the exchanged Whether the sum of the amount of memory occupied by the memory page and the current amount of available memory of the system is greater than or equal to a preset threshold; if not, the step of selecting one of the applications to be exchanged is continued. For implementation efficiency considerations, the embodiment may be optimized, that is, the step includes: selecting one of the applications to be exchanged, marking the selected application; determining that the marked application corresponds to the process Whether the sum of the amount of memory occupied by the memory page of the predetermined algorithm and the current amount of available memory of the system is greater than or equal to a preset threshold; if not, proceeding to perform the step of selecting one of the applications to be exchanged; if yes, The memory pages of the corresponding processes in all the marked applications are exchanged into the external memory. Here, the preset threshold is an experimental value, and the preset threshold in the embodiment is the amount of memory required to run when any one of the mobile devices is running.
一种实施例中, 在所述查找与指定应用程序无依赖关系且符合预定算
法的至少一个应用程序作为待交换的应用程序这一步驟之前, 所述方法还 包括: 判断系统当前的可用内存量是否大于等于预设阈值; 若小于预设阈 值, 则执行所述查找与指定应用程序无依赖关系且符合预定算法的应用程 序作为待交换的应用程序步驟; 否则不作处理。 这里, 预设阈值为实验值, 实施例中预设阈值是能满足移动设备中任意一个应用程序运行时需要的内 存量。 In one embodiment, the lookup has no dependencies on the specified application and is in accordance with a predetermined calculation. Before the step of the at least one application of the method as the application to be exchanged, the method further includes: determining whether the current available memory amount of the system is greater than or equal to a preset threshold; if less than the preset threshold, performing the searching and specifying The application has no dependencies and the application conforming to the predetermined algorithm acts as the application step to be exchanged; otherwise it is not processed. Here, the preset threshold is an experimental value, and the preset threshold in the embodiment is an amount of memory required to satisfy any one of the applications in the mobile device.
一种实施例中, 在根据待交换的应用程序执行内存交换处理这一步驟 之后, 所述方法还包括: 执行正常的应用程序启动流程启动所述指定应用 程序。 In one embodiment, after the step of performing a memory swap process according to the application to be exchanged, the method further comprises: executing a normal application startup process to start the specified application.
以下通过几个实施例并结合图 2-9 详细说明根据本发明实施方式提供 的移动设备内存管理方法。 为便于描述, 以下各实施例中统一采用的预定 算法为前述 LRU算法, 即最近最少被 CPU使用算法; 应理解, 本发明实 施例还可以使用其他算法, 并不限于 LRU算法。 The mobile device memory management method according to an embodiment of the present invention is described in detail below through several embodiments and in conjunction with FIGS. 2-9. For convenience of description, the predetermined algorithm uniformly used in the following embodiments is the foregoing LRU algorithm, that is, the least recently used algorithm by the CPU; it should be understood that other embodiments of the present invention may be used, and are not limited to the LRU algorithm.
实施例一 Embodiment 1
如图 2所示, 本实施例包含如下步驟: As shown in FIG. 2, this embodiment includes the following steps:
步驟 S201 : 按预定算法查找 APP; Step S201: Find an APP according to a predetermined algorithm;
采用 LRU算法查找应用程序(APP ), 即在当前运行应用程序列表中查 找应用程序对应的进程所属的内存页最近最少被 CPU使用的应用程序; 可 以理解, 当前运行的应用程序并不一定是正在占用 CPU的应用程序, 而是 操作系统为这个应用程序创建了进程的应用程序; The LRU algorithm is used to find an application (APP), that is, in the currently running application list, the application that belongs to the application corresponding to the process belongs to the least recently used CPU; it can be understood that the currently running application is not necessarily being The application that occupies the CPU, but the application that the operating system created the process for this application;
步驟 S202: 判断指定应用程序是否依赖于所查找的应用程序 (APP ) 的组件, 这里, 指定应用程序是指除当前运行的应用程序以外的应用程序, 也即将要运行的应用程序; Step S202: determining whether the specified application depends on the component of the found application (APP), where the specified application refers to an application other than the currently running application, and an application to be run;
若指定应用程序与应用程序 (APP )存在依赖关系, 则排除应用程序 ( APP ), 转步驟 S201 , 查找下一个符合 LRU算法的应用程序; 可以理解,
排除应用程序(APP )是指不将该应用程序(APP )对应的进程所属的内存 页作为可以交换出去的内存页; 步驟 S203 : 进行内存交换, 具体而言, 把查找到的符合 LRU算法的应 用程序(APP )所对应的进程所属的内存页作为可以交换出去的内存页, 将 其交换到外存中; 其中, 被交换出去的内存页是指应用程序所对应的进程 中符合预定算法的内存页; If the specified application has a dependency relationship with the application (APP), the application (APP) is excluded, and the process proceeds to step S201 to find the next application that conforms to the LRU algorithm; Excluding an application (APP) means that the memory page to which the process corresponding to the application (APP) belongs is not a memory page that can be exchanged; Step S203: performing memory exchange, specifically, finding the LRU algorithm that matches the search The memory page to which the process corresponding to the application (APP) belongs is used as a memory page that can be exchanged, and is exchanged into the external memory; wherein, the memory page exchanged refers to a process corresponding to the predetermined algorithm in the process corresponding to the application. Memory page
步驟 S204: 内存交换流程结束。 Step S204: The memory exchange process ends.
本实施例既考虑 LRU算法的优势又考虑应用程序之间组件的依赖关 系, 只有同时满足这两个条件的内存页才被选择交换出去, 从而消除了无 效的内存交换。 This embodiment considers both the advantages of the LRU algorithm and the dependencies of components between applications. Only memory pages that satisfy both conditions are selected for exchange, thereby eliminating invalid memory swapping.
实施例二 Embodiment 2
如图 3所示, 本实施例包含如下步驟: As shown in FIG. 3, this embodiment includes the following steps:
步驟 S301 : 与实施例一的步驟 S201相同, 即, 在当前运行应用程序列 表中查找符合 LRU算法的应用程序 (APP ); Step S301: The same as step S201 of the first embodiment, that is, searching for an application (APP) conforming to the LRU algorithm in the currently running application list;
步驟 S302: 判断指定应用程序是否依赖于所查找的应用程序 (APP ) 的组件, 同样地, 这里的指定应用程序是除当前运行的应用程序以外的应 用程序。 若存在依赖关系, 则排除该应用程序(APP ), 转步驟 S301 , 查找 下一个符合 LRU算法的应用程序; 若不存在依赖关系, 则转步驟 S303; 步驟 S303 :将步驟 S302中得到的符合预定算法且不存在依赖关系的应 用程序所对应的进程所属的内存页作为可以交换出去的内存页, 通知内存 交换模块把这些内存页交换到外存中; 其中, 被交换出去的内存页是指应 用程序所对应的进程中符合预定算法的内存页; Step S302: Determine whether the specified application depends on the component of the found application (APP). Similarly, the specified application here is an application other than the currently running application. If there is a dependency relationship, the application (APP) is excluded, and the process goes to step S301 to find the next application that conforms to the LRU algorithm; if there is no dependency, the process goes to step S303; step S303: the matching plan obtained in step S302 is met. The memory page to which the process corresponding to the algorithm and the application corresponding to the dependency does not belong is a memory page that can be exchanged, and the memory exchange module is notified to exchange the memory pages into the external memory; wherein the memory page exchanged refers to the application. a memory page that conforms to a predetermined algorithm among processes corresponding to the program;
步驟 S304:把系统当前的可用内存量加上步驟 S303中交换出去的内存 量, 判断二者之和是否大于等于预设阈值; 这里, 预设阈值含义如前述,
若二者之和大于等于预设阈值, 转步驟 S305; 否则, 转步驟 S301 , 查 找下一个符合 LRU算法的应用程序; Step S304: adding the current available memory amount of the system to the amount of memory exchanged in step S303, and determining whether the sum of the two is greater than or equal to a preset threshold; where the preset threshold value is as described above, If the sum of the two is greater than or equal to the preset threshold, go to step S305; otherwise, go to step S301 to find the next application that conforms to the LRU algorithm;
步驟 S305: 内存交换流程结束。 Step S305: The memory exchange process ends.
本实施例不仅考虑 LRU算法的优势又考虑应用程序之间组件的依赖性 关系, 还考虑了进行内存交换的内存量要满足可能使用的最大内存量, 从 而消除了无效的内存交换; 并且, 当进行内存交换的内存量满足可能使用 的最大内存量时不再进行内存交换, 从而降低了交换频率。 This embodiment not only considers the advantages of the LRU algorithm but also considers the dependency relationship of components between applications, and also considers that the amount of memory for memory swapping must satisfy the maximum amount of memory that may be used, thereby eliminating invalid memory swaps; When the amount of memory exchanged for memory meets the maximum amount of memory that can be used, memory swapping is no longer performed, thereby reducing the switching frequency.
实施例三 Embodiment 3
如图 4所示, 本实施例包括如下步驟: As shown in FIG. 4, this embodiment includes the following steps:
步驟 S401 : 与实施例一的步驟 S201相同, 即, 在当前运行应用程序列 表中符合 LRU算法的应用程序 (APP )。 Step S401: The same as step S201 of the first embodiment, that is, the application (APP) conforming to the LRU algorithm in the currently running application list.
步驟 S402: 判断指定应用程序是否依赖于所查找的应用程序 (APP ) 的组件, 同样地, 这里的指定应用程序是除当前运行的应用程序以外的应 用程序。 若存在依赖关系, 则排除该应用程序(APP ), 转步驟 S401 , 查找 下一个符合 LRU算法的应用程序; 若不存在依赖关系, 则转步驟 S403; 步驟 S403:标记步驟 S402中得到的符合预定算法且不存在依赖关系的 应用程序 APP; Step S402: Determine whether the specified application depends on the component of the found application (APP). Similarly, the specified application here is an application other than the currently running application. If there is a dependency, the application (APP) is excluded, and step S401 is performed to find the next application that conforms to the LRU algorithm; if there is no dependency, then step S403 is performed; Step S403: marking the matching order obtained in step S402 An application that has an algorithm and does not have a dependency;
步驟 S404:把系统当前的可用内存量加上步驟 S403中标记的应用程序 所对应的进程中符合预定算法的内存页所占的内存量, 判断二者之和是否 大于等于预设阈值。 这里, 预设阈值为实验值, 实施例中预设阈值是能满 足移动设备中任意一个应用程序运行时需要的内存量; 其中, 被交换出去 的内存页是指应用程序所对应的进程中符合预定算法的内存页; Step S404: The amount of available memory of the system is added to the amount of memory occupied by the memory page that meets the predetermined algorithm in the process corresponding to the application marked in step S403, and it is determined whether the sum of the two is greater than or equal to a preset threshold. Here, the preset threshold is an experimental value. In the embodiment, the preset threshold is a quantity that can satisfy the running time of any application in the mobile device; wherein, the memory page that is exchanged refers to the process corresponding to the application. a memory page of a predetermined algorithm;
若二者之和大于等于预设阈值, 转步驟 S405; 否则, 转步驟 S401 , 查 找下一个符合 LRU算法的应用程序;
步驟 S405: 将所有标记的应用程序各自所对应的进程中符合预定算法 的内存页作为可以交换出去的内存页, 通知内存交换模块把这些内存页交 换到外存中; If the sum of the two is greater than or equal to the preset threshold, go to step S405; otherwise, go to step S401 to find the next application that conforms to the LRU algorithm; Step S405: The memory pages that meet the predetermined algorithm in the processes corresponding to the respective marked applications are used as memory pages that can be exchanged, and notify the memory switching module to exchange the memory pages into the external memory;
步驟 S406: 内存交换流程结束。 Step S406: The memory exchange process ends.
可以看出, 本实施例不仅考虑 LRU算法的优势又考虑应用程序之间组 件的依赖性关系, 还考虑了进行一次内存交换的内存量要满足可能使用的 最大内存量, 只有同时满足这三个条件的内存页才被选择交换出去, 从而 既消除了无效的内存交换, 又降低交换频率至只有一次。 It can be seen that this embodiment considers not only the advantages of the LRU algorithm but also the dependencies of components between applications, and also considers that the amount of memory to be exchanged once for memory must satisfy the maximum amount of memory that can be used, and only three of them are simultaneously satisfied. Conditional memory pages are selected for swapping out, thereby eliminating invalid memory swaps and reducing the switching frequency to only one.
本实施例实际上是对实施例二在执行方面的优化, 通过循环找出所有 需要交换出去的应用程序后, 然后集中一次把这些应用程序对应的进程中 符合预定算法的内存页交换到外存中, 从而优化了执行的效率。 This embodiment is actually an optimization of the execution of the second embodiment. After all the applications that need to be exchanged are found out through the loop, the memory pages that meet the predetermined algorithm in the processes corresponding to the applications are collectively exchanged to the external memory. Medium, thereby optimizing the efficiency of execution.
实施例四 Embodiment 4
如图 5所示, 本实施例包括如下步驟: As shown in FIG. 5, this embodiment includes the following steps:
步驟 S501 : 判断系统当前的内存可用量是否大于等于预设阈值,若是, 转步驟 S505; 否则, 转步驟 S502; 这里, 预设阈值含义如前述, 在此不再 赘述; Step S501: Determine whether the current memory available amount of the system is greater than or equal to a preset threshold. If yes, go to step S505; otherwise, go to step S502; Here, the preset threshold value is as described above, and is not described here;
步驟 S502、 S503、 S504、 S505分别与实施例一中的步驟 S201、 S202、 S203、 S204相同, 在此不再赘述。 Steps S502, S503, S504, and S505 are the same as steps S201, S202, S203, and S204 in the first embodiment, and are not described here.
本实施例在进行内存交换前, 首先考虑系统当前内存可用量, 然后再 进行如实施例一的内存交换方法, 进一步消除了无效的内存交换。 In this embodiment, before the memory exchange is performed, the current memory available amount of the system is first considered, and then the memory exchange method as in the first embodiment is performed, thereby further eliminating the invalid memory exchange.
实施例五 Embodiment 5
如图 6所示, 本实施例包括如下步驟: As shown in FIG. 6, the embodiment includes the following steps:
步驟 S601 : 判断系统当前的内存可用量是否大于等于预设阈值,若是, 转步驟 S606; 否则, 转步驟 S602; Step S601: determining whether the current memory available amount of the system is greater than or equal to a preset threshold, and if yes, proceeding to step S606; otherwise, proceeding to step S602;
步驟 S602、 S603、 S604、 S605、 S606分别与实施例二中的步驟 S301、
S302、 S303、 S304、 S305相同, 在此不再赘述。 Steps S602, S603, S604, S605, and S606 are respectively performed in step S301 in the second embodiment. S302, S303, S304, and S305 are the same, and are not described here.
本实施例在进行内存交换前, 首先考虑系统当前内存可用量, 然后再 进行如实施例二的内存交换方法, 进一步消除了无效的内存交换。 In this embodiment, before the memory exchange is performed, the current memory available amount of the system is first considered, and then the memory exchange method as in the second embodiment is performed, thereby further eliminating the invalid memory exchange.
实施例六 Embodiment 6
如图 7所示, 包括如下步驟: As shown in Figure 7, the following steps are included:
步驟 S701 : 判断系统当前的内存可用量是否大于等于预设阈值,若是, 转步驟 S707; 否则, 转步驟 S702; Step S701: determining whether the current memory available amount of the system is greater than or equal to a preset threshold, and if yes, proceeding to step S707; otherwise, proceeding to step S702;
步驟 S702至 S707分别与实施例三的步驟 S401至 S406相同, 在此不 再赘述。 Steps S702 to S707 are the same as steps S401 to S406 of the third embodiment, and are not described herein again.
本实施例在进行内存交换前, 首先考虑系统当前内存可用量, 然后再 进行如实施例三的内存交换方法, 进一步消除了无效的内存交换。 启动指定应用程序前, 执行如上述各个实施例的内存交换流程, 待内存交 换完毕后再执行该指定应用程序。 这种方式不仅消除了无效的内存交换, 还保证在应用程序运行过程中没有内存交换, 从而消除了内存交换对应用 程序运行过程的打扰。 In this embodiment, before the memory exchange is performed, the current memory available amount of the system is first considered, and then the memory exchange method as in the third embodiment is performed, thereby further eliminating the invalid memory exchange. Before starting the specified application, the memory exchange process as in the above embodiments is executed, and the specified application is executed after the memory exchange is completed. This approach not only eliminates invalid memory swaps, but also ensures that there is no memory swapping during application running, thus eliminating the memory swapping process that is bothering the application.
根据上述各实施例可以理解, 在本发明实施例提供的移动设备内存管 理装置中, 内存交换模块负责把指定的内存页的内容交换到外存中, 以及 把交换在外存中的内存页的内容在需要使用时 (也就是 CPU要读写这些内 存页所属地址的内容时) 自动读入到指定的内存页中; 而应用管理与控制 模块负责选择要交换出去的内存页和决定把内存页交换出去的时机, 需要 注意的是, 实施例中应用管理与控制模块只是控制交换出去, 而把交换出 去的内容交换进来则是由内存交换模块自动完成的 (该功能是由操作系统 内核的缺页中断来完成的, 本领域技术人员可通过现有技术实现) 。 可以 理解, 本发明中的这种模块划分是为了描述方便而引入的一种逻辑上的概
念, 具体实现时, 既可以一个模块对应一个独立的软件模块实体(如函数、 类、 进程、 线程等) , 也可以多个模块对应一个软件模块实体, 或者一个 模块对应多个软件模块实体。 According to the above embodiments, in the mobile device memory management device provided by the embodiment of the present invention, the memory switching module is responsible for exchanging the contents of the specified memory page into the external memory, and exchanging the contents of the memory page in the external memory. When it is needed (that is, when the CPU wants to read and write the contents of the address of the memory page), it is automatically read into the specified memory page; and the application management and control module is responsible for selecting the memory page to be exchanged and deciding to swap the memory page. When you go out, you need to pay attention to the fact that in the embodiment, the application management and control module only controls the exchange, and the exchange of the exchanged content is automatically done by the memory exchange module (this function is caused by the missing page of the operating system kernel). The interruption is completed, and those skilled in the art can implement by the prior art). It can be understood that the module division in the present invention is a logical introduction introduced for convenience of description. In the specific implementation, one module can correspond to one independent software module entity (such as function, class, process, thread, etc.), or multiple modules can correspond to one software module entity, or one module corresponds to multiple software module entities.
下面以 Android手机为例来进一步说明本发明一种实施例提供的移动 设备内存管理方法。 现有技术中, Android手机采用了 Linux操作系统技术 和 Java技术, 这使得 Android手机的运行对内存大小非常敏感。 当内存比 较小时, Android手机运行会非常緩慢。 为此, Android手机基本上都配备 了大容量的内存。 The mobile phone memory management method provided by an embodiment of the present invention is further described below by taking an Android mobile phone as an example. In the prior art, the Android mobile phone adopts Linux operating system technology and Java technology, which makes the operation of the Android mobile phone very sensitive to the memory size. When the memory ratio is small, the Android phone will run very slowly. For this reason, Android phones are basically equipped with large-capacity memory.
如图 8所示, 应用管理与控制模块由 ActivityManagerService (活动管 理服务 )和 PackageManageService (包管理服务 )这两个类组成, 而内存交 换模块由 Linux操作系统内核中的虚拟存储管理模块组成。另夕卜,应用管理 与控制模块和内存交换模块之间的通信采用虚拟设备驱动程序 —— MMUDriver (虚存控制驱动)来完成。 As shown in Figure 8, the application management and control module consists of two classes: ActivityManagerService and PackageManageService. The memory swap module consists of virtual storage management modules in the Linux operating system kernel. In addition, communication between the application management and control module and the memory switch module is accomplished using the virtual device driver, MMUDriver.
如图 9所示, 本例包含如下步驟: As shown in Figure 9, this example contains the following steps:
步驟 S901 : ActivityManagerService打开 MMUDriver, 准备进行内存交 换处理。 Step S901: ActivityManagerService opens MMUDriver and prepares for memory exchange processing.
步驟 S902: ActivityManagerService检查系统当前可用的内存量是否大 于等于预设阈值, 如果是, 转步驟 S909; 否则, 转步驟 S903。 这里, 预设 阈值通过实验来确定, 原则上是能够满足手机上任意一个应用运行时需要 的内存量; Step S902: The ActivityManagerService checks whether the amount of memory currently available to the system is greater than or equal to a preset threshold. If yes, go to step S909; otherwise, go to step S903. Here, the preset threshold is determined experimentally, in principle, to satisfy the amount of memory required for any application running on the mobile phone;
步驟 S903: ActivityManagerService从当前运行的应用程序列表中找出 符合 LRU算法的应用程序; Step S903: The ActivityManagerService finds an application that conforms to the LRU algorithm from the list of currently running applications;
步骤 S904: ActivityManagerService通过 PackageManagerService检查当 前待启动的应用程序的描述信息, 看其所要依赖的外部应用程序组件, 可 通过 Intent方式描述, 把这些信息进一步转换成要依赖的应用程序名称;
步驟 S905: ActivityManagerService查询当前运行的应用程序列表, 将 该表按 LRU算法的原则进行排序 (称为 LRU表), 从 LRU表中选出第一 个不在步驟 S904中的应用程序(也就是说, 该应用程序对应的进程所属的 某些内存页最近最少被 CPU使用且其组件不被依赖), 作为要交换出去的 应用程序; Step S904: The ActivityManagerService checks the description information of the current application to be started through the PackageManagerService, and looks at the external application component that it depends on, and can describe the information through the Intent method, and further convert the information into the application name to be relied upon; Step S905: The ActivityManagerService queries the currently running application list, sorts the table according to the principle of the LRU algorithm (referred to as an LRU table), and selects the first application that is not in step S904 from the LRU table (that is, Some memory pages to which the application corresponds to the process are most recently used by the CPU and their components are not dependent on) as the application to be exchanged;
步驟 S906: ActivityManagerService把步驟 S905 中选出的应用程序所 对应的进程号 ( PID ) 以写 MMUDriver驱动的方式发给 MMUDriver驱动, 然后通过读 MMUDriver驱动的方式等待 MMUDriver驱动返回处理结果; 步驟 S907: MMUDriver驱动收到步驟 S906中 ActivityManagerService 发来的进程号后,以进程号调用 Linux内核的函数让内核的虚拟存储管理模 块把这个进程所占有的符合预定算法的内存页中的内容交换到外存中, 完 成这个操作后, MMUDriver驱动向上层回写一个状态值; Step S906: The ActivityManagerService sends the process number (PID) corresponding to the application selected in step S905 to the MMUDriver driver in the manner of writing the MMUDriver, and then waits for the MMUDriver driver to return the processing result by reading the MMUDriver driver; Step S907: MMUDriver After receiving the process ID sent by ActivityManagerService in step S906, the driver calls the function of the Linux kernel with the process number, so that the virtual storage management module of the kernel exchanges the content of the memory page occupied by the process according to the predetermined algorithm into the external memory. After completing this operation, the MMUDriver driver writes back a status value to the upper layer;
步驟 S908:步驟 S906中 ActivityManagerService—直在等待 MMUDriver 驱动的返回结果, 待结果反馈时, ActivityManagerService解除等待, 读出 MMUDriver驱动回写的状态值, 继续往下执行如下操作: 查看系统当前的 空闲内存是否大于等于预设阈值, 如果是, 则转步驟 S909; 否则, 从 LRU 表中排除刚交换出去的应用, 转步驟 S903; Step S908: ActivityManagerService in step S906 - waiting for the return result of the MMUDriver driver, when the result feedback, the ActivityManagerService cancels the wait, reads the status value of the MMUDriver drive write back, and continues to perform the following operations: Check whether the current free memory of the system is If the value is greater than or equal to the preset threshold, if yes, go to step S909; otherwise, exclude the application just swapped out from the LRU table, go to step S903;
步驟 S909: 执行应用程序启动, 流程结束。 Step S909: The execution application is started, and the process ends.
可以理解, 作为一种执行效率上的优化, ActivityManagerService 可以 先循环找出所有需要交换出去的应用程序后, 然后集中一次通知 MMUDriver驱动把这些应用程序所对应的进程中符合预定算法的内存页交 换到外存中。 It can be understood that, as an optimization of execution efficiency, the ActivityManagerService can first loop through all the applications that need to be exchanged, and then notify the MMUDriver driver to exchange the memory pages of the processes corresponding to the predetermined algorithms into the processes corresponding to the predetermined algorithms. In the outer memory.
从上述各实施例可以看出, 本发明实施例通过改进传统的内存交换方 法来降低无效的内存交换, 减弱传统内存交换方法对应用程序运行流畅度 的影响, 从而移动设备如手机上的内存使用量得以降低且又不影响用户体
验。 As can be seen from the above embodiments, the embodiment of the present invention reduces the invalid memory exchange by improving the traditional memory exchange method, and reduces the influence of the traditional memory exchange method on the smoothness of the application running, thereby using the memory on the mobile device such as a mobile phone. The amount is reduced without affecting the user body Test.
上述实施例只是本发明的举例, 尽管为说明目的公开了本发明的最佳 实施例和附图, 但是本领域的技术人员可以理解: 在不脱离本发明及所附 的权利要求的精神和范围内, 各种替换、 变化和修改都是可能的。 因此, 本发明不应局限于最佳实施例和附图所公开的内容。
The above-described embodiments are merely examples of the invention, and while the preferred embodiments and the accompanying drawings of the invention are disclosed, Within the scope, various substitutions, changes and modifications are possible. Therefore, the invention should not be limited to the details disclosed in the preferred embodiments and the drawings.
Claims
1、 一种移动设备内存管理方法, 其特征在于, 包括: A mobile device memory management method, comprising:
查找与指定应用程序无依赖关系且符合预定算法的至少一个应用程序 作为待交换的应用程序; Finding at least one application that is not dependent on the specified application and that conforms to a predetermined algorithm as the application to be exchanged;
根据所述待交换的应用程序执行内存交换处理。 Performing a memory swap process according to the application to be exchanged.
2、 如权利要求 1所述的方法, 其特征在于, 所述查找与指定应用程序 无依赖关系且符合预定算法的至少一个应用程序作为待交换的应用程序这 一步驟包括: 2. The method according to claim 1, wherein the step of searching for at least one application that is not dependent on the specified application and conforms to a predetermined algorithm as the application to be exchanged comprises:
从当前运行的应用程序中查找符合预定算法的应用程序; Find an application that matches the predetermined algorithm from the currently running application;
从查找到的符合预定算法的应用程序中查找与指定应用程序无依赖关 系的应用程序, 将其作为待交换的应用程序。 Look for an application that has no dependencies on the specified application from the found application that matches the predetermined algorithm, and use it as the application to be exchanged.
3、 如权利要求 1或 2所述的方法, 其特征在于, 根据所述待交换的应 用程序执行内存交换处理这一步驟包括: 3. The method according to claim 1 or 2, wherein the step of performing a memory swap process according to the application to be exchanged comprises:
选中一个所述待交换的应用程序, 将该选中的应用程序所对应的进程 中符合预定算法的内存页交换到外存中; Selecting an application to be exchanged, and exchanging, in the process corresponding to the selected application, a memory page that meets a predetermined algorithm into the external storage;
判断被交换出去的内存页所占的内存量与系统当前的可用内存量之和 是否大于等于预设阈值; 如果不是, 则继续执行选中一个所述待交换的应 用程序这一步驟。 It is judged whether the sum of the amount of memory occupied by the swapped memory page and the current available memory amount of the system is greater than or equal to a preset threshold; if not, the step of selecting one of the applications to be exchanged is continued.
4、 如权利要求 1或 2所述的方法, 其特征在于, 根据所述待交换的应 用程序执行内存交换处理这一步驟包括: 4. The method according to claim 1 or 2, wherein the step of performing a memory swap process according to the application to be exchanged comprises:
选中一个所述待交换的应用程序, 标记该选中的应用程序; Select one of the applications to be exchanged, and mark the selected application;
判断该标记的应用程序所对应的进程中符合预定算法的内存页所占的 内存量与系统当前的可用内存量之和是否大于等于预设阈值; 如果不是, 则继续执行选中一个所述待交换的应用程序这一步驟; 如果是, 则将所有 标记的应用程序各自对应的进程中符合预定算法的的内存页交换到外存 中。 Determining whether the sum of the amount of memory occupied by the memory page that meets the predetermined algorithm in the process corresponding to the marked application and the current amount of available memory of the system is greater than or equal to a preset threshold; if not, proceeding to select one of the to-be-exchanged The application's step; if it is, swap the memory pages of the process corresponding to all the marked applications to the external memory Medium.
5、 如权利要求 1或 2所述的方法, 其特征在于, 根据所述待交换的应 用程序执行内存交换处理这一步驟包括: 将所述待交换的应用程序所对应 的进程中符合预定算法的内存页交换到外存中。 The method according to claim 1 or 2, wherein the step of performing a memory swap process according to the application to be exchanged comprises: matching a process corresponding to the application to be exchanged with a predetermined algorithm The memory pages are swapped into the external memory.
6、 如权利要求 1至 5任一项所述的方法, 其特征在于, 在所述查找与 指定应用程序无依赖关系且符合预定算法的至少一个应用程序作为待交换 的应用程序这一步驟之前, 所述方法还包括: The method according to any one of claims 1 to 5, wherein before the step of searching for at least one application that is not dependent on the specified application and conforms to a predetermined algorithm as the application to be exchanged The method further includes:
判断系统当前的可用内存量是否大于等于预设阈值; 若小于所述预设 阈值, 则执行所述查找与指定应用程序无依赖关系且符合预定算法的应用 程序作为待交换的应用程序步驟; 否则不作处理。 Determining whether the current amount of available memory of the system is greater than or equal to a preset threshold; if less than the preset threshold, performing the searching for an application that has no dependencies with the specified application and conforms to the predetermined algorithm as an application step to be exchanged; No treatment.
7、 如权利要求 1至 6任一项所述的方法, 其特征在于, 所述符合预定 算法的应用程序包括应用程序对应的进程所属的内存页最近最少被 CPU使 用的应用程序。 The method according to any one of claims 1 to 6, wherein the application program conforming to the predetermined algorithm includes an application program to which the memory page to which the process corresponding to the application belongs is least recently used by the CPU.
8、 如权利要求 1至 7任一项所述的方法, 其特征在于, 在根据所述待 交换的应用程序执行内存交换处理这一步驟之后, 所述方法还包括: 执行 正常的应用程序启动流程启动所述指定应用程序。 The method according to any one of claims 1 to 7, wherein after the step of performing a memory swap process according to the application to be exchanged, the method further comprises: performing a normal application startup The process starts the specified application.
9、 一种移动设备内存管理装置, 其特征在于, 包括: 9. A mobile device memory management device, comprising:
应用管理与控制模块, 用于查找与指定应用程序无依赖关系且符合预 定算法的至少一个应用程序作为待交换的应用程序; An application management and control module, configured to find at least one application that is not dependent on the specified application and conforms to the predetermined algorithm as the application to be exchanged;
内存交换模块, 用于根据所述应用管理与控制模块的指示, 将所述待 交换的应用程序所对应的进程中符合预定算法的内存页交换到外存中。 And a memory switching module, configured to exchange, according to the indication of the application management and control module, a memory page that meets a predetermined algorithm in a process corresponding to the application to be exchanged into the external memory.
10、 如权利要求 9所述的装置, 其特征在于, 所述符合预定算法的应 用程序包括应用程序对应的进程所属的内存页最近最少被 CPU使用的应用 程序。 10. The apparatus according to claim 9, wherein the application conforming to the predetermined algorithm comprises an application program to which the memory page to which the process corresponding to the application belongs is least recently used by the CPU.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110135149.7 | 2011-05-23 | ||
CN2011101351497A CN102226894A (en) | 2011-05-23 | 2011-05-23 | Mobile device memory management method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2012159394A1 true WO2012159394A1 (en) | 2012-11-29 |
Family
ID=44807862
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2011/079602 WO2012159394A1 (en) | 2011-05-23 | 2011-09-14 | Method and apparatus for managing mobile device memory |
Country Status (2)
Country | Link |
---|---|
CN (2) | CN106843758A (en) |
WO (1) | WO2012159394A1 (en) |
Families Citing this family (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103838620A (en) * | 2012-11-20 | 2014-06-04 | 中兴通讯股份有限公司 | Method and device for processing application programs |
CN103117923B (en) * | 2013-01-18 | 2016-06-29 | 杭州华三通信技术有限公司 | A kind of process management method and equipment |
CN103106093A (en) * | 2013-02-21 | 2013-05-15 | 北京奇虎科技有限公司 | System operation quickening method and device |
CN104156226B (en) * | 2013-05-15 | 2019-01-15 | 索尼公司 | Mix hang-up or the closedown method of memory device |
CN104461737B (en) * | 2014-12-10 | 2018-01-16 | 广东欧珀移动通信有限公司 | A kind of EMS memory management process and device |
CN105988842B (en) * | 2015-02-12 | 2019-06-11 | Oppo广东移动通信有限公司 | A kind of method and terminal shifting application program |
CN105988875B (en) * | 2015-03-04 | 2020-08-14 | 华为技术有限公司 | Method and device for running process |
CN106502768A (en) * | 2016-09-22 | 2017-03-15 | 南京酷派软件技术有限公司 | A kind of applied program processing method, device, terminal and server |
CN106873664A (en) * | 2017-02-28 | 2017-06-20 | 努比亚技术有限公司 | A kind of temprature control method and mobile terminal |
CN110018902B (en) * | 2018-01-10 | 2023-01-31 | Oppo广东移动通信有限公司 | Memory processing method and device, electronic equipment and computer readable storage medium |
US20190370009A1 (en) * | 2018-06-03 | 2019-12-05 | Apple Inc. | Intelligent swap for fatigable storage mediums |
CN111475083A (en) * | 2020-04-03 | 2020-07-31 | 惠州Tcl移动通信有限公司 | Application skipping method and device, storage medium and mobile terminal |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1829979A (en) * | 2003-08-05 | 2006-09-06 | Sap股份公司 | A method of data caching |
CN101246427A (en) * | 2007-02-15 | 2008-08-20 | 凌阳科技股份有限公司 | Method for relocated loading application program and address relocation device |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6877081B2 (en) * | 2001-02-13 | 2005-04-05 | International Business Machines Corporation | System and method for managing memory compression transparent to an operating system |
CN101686340A (en) * | 2008-09-26 | 2010-03-31 | 深圳市朗科科技股份有限公司 | Method and system for expanding function of image communication equipment |
CN101847127B (en) * | 2010-06-18 | 2012-01-25 | 福建星网锐捷网络有限公司 | Memory management method and device |
CN101882160B (en) * | 2010-06-29 | 2012-09-12 | 宇龙计算机通信科技(深圳)有限公司 | Web page management method and mobile terminal |
-
2011
- 2011-05-23 CN CN201710026421.5A patent/CN106843758A/en not_active Withdrawn
- 2011-05-23 CN CN2011101351497A patent/CN102226894A/en active Pending
- 2011-09-14 WO PCT/CN2011/079602 patent/WO2012159394A1/en active Application Filing
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1829979A (en) * | 2003-08-05 | 2006-09-06 | Sap股份公司 | A method of data caching |
CN101246427A (en) * | 2007-02-15 | 2008-08-20 | 凌阳科技股份有限公司 | Method for relocated loading application program and address relocation device |
Also Published As
Publication number | Publication date |
---|---|
CN102226894A (en) | 2011-10-26 |
CN106843758A (en) | 2017-06-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2012159394A1 (en) | Method and apparatus for managing mobile device memory | |
WO2018059079A1 (en) | Memory management method and apparatus | |
KR101799253B1 (en) | Systems and methods for providing dynamic cache extension in a multi-cluster heterogeneous processor architecture | |
TWI317061B (en) | Storing system information in a low-latency persistent memory device upon transition to a lower-power state | |
US20150026398A1 (en) | Mobile device and a method of controlling the mobile device | |
WO2009157178A1 (en) | Virtual computer control device, virtual computer control program, and virtual computer control circuit | |
TW201717027A (en) | System and method for flash read cache with adaptive pre-fetch | |
JP2012529692A (en) | Pause memory operations to reduce read latency in memory arrays | |
CN107924225B (en) | System and method for dynamically adjusting memory state transition timers | |
US20140173306A1 (en) | System and method for providing for power savings in a processor environment | |
CN102495756A (en) | Method and system for switching operating system between different central processing units | |
JP2014179080A (en) | Platform agnostic power management | |
WO2011095086A1 (en) | Device based on linux system and method for starting applications thereof | |
JPWO2008023426A1 (en) | Task processing device | |
JP6276470B2 (en) | System and method for reducing standby power of volatile memory in portable computing devices | |
JP2019159802A (en) | Power control method of storage device and storage device | |
US20120102012A1 (en) | Cross-region access method for embedded file system | |
WO2016138785A1 (en) | Method and device for running process | |
CN110554973B (en) | Memory page reclamation in user idle mode | |
JP2018063505A (en) | Memory management control unit, memory management control method and memory management control program | |
WO2011131003A1 (en) | System for realizing mobile phone buffer storage mechanism and method for loading mobile phone operating system | |
KR102116984B1 (en) | Method for controlling memory swap operation and data processing system adopting the same | |
CN105612505B (en) | The method and apparatus of CPU scheduling | |
WO2023045250A1 (en) | Memory pool resource sharing method and apparatus, and device and readable medium | |
KR20100041518A (en) | Selective suspend resume method of reducing initial driving time in system, and computer readable medium thereof |
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: 11866376 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: 11866376 Country of ref document: EP Kind code of ref document: A1 |