WO2012159394A1 - 一种移动设备内存管理方法及装置 - Google Patents

一种移动设备内存管理方法及装置 Download PDF

Info

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
Application number
PCT/CN2011/079602
Other languages
English (en)
French (fr)
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 中兴通讯股份有限公司
Publication of WO2012159394A1 publication Critical patent/WO2012159394A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0634Configuration or reconfiguration of storage systems by changing the state or mode of one or more devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/60Subscription-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

提供一种移动设备内存管理方法与装置。该方法包括:查找与指定应用程序无依赖关系且符合预定算法的至少一个应用程序;将查找到的应用程序作为待交换的应用程序;根据所述待交换的应用程序执行内存交换。本解决方案在进行内存交换时不仅考虑了查找待交换的应用程序的预定算法,还考虑了应用程序间的依赖性。本解决方案消除了无效的内存交换,且提高了用户使用设备时的体验感。

Description

一种移动设备内存管理方法及装置 技术领域
本发明涉及内存管理, 尤其涉及一种移动设备内存管理方法及装置。 背景技术
随着 3G和智能机时代的来临, 手机等移动设备上的应用程序越来越 多, 这类手机等移动设备采用多任务的操作***, 可以同时运行多个任务。 为了提高多任务的用户体验, 手机等移动设备配备了大容量内存。 但是, 内存容量的增加受到成本、 功耗、 体积等的限制。 因此, 如何在多任务情 况下降低内存使用量成为亟待解决的问题。
内存交换是在 PC机和服务器上广泛使用的一种用来降低内存使用量 的方法。 它的基本原理是: 当***内存不足时, 把内存中的一些内容交换 到外存中, 从而腾出内存空间; 当***需要运行到被交换到外存的内容时, 就把交换到外存中的内容再次交换到内存中; 在这个过程中如果发生内存 不足, 就会涉及到另一次交换过程。 这样, ***的有效内存空间大小就是 实际内存大小加上外存上可以用来存放交换内容的空间之和。 通过内存交 换, 可以实现用较少的内存达到更大内存的效果。 目前, PC机和服务器上 的内存交换方法基本上是作为操作***的一个基本功能(即虚拟存储器管 理)模块在操作***的内核中实现, 其使用 LRU ( Least Recently Use, 最 近最少使用) 算法, 将最近最长时间不使用的内容优先交换出去, 并以内 存页为最小单位进行交换。 内存页是操作***管理内存的基本单位, 32位 的 Linux操作***的一个内存页的大小一般为 4KB。
然而, PC机和服务器上使用的内存交换方式存在以下问题:
1 ) 当把最近最长时间不使用的内存页交换出去时, 有可能发生当前要 运行的应用程序就要使用刚被交换出去的内存页, 于是这部分被交换出去 的内存页中的内容又马上要交换到内存中来; 应当理解, 本文中所指的交 换内存页是指交换内存页中的内容;
2 ) 为了提高内存使用率, 操作***每次会选择尽可能少交换内存页, 于是当前要运行的应用程序在正常运行过程中可能又会发生内存不足的情 况, 于是***又会进行内存交换, 以便让应用程序能够正常运行下去。
这两个问题导致无效的内存交换和内存交换过于频繁, 而且, 在进行 内存交换时, ***不能执行任何其它的操作。 因此, 过多和频繁的内存交 换就会使应用程序运行变慢, 运行不流畅, 运行过程中时不时出现短促的 停顿, 这会极大降低用户体验。 PC机和服务器由于 CPU性能强劲, 这种 运行变慢和运行不流畅对用户体验的影响相对轻微, 而手机等移动设备的 CPU性能相对较弱,运行变慢和运行不流畅对用户体验的影响就会很明显, 从而导致用户体验变得很差。 正是由于这个原因, 在手机等移动设备上都 没有使用内存交换来降低内存使用量。 发明内容
本发明要解决的主要技术问题是, 提供一种移动设备中内存管理的方 法及装置, 在通过内存交换降低内存使用量的同时, 尽量不影响用户体验。
根据本发明的一种实施方式, 提供一种移动设备内存管理方法, 包括: 查找与指定应用程序无依赖关系且符合预定算法的至少一个应用程序作为 待交换的应用程序; 根据所述待交换的应用程序执行内存交换处理。
进一步地, 所述查找与指定应用程序无依赖关系且符合预定算法的至 少一个应用程序作为待交换的应用程序这一步驟包括: 从当前运行的应用 程序中查找符合预定算法的应用程序; 从查找到的符合预定算法的应用程 序中查找与指定应用程序无依赖关系的应用程序, 将其作为待交换的应用 程序。 一种实施例中, 根据所述待交换的应用程序执行内存交换处理这一步 驟包括: 选中一个所述待交换的应用程序, 将该选中的应用程序所对应的 进程中符合预定算法的内存页交换到外存中; 判断被交换出去的内存页所 占的内存量与***当前的可用内存量之和是否大于等于预设阈值; 如果不 是, 则继续执行选中一个所述待交换的应用程序这一步驟。
另一种实施例中, 根据所述待交换的应用程序执行内存交换处理这一 步驟包括: 选中一个所述待交换的应用程序, 标记该选中的应用程序; 判 断该标记的应用程序所对应的进程中符合预定算法的内存页所占的内存量 与***当前的可用内存量之和是否大于等于预设阈值; 如果不是, 则继续 执行选中一个所述待交换的应用程序这一步驟; 如果是, 则将所有标记的 应用程序各自对应的进程中符合预定算法的内存页交换到外存中。
又一种实施例中, 根据所述待交换的应用程序执行内存交换处理这一 页交换到外存中。
优选地, 在所述查找与指定应用程序无依赖关系且符合预定算法的至 少一个应用程序作为待交换的应用程序这一步驟之前, 所述还包括: 判断 ***当前的可用内存量是否大于等于预设阈值; 若小于所述预设阈值, 则 执行所述查找与指定应用程序无依赖关系且符合预定算法的应用程序作为 待交换的应用程序步驟; 否则不作处理。
优选地, 所述符合预定算法的应用程序包括应用程序对应的进程所属 的内存页最近最少被 CPU使用的应用程序。
优选地, 在根据所述待交换的应用程序执行内存交换处理这一步驟之 后, 所述方法还包括: 执行正常的应用程序启动流程启动所述指定应用程 序。 根据本发明的另一种实施方式, 提供一种移动设备内存管理装置, 包 括: 应用管理与控制模块, 用于查找与指定应用程序无依赖关系且符合预 定算法的至少一个应用程序作为待交换的应用程序; 内存交换模块, 用于 根据所述应用管理与控制模块的指示, 将所述待交换的应用程序所对应的 进程中符合预定算法的内存页交换到外存中。
进一步地, 所述符合预定算法的应用程序包括应用程序对应的进程所 属的内存页最近最少被 CPU使用的应用程序。
本发明的有益效果在于: 在进行内存交换时既考虑了按预定算法查找 待交换的应用程序, 又考虑到应用程序间的依赖性, 从而消除了无效的内 存交换, 提高了用户使用设备的体验感。 一种实施例中还考虑了一次交换 出去的内存页数量与***当前最大内存使用量的关系, 从而解决了内存交 换过于频繁问题, 降低内存交换频率; 又一种实施例中考虑在启动程序前 完成内存交换, 保证在应用程序运行过程中没有内存交换, 从而消除内存 交换对应用程序运行过程的影响。 附图说明
图 1是本发明实施例提供的移动设备内存管理装置的结构示意图; 图 2是本发明实施例一移动设备内存管理方法的流程示意图; 图 3是本发明实施例二移动设备内存管理方法的流程示意图; 图 4是本发明实施例三移动设备内存管理方法的流程示意图; 图 5是本发明实施例四移动设备内存管理方法的流程示意图; 图 6是本发明实施例五移动设备内存管理方法的流程示意图; 图 7是本发明实施例六移动设备内存管理方法的流程示意图; 图 8是本发明一种实施例应用于 Android手机中的内存管理装置的结构 示意图;
图 9是与图 8相对应的 Android手机中内存管理方法的流程示意图。 具体实施方式
下面通过具体实施方式结合附图对本发明作进一步详细说明。
本发明实施例的设计思想是: 1 )选择要交换出去的内存页时, 既考 虑使用预定算法来选择应用程序, 也考虑将要运行的应用程序是否可能会 使用该选择的应用程序, 只有同时满足两个条件 (内存页符合预定算法且 内存页对应的应用程序与将要运行的应用程序无依赖关系 ) 的内存页才被 选择交换出去; 2 )—次交换出去的内存页数量要满足将要运行的应用程序 可能的最大内存使用量; 3 )内存交换在启动将要运行的应用程序之前完成。 其中, 思想点 1 ) 消除了无效的内存交换, 思想点 2 ) 降低内存交换频率到 只有 1次, 思想点 3 )保证在应用程序运行过程中没有内存交换, 从而消除 内存交换对应用程序运行过程的打扰。 一种实施例中将这三点结合起来, 就可以既使用内存交换来降低内存使用量, 又不会降低应用程序运行的速 度和流畅性, 消除了传统内存交换技术在移动设备如手机上的缺点。
如图 1所示, 本发明一种实施例提供的移动设备中内存管理装置包括: 应用管理与控制模块和内存交换模块。 其中, 应用管理与控制模块, 用于 查找与指定应用程序无依赖关系且符合预定算法的至少一个应用程序作为 待交换的应用程序; 所述内存交换模块, 用于根据所述应用管理与控制模 页交换到外存中。 一种实施例中, 内存是 RAM (随机存取存储器), 外存 是 FLASH (闪存)。
本发明实施方式提供了基于上述内存管理装置的内存管理方法, 包括: 查找与指定应用程序无依赖关系且符合预定算法的至少一个应用程序作为 待交换的应用程序; 根据所述待交换的应用程序执行内存交换处理。
一种实施例中, 预定算法采用最近最少使用 (LRU )算法, 也就是说, 在该实施例中, 符合预定算法的应用程序为应用程序对应的进程所属的内 存页最近最少被 CPU使用的应用程序;其他实施例中还可以使用其他算法, 本发明不限于 LRU这种算法。
一种实施例中, 所述查找与指定应用程序无依赖关系且符合预定算法 的至少一个应用程序作为待交换的应用程序这一步驟包括: 从当前运行的 应用程序中查找符合预定算法的应用程序; 从查找到的符合预定算法的应 用程序中查找与指定应用程序无依赖关系的应用程序, 将其作为待交换的 应用程序。 对于该步驟, 一种示例性做法是: 查找符合预定算法的一个应 用程序; 判断该查找到的应用程序与指定应用程序之间是否存在依赖关系; 若存在依赖关系, 则重新查找下一个符合预定算法的应用程序。 一种实施例中, 该步驟包括: 将所述待交换的应用程序所对应的进程 中符合预定算法的内存页交换到外存中。
另一种实施例中, 该步驟包括: 选中一个所述待交换的应用程序, 将 该选中的应用程序所对应的进程中符合预定算法的内存页交换到外存中; 判断该被交换出去的内存页所占的内存量与***当前的可用内存量之和是 否大于等于预设阈值; 如果不是, 则继续执行选中一个所述待交换的应用 程序这一步驟。 出于执行效率上的考虑, 可将该实施例进行优化, 即该步 驟包括: 选中一个所述待交换的应用程序, 标记该选中的应用程序; 判断 该标记的应用程序所对应的进程中符合预定算法的内存页所占的内存量与 ***当前的可用内存量之和是否大于等于预设阈值; 如果不是, 则继续执 行选中一个所述待交换的应用程序这一步驟; 如果是, 则将所有标记的应 用程序各自对应的进程中符合预定算法的内存页交换到外存中。 这里, 预 设阈值为实验值, 实施例中预设阈值是能满足移动设备中任意一个应用程 序运行时需要的内存量。
一种实施例中, 在所述查找与指定应用程序无依赖关系且符合预定算 法的至少一个应用程序作为待交换的应用程序这一步驟之前, 所述方法还 包括: 判断***当前的可用内存量是否大于等于预设阈值; 若小于预设阈 值, 则执行所述查找与指定应用程序无依赖关系且符合预定算法的应用程 序作为待交换的应用程序步驟; 否则不作处理。 这里, 预设阈值为实验值, 实施例中预设阈值是能满足移动设备中任意一个应用程序运行时需要的内 存量。
一种实施例中, 在根据待交换的应用程序执行内存交换处理这一步驟 之后, 所述方法还包括: 执行正常的应用程序启动流程启动所述指定应用 程序。
以下通过几个实施例并结合图 2-9 详细说明根据本发明实施方式提供 的移动设备内存管理方法。 为便于描述, 以下各实施例中统一采用的预定 算法为前述 LRU算法, 即最近最少被 CPU使用算法; 应理解, 本发明实 施例还可以使用其他算法, 并不限于 LRU算法。
实施例一
如图 2所示, 本实施例包含如下步驟:
步驟 S201 : 按预定算法查找 APP;
采用 LRU算法查找应用程序(APP ), 即在当前运行应用程序列表中查 找应用程序对应的进程所属的内存页最近最少被 CPU使用的应用程序; 可 以理解, 当前运行的应用程序并不一定是正在占用 CPU的应用程序, 而是 操作***为这个应用程序创建了进程的应用程序;
步驟 S202: 判断指定应用程序是否依赖于所查找的应用程序 (APP ) 的组件, 这里, 指定应用程序是指除当前运行的应用程序以外的应用程序, 也即将要运行的应用程序;
若指定应用程序与应用程序 (APP )存在依赖关系, 则排除应用程序 ( APP ), 转步驟 S201 , 查找下一个符合 LRU算法的应用程序; 可以理解, 排除应用程序(APP )是指不将该应用程序(APP )对应的进程所属的内存 页作为可以交换出去的内存页; 步驟 S203 : 进行内存交换, 具体而言, 把查找到的符合 LRU算法的应 用程序(APP )所对应的进程所属的内存页作为可以交换出去的内存页, 将 其交换到外存中; 其中, 被交换出去的内存页是指应用程序所对应的进程 中符合预定算法的内存页;
步驟 S204: 内存交换流程结束。
本实施例既考虑 LRU算法的优势又考虑应用程序之间组件的依赖关 系, 只有同时满足这两个条件的内存页才被选择交换出去, 从而消除了无 效的内存交换。
实施例二
如图 3所示, 本实施例包含如下步驟:
步驟 S301 : 与实施例一的步驟 S201相同, 即, 在当前运行应用程序列 表中查找符合 LRU算法的应用程序 (APP );
步驟 S302: 判断指定应用程序是否依赖于所查找的应用程序 (APP ) 的组件, 同样地, 这里的指定应用程序是除当前运行的应用程序以外的应 用程序。 若存在依赖关系, 则排除该应用程序(APP ), 转步驟 S301 , 查找 下一个符合 LRU算法的应用程序; 若不存在依赖关系, 则转步驟 S303; 步驟 S303 :将步驟 S302中得到的符合预定算法且不存在依赖关系的应 用程序所对应的进程所属的内存页作为可以交换出去的内存页, 通知内存 交换模块把这些内存页交换到外存中; 其中, 被交换出去的内存页是指应 用程序所对应的进程中符合预定算法的内存页;
步驟 S304:把***当前的可用内存量加上步驟 S303中交换出去的内存 量, 判断二者之和是否大于等于预设阈值; 这里, 预设阈值含义如前述, 若二者之和大于等于预设阈值, 转步驟 S305; 否则, 转步驟 S301 , 查 找下一个符合 LRU算法的应用程序;
步驟 S305: 内存交换流程结束。
本实施例不仅考虑 LRU算法的优势又考虑应用程序之间组件的依赖性 关系, 还考虑了进行内存交换的内存量要满足可能使用的最大内存量, 从 而消除了无效的内存交换; 并且, 当进行内存交换的内存量满足可能使用 的最大内存量时不再进行内存交换, 从而降低了交换频率。
实施例三
如图 4所示, 本实施例包括如下步驟:
步驟 S401 : 与实施例一的步驟 S201相同, 即, 在当前运行应用程序列 表中符合 LRU算法的应用程序 (APP )。
步驟 S402: 判断指定应用程序是否依赖于所查找的应用程序 (APP ) 的组件, 同样地, 这里的指定应用程序是除当前运行的应用程序以外的应 用程序。 若存在依赖关系, 则排除该应用程序(APP ), 转步驟 S401 , 查找 下一个符合 LRU算法的应用程序; 若不存在依赖关系, 则转步驟 S403; 步驟 S403:标记步驟 S402中得到的符合预定算法且不存在依赖关系的 应用程序 APP;
步驟 S404:把***当前的可用内存量加上步驟 S403中标记的应用程序 所对应的进程中符合预定算法的内存页所占的内存量, 判断二者之和是否 大于等于预设阈值。 这里, 预设阈值为实验值, 实施例中预设阈值是能满 足移动设备中任意一个应用程序运行时需要的内存量; 其中, 被交换出去 的内存页是指应用程序所对应的进程中符合预定算法的内存页;
若二者之和大于等于预设阈值, 转步驟 S405; 否则, 转步驟 S401 , 查 找下一个符合 LRU算法的应用程序; 步驟 S405: 将所有标记的应用程序各自所对应的进程中符合预定算法 的内存页作为可以交换出去的内存页, 通知内存交换模块把这些内存页交 换到外存中;
步驟 S406: 内存交换流程结束。
可以看出, 本实施例不仅考虑 LRU算法的优势又考虑应用程序之间组 件的依赖性关系, 还考虑了进行一次内存交换的内存量要满足可能使用的 最大内存量, 只有同时满足这三个条件的内存页才被选择交换出去, 从而 既消除了无效的内存交换, 又降低交换频率至只有一次。
本实施例实际上是对实施例二在执行方面的优化, 通过循环找出所有 需要交换出去的应用程序后, 然后集中一次把这些应用程序对应的进程中 符合预定算法的内存页交换到外存中, 从而优化了执行的效率。
实施例四
如图 5所示, 本实施例包括如下步驟:
步驟 S501 : 判断***当前的内存可用量是否大于等于预设阈值,若是, 转步驟 S505; 否则, 转步驟 S502; 这里, 预设阈值含义如前述, 在此不再 赘述;
步驟 S502、 S503、 S504、 S505分别与实施例一中的步驟 S201、 S202、 S203、 S204相同, 在此不再赘述。
本实施例在进行内存交换前, 首先考虑***当前内存可用量, 然后再 进行如实施例一的内存交换方法, 进一步消除了无效的内存交换。
实施例五
如图 6所示, 本实施例包括如下步驟:
步驟 S601 : 判断***当前的内存可用量是否大于等于预设阈值,若是, 转步驟 S606; 否则, 转步驟 S602;
步驟 S602、 S603、 S604、 S605、 S606分别与实施例二中的步驟 S301、 S302、 S303、 S304、 S305相同, 在此不再赘述。
本实施例在进行内存交换前, 首先考虑***当前内存可用量, 然后再 进行如实施例二的内存交换方法, 进一步消除了无效的内存交换。
实施例六
如图 7所示, 包括如下步驟:
步驟 S701 : 判断***当前的内存可用量是否大于等于预设阈值,若是, 转步驟 S707; 否则, 转步驟 S702;
步驟 S702至 S707分别与实施例三的步驟 S401至 S406相同, 在此不 再赘述。
本实施例在进行内存交换前, 首先考虑***当前内存可用量, 然后再 进行如实施例三的内存交换方法, 进一步消除了无效的内存交换。 启动指定应用程序前, 执行如上述各个实施例的内存交换流程, 待内存交 换完毕后再执行该指定应用程序。 这种方式不仅消除了无效的内存交换, 还保证在应用程序运行过程中没有内存交换, 从而消除了内存交换对应用 程序运行过程的打扰。
根据上述各实施例可以理解, 在本发明实施例提供的移动设备内存管 理装置中, 内存交换模块负责把指定的内存页的内容交换到外存中, 以及 把交换在外存中的内存页的内容在需要使用时 (也就是 CPU要读写这些内 存页所属地址的内容时) 自动读入到指定的内存页中; 而应用管理与控制 模块负责选择要交换出去的内存页和决定把内存页交换出去的时机, 需要 注意的是, 实施例中应用管理与控制模块只是控制交换出去, 而把交换出 去的内容交换进来则是由内存交换模块自动完成的 (该功能是由操作*** 内核的缺页中断来完成的, 本领域技术人员可通过现有技术实现) 。 可以 理解, 本发明中的这种模块划分是为了描述方便而引入的一种逻辑上的概 念, 具体实现时, 既可以一个模块对应一个独立的软件模块实体(如函数、 类、 进程、 线程等) , 也可以多个模块对应一个软件模块实体, 或者一个 模块对应多个软件模块实体。
下面以 Android手机为例来进一步说明本发明一种实施例提供的移动 设备内存管理方法。 现有技术中, Android手机采用了 Linux操作***技术 和 Java技术, 这使得 Android手机的运行对内存大小非常敏感。 当内存比 较小时, Android手机运行会非常緩慢。 为此, Android手机基本上都配备 了大容量的内存。
如图 8所示, 应用管理与控制模块由 ActivityManagerService (活动管 理服务 )和 PackageManageService (包管理服务 )这两个类组成, 而内存交 换模块由 Linux操作***内核中的虚拟存储管理模块组成。另夕卜,应用管理 与控制模块和内存交换模块之间的通信采用虚拟设备驱动程序 —— MMUDriver (虚存控制驱动)来完成。
如图 9所示, 本例包含如下步驟:
步驟 S901 : ActivityManagerService打开 MMUDriver, 准备进行内存交 换处理。
步驟 S902: ActivityManagerService检查***当前可用的内存量是否大 于等于预设阈值, 如果是, 转步驟 S909; 否则, 转步驟 S903。 这里, 预设 阈值通过实验来确定, 原则上是能够满足手机上任意一个应用运行时需要 的内存量;
步驟 S903: ActivityManagerService从当前运行的应用程序列表中找出 符合 LRU算法的应用程序;
步骤 S904: ActivityManagerService通过 PackageManagerService检查当 前待启动的应用程序的描述信息, 看其所要依赖的外部应用程序组件, 可 通过 Intent方式描述, 把这些信息进一步转换成要依赖的应用程序名称; 步驟 S905: ActivityManagerService查询当前运行的应用程序列表, 将 该表按 LRU算法的原则进行排序 (称为 LRU表), 从 LRU表中选出第一 个不在步驟 S904中的应用程序(也就是说, 该应用程序对应的进程所属的 某些内存页最近最少被 CPU使用且其组件不被依赖), 作为要交换出去的 应用程序;
步驟 S906: ActivityManagerService把步驟 S905 中选出的应用程序所 对应的进程号 ( PID ) 以写 MMUDriver驱动的方式发给 MMUDriver驱动, 然后通过读 MMUDriver驱动的方式等待 MMUDriver驱动返回处理结果; 步驟 S907: MMUDriver驱动收到步驟 S906中 ActivityManagerService 发来的进程号后,以进程号调用 Linux内核的函数让内核的虚拟存储管理模 块把这个进程所占有的符合预定算法的内存页中的内容交换到外存中, 完 成这个操作后, MMUDriver驱动向上层回写一个状态值;
步驟 S908:步驟 S906中 ActivityManagerService—直在等待 MMUDriver 驱动的返回结果, 待结果反馈时, ActivityManagerService解除等待, 读出 MMUDriver驱动回写的状态值, 继续往下执行如下操作: 查看***当前的 空闲内存是否大于等于预设阈值, 如果是, 则转步驟 S909; 否则, 从 LRU 表中排除刚交换出去的应用, 转步驟 S903;
步驟 S909: 执行应用程序启动, 流程结束。
可以理解, 作为一种执行效率上的优化, ActivityManagerService 可以 先循环找出所有需要交换出去的应用程序后, 然后集中一次通知 MMUDriver驱动把这些应用程序所对应的进程中符合预定算法的内存页交 换到外存中。
从上述各实施例可以看出, 本发明实施例通过改进传统的内存交换方 法来降低无效的内存交换, 减弱传统内存交换方法对应用程序运行流畅度 的影响, 从而移动设备如手机上的内存使用量得以降低且又不影响用户体 验。
上述实施例只是本发明的举例, 尽管为说明目的公开了本发明的最佳 实施例和附图, 但是本领域的技术人员可以理解: 在不脱离本发明及所附 的权利要求的精神和范围内, 各种替换、 变化和修改都是可能的。 因此, 本发明不应局限于最佳实施例和附图所公开的内容。

Claims

权利要求书
1、 一种移动设备内存管理方法, 其特征在于, 包括:
查找与指定应用程序无依赖关系且符合预定算法的至少一个应用程序 作为待交换的应用程序;
根据所述待交换的应用程序执行内存交换处理。
2、 如权利要求 1所述的方法, 其特征在于, 所述查找与指定应用程序 无依赖关系且符合预定算法的至少一个应用程序作为待交换的应用程序这 一步驟包括:
从当前运行的应用程序中查找符合预定算法的应用程序;
从查找到的符合预定算法的应用程序中查找与指定应用程序无依赖关 系的应用程序, 将其作为待交换的应用程序。
3、 如权利要求 1或 2所述的方法, 其特征在于, 根据所述待交换的应 用程序执行内存交换处理这一步驟包括:
选中一个所述待交换的应用程序, 将该选中的应用程序所对应的进程 中符合预定算法的内存页交换到外存中;
判断被交换出去的内存页所占的内存量与***当前的可用内存量之和 是否大于等于预设阈值; 如果不是, 则继续执行选中一个所述待交换的应 用程序这一步驟。
4、 如权利要求 1或 2所述的方法, 其特征在于, 根据所述待交换的应 用程序执行内存交换处理这一步驟包括:
选中一个所述待交换的应用程序, 标记该选中的应用程序;
判断该标记的应用程序所对应的进程中符合预定算法的内存页所占的 内存量与***当前的可用内存量之和是否大于等于预设阈值; 如果不是, 则继续执行选中一个所述待交换的应用程序这一步驟; 如果是, 则将所有 标记的应用程序各自对应的进程中符合预定算法的的内存页交换到外存 中。
5、 如权利要求 1或 2所述的方法, 其特征在于, 根据所述待交换的应 用程序执行内存交换处理这一步驟包括: 将所述待交换的应用程序所对应 的进程中符合预定算法的内存页交换到外存中。
6、 如权利要求 1至 5任一项所述的方法, 其特征在于, 在所述查找与 指定应用程序无依赖关系且符合预定算法的至少一个应用程序作为待交换 的应用程序这一步驟之前, 所述方法还包括:
判断***当前的可用内存量是否大于等于预设阈值; 若小于所述预设 阈值, 则执行所述查找与指定应用程序无依赖关系且符合预定算法的应用 程序作为待交换的应用程序步驟; 否则不作处理。
7、 如权利要求 1至 6任一项所述的方法, 其特征在于, 所述符合预定 算法的应用程序包括应用程序对应的进程所属的内存页最近最少被 CPU使 用的应用程序。
8、 如权利要求 1至 7任一项所述的方法, 其特征在于, 在根据所述待 交换的应用程序执行内存交换处理这一步驟之后, 所述方法还包括: 执行 正常的应用程序启动流程启动所述指定应用程序。
9、 一种移动设备内存管理装置, 其特征在于, 包括:
应用管理与控制模块, 用于查找与指定应用程序无依赖关系且符合预 定算法的至少一个应用程序作为待交换的应用程序;
内存交换模块, 用于根据所述应用管理与控制模块的指示, 将所述待 交换的应用程序所对应的进程中符合预定算法的内存页交换到外存中。
10、 如权利要求 9所述的装置, 其特征在于, 所述符合预定算法的应 用程序包括应用程序对应的进程所属的内存页最近最少被 CPU使用的应用 程序。
PCT/CN2011/079602 2011-05-23 2011-09-14 一种移动设备内存管理方法及装置 WO2012159394A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110135149.7 2011-05-23
CN2011101351497A CN102226894A (zh) 2011-05-23 2011-05-23 一种移动设备内存管理方法及装置

Publications (1)

Publication Number Publication Date
WO2012159394A1 true WO2012159394A1 (zh) 2012-11-29

Family

ID=44807862

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/079602 WO2012159394A1 (zh) 2011-05-23 2011-09-14 一种移动设备内存管理方法及装置

Country Status (2)

Country Link
CN (2) CN102226894A (zh)
WO (1) WO2012159394A1 (zh)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103838620A (zh) * 2012-11-20 2014-06-04 中兴通讯股份有限公司 处理应用程序方法和装置
CN103117923B (zh) * 2013-01-18 2016-06-29 杭州华三通信技术有限公司 一种进程管理方法和设备
CN103106093A (zh) * 2013-02-21 2013-05-15 北京奇虎科技有限公司 一种***运行加速方法和装置
CN104156226B (zh) * 2013-05-15 2019-01-15 索尼公司 混合内存设备的挂起或关机方法
CN104461737B (zh) * 2014-12-10 2018-01-16 广东欧珀移动通信有限公司 一种内存管理方法和装置
CN105988842B (zh) * 2015-02-12 2019-06-11 Oppo广东移动通信有限公司 一种转移应用程序的方法及终端
CN105988875B (zh) * 2015-03-04 2020-08-14 华为技术有限公司 一种运行进程的方法及装置
CN106502768A (zh) * 2016-09-22 2017-03-15 南京酷派软件技术有限公司 一种应用程序处理方法、装置、终端及服务器
CN106873664A (zh) * 2017-02-28 2017-06-20 努比亚技术有限公司 一种温度控制方法及移动终端
CN110018902B (zh) * 2018-01-10 2023-01-31 Oppo广东移动通信有限公司 内存处理方法和装置、电子设备、计算机可读存储介质
US20190370009A1 (en) * 2018-06-03 2019-12-05 Apple Inc. Intelligent swap for fatigable storage mediums
CN111475083A (zh) * 2020-04-03 2020-07-31 惠州Tcl移动通信有限公司 应用跳转的方法、装置、存储介质及移动终端

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1829979A (zh) * 2003-08-05 2006-09-06 Sap股份公司 数据缓存方法
CN101246427A (zh) * 2007-02-15 2008-08-20 凌阳科技股份有限公司 应用程序可重定位加载的方法及地址重定位装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
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 (zh) * 2008-09-26 2010-03-31 深圳市朗科科技股份有限公司 扩展图像通信设备功能的方法及***
CN101847127B (zh) * 2010-06-18 2012-01-25 福建星网锐捷网络有限公司 一种内存管理方法及装置
CN101882160B (zh) * 2010-06-29 2012-09-12 宇龙计算机通信科技(深圳)有限公司 一种网页管理方法及移动终端

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1829979A (zh) * 2003-08-05 2006-09-06 Sap股份公司 数据缓存方法
CN101246427A (zh) * 2007-02-15 2008-08-20 凌阳科技股份有限公司 应用程序可重定位加载的方法及地址重定位装置

Also Published As

Publication number Publication date
CN106843758A (zh) 2017-06-13
CN102226894A (zh) 2011-10-26

Similar Documents

Publication Publication Date Title
WO2012159394A1 (zh) 一种移动设备内存管理方法及装置
WO2018059079A1 (zh) 一种内存管理方法和装置
KR101799253B1 (ko) 다중 클러스터 이종 프로세서 아키텍처에서 동적 캐시 확장을 제공하기 위한 시스템 및 방법
JP5865931B2 (ja) プラットフォーム非依存型パワー管理
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
CN107924225B (zh) 用于动态地调整存储器状态转变定时器的***和方法
TW201717027A (zh) 用於具有適應性預取之快閃記憶體讀取快取之系統及方法
JP2012529692A (ja) メモリアレイにおける読み出し待ち時間を短縮するためのメモリ操作の一時停止
JPWO2009157178A1 (ja) 仮想計算機制御装置、仮想計算機制御プログラム及び仮想計算機制御回路
CN102495756A (zh) 操作***在不同的中央处理器之间切换的方法及***
WO2011095086A1 (zh) 一种基于linux***的设备及其应用启动的方法
JP2019159802A (ja) 記憶装置の電力制御方法および記憶装置
US20130036426A1 (en) Information processing device and task switching method
WO2016138785A1 (zh) 一种运行进程的方法及装置
US20120102012A1 (en) Cross-region access method for embedded file system
JP2018063505A (ja) メモリ管理制御装置、メモリ管理制御方法、及びメモリ管理制御プログラム
WO2011131003A1 (zh) 实现手机缓冲存储器机制的***及手机操作***加载方法
KR102116984B1 (ko) 메모리 스왑 오퍼레이션 제어 방법 및 이를 적용하는 데이터 처리 시스템
JP2008262451A (ja) メモリ電源管理装置及びメモリ電源管理方法
WO2023045250A1 (zh) 一种内存池资源共用的方法、装置、设备及可读介质
KR20100041518A (ko) 시스템에서 초기 구동시간을 단축시키는 선택적 서스펜드 리쥼 방법 및 그 기록매체
JP5505195B2 (ja) メモリの制御装置、及び制御方法
JP2011013836A (ja) メモリ配置管理装置及びマイクロプロセッサ
JP2016026345A (ja) メモリアレイにおける読み出し待ち時間を短縮するためのメモリ操作の一時停止

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