This application is filed based upon and claims priority to Chinese Patent Application No. 201711489135.9, entitled “Memory Processing Method and Device, Electronic Device and Computer-readable Storage Medium”, filed on Dec. 29, 2017, the entire contents of which are incorporated herein by reference.
The disclosure relates to the field of data processing, and in particular to a method and device for processing a memory, and a computer-readable storage medium.
When an application installed on an electronic device operates, a certain memory needs to be occupied. The memory is a main data storage medium of an application during operation. Since the memory capacity of the electronic device is limited, when the memory occupied by background applications is excessive, the operation efficiency of a foreground application may be affected. Therefore, it is necessary to reclaim the memory, so as to improve the operation efficiency of the foreground application.
A related method for processing a memory is to totally reclaim memories occupied by a single application operating in the background. However, it is necessary to reload almost all reclaimed memories during the next starting and execution process after the memories used by a single application are completely reclaimed, resulting in the remarkable reduction of the operation speed of a memory-reclaimed application.
The embodiments of the disclosure provide a method for processing a memory and apparatus, and a computer-readable storage medium
In a first aspect, there is provided a method for processing a memory. The method is carried out by an electronic device. In the method, multiple reclaimable memory pages occupied by an application to be processed are acquired, an idle duration of the application to be processed for each reclaimable memory page is acquired, a duration threshold according to the idle durations for the reclaimable memory pages is determined, and at least one memory page, for which the idle duration exceeds the duration threshold, of the plurality of reclaimable memory pages is reclaimed.
In a second aspect, there is provided an electronic device including a storage having stored thereon a computer program and a processor. The storage has stored thereon a computer program that when executed by the processor causes the processor to: acquire a plurality of reclaimable memory pages occupied by an application to be processed; acquire an idle duration of the application to be processed for each reclaimable memory page; determine a duration threshold according to the idle durations for the reclaimable memory pages; and reclaim at least one memory page, for which the idle duration exceeds the duration threshold, of the plurality of reclaimable memory pages.
In a third aspect, there is provided a non-transitory computer-readable storage medium having a computer program stored thereon that when executed by a processor, causes the processor to implement a method according to the first aspect.
In order to describe the technical solutions in the embodiments of the disclosure or related art more clearly, the drawings required to be used in descriptions about the embodiments or the related art will be simply introduced below. It is apparent that the drawings in the following descriptions are only some embodiments of the disclosure. Those of ordinary skilled in the art may further obtain other drawings according to these drawings without creative work.
In order to make the objectives, technical solutions and advantages of the disclosure clearer, the disclosure will be further elaborated below in conjunction with the drawings and the embodiments. It will be appreciated that specific embodiments described here are only used to explain the disclosure, not to limit the disclosure.
The embodiments of the disclosure provide at least the following solutions.
Solution 1. A method for processing a memory, the method being carried out by an electronic device, and including:
acquiring a plurality of reclaimable memory pages occupied by an application to be processed;
acquiring an idle duration of the application to be processed for each reclaimable memory page;
determining a duration threshold according to the idle durations for the reclaimable memory pages; and
reclaiming at least one memory page, for which the idle duration exceeds the duration threshold, of the plurality of reclaimable memory pages.
Solution 2. The method of solution 1, wherein acquiring an idle duration of the application to be processed for each reclaimable memory page includes:
acquiring update time recorded by a timestamp of each reclaimable memory page, the update time indicating time when the reclaimable memory page was used most recently; and calculating an idle duration for the reclaimable memory page according to the update time.
Solution 3. The method of solution 2, wherein the acquiring update time recorded by a timestamp of each reclaimable memory page includes:
for each reclaimable memory page, creating, by a resource priority and limitation management module in the electronic device, a timestamp for recording an update time of the reclaimable memory page; and
in responsive to that use of the reclaimable memory page is detected, updating the time stamp for the reclaimable memory page.
Solution 4. The method of solution 3, wherein the use of the reclaimable memory page is detected when at least one of allocation of the reclaimable memory page, recovery of the reclaimable memory page, release of the reclaimable memory page, or querying of using condition of a cache in a processor of the electronic device is detected.
Solution 5. The method of solution 1, wherein acquiring an idle duration of the application to be processed for each reclaimable memory page includes:
providing a Least Recently Used (LRU) management unit in a memory management unit or a cache unit in a processor of the electronic device;
recording, by the LRU management unit, a plurality of memory addresses and update time of each memory address;
acquiring an update time of each of the plurality of reclaimable memory pages according to an update time of a memory address corresponding to the reclaimable memory page; and
calculating an idle duration for the reclaimable memory page according to the update time of the reclaimable memory page.
Solution 6. The method of solution 1, wherein determining a duration threshold according to the idle durations for the plurality of reclaimable memory pages includes:
calculating an average idle duration of the application to be processed for the reclaimable memory pages according to the idle durations for the reclaimable memory pages, and taking the average idle duration as a duration threshold.
Solution 7. The method of solution 1, wherein determining a duration threshold according to the idle durations for the plurality of reclaimable memory pages includes:
acquiring a reclaiming number of reclaimable memory pages; and
selecting the Kth-largest idle duration from the idle durations for the plurality of reclaimable memory pages according to the reclaiming number, and taking the Kth-largest idle duration as a duration threshold, the number of reclaimable memory pages each having an idle duration greater than the Kth-largest idle duration being the reclaiming number, K being a natural number not greater than the reclaiming number.
Solution 8. The method of solution 7, wherein acquiring a reclaiming number of reclaimable memory pages includes:
acquiring correspondences between re-starting durations and reclaiming proportions corresponding to the application to be processed, the re-starting duration being a duration for restarting the application to be processed after the reclaiming proportion of the reclaimable memory pages occupied by the application to be processed are reclaimed;
determining a reclaiming proportion of reclaimable memory pages according to the correspondences between reclaiming proportions and re-starting durations; and
determining a reclaiming number according to the reclaiming proportion and the total number of the reclaimable memory pages.
Solution 9. The method of solution 1, wherein the acquiring a plurality of reclaimable memory pages occupied by an application to be processed includes:
traversing a plurality of memory-mapped files of the application to be processed;
querying, in the plurality of memory-mapped files, all memory pages occupied by the application to be processed; and
eliminating a memory page carrying an occupation mark from all the memory pages to acquire reclaimable memory pages from memory pages other than the eliminated memory page.
Solution 10. The method of solution 1, wherein before acquiring reclaimable memory pages occupied by an application to be processed, the method further includes:
detecting whether a foreground application depends on the application to be processed;
if a foreground application depends on the application to be processed, adjusting the priority of the application to be processed to match the foreground application; and
if a foreground application does not depend on the application to be processed, performing the operation of acquiring reclaimable memory pages occupied by an application to be processed.
Solution 11. An electronic device including a storage having stored thereon a computer program and a processor, the storage having stored thereon a computer program that when executed by the processor causes the processor to:
acquire a plurality of reclaimable memory pages occupied by an application to be processed;
acquire an idle duration of the application to be processed for each reclaimable memory page;
determine a duration threshold according to the idle durations for the reclaimable memory pages; and
reclaim at least one memory page, for which the idle duration exceeds the duration threshold, of the plurality of reclaimable memory pages.
Solution 12. The electronic device of solution 11, wherein acquiring an idle duration of the application to be processed for each reclaimable memory page includes:
acquiring update time recorded by a timestamp of each reclaimable memory page, the update time indicating time when the reclaimable memory page was used most recently; and calculating an idle duration for the reclaimable memory page according to the update time.
Solution 13. The electronic device of solution 12, wherein the acquiring update time recorded by a timestamp of each reclaimable memory page includes:
for each reclaimable memory page, creating, by a resource priority and limitation management module in the electronic device, a timestamp for recording an update time of the reclaimable memory page; and
in responsive to that use of the reclaimable memory page is detected, updating the time stamp for the reclaimable memory page.
Solution 14. The electronic device of solution 13, wherein the use of the reclaimable memory page is detected when at least one of allocation of the reclaimable memory page, recovery of the reclaimable memory page, release of the reclaimable memory page, or querying of using condition of a cache in a processor of the electronic device is detected.
Solution 15. The electronic device of solution 11, wherein acquiring an idle duration of the application to be processed for each reclaimable memory page includes:
providing a Least Recently Used (LRU) management unit in a memory management unit or a cache unit in a processor of the electronic device;
recording, by the LRU management unit, a plurality of memory addresses and update time of each memory address;
acquiring an update time of each of the plurality of reclaimable memory pages according to an update time of a memory address corresponding to the reclaimable memory page; and
calculating an idle duration for the reclaimable memory page according to the update time of the reclaimable memory page.
Solution 16. The electronic device of solution 11, wherein determining a duration threshold according to the idle durations for the plurality of reclaimable memory pages includes:
calculating an average idle duration of the application to be processed for the reclaimable memory pages according to the idle durations for the reclaimable memory pages, and taking the average idle duration as a duration threshold.
Solution 17. The electronic device of solution 11, wherein determining a duration threshold according to the idle durations for the plurality of reclaimable memory pages includes:
acquiring a reclaiming number of reclaimable memory pages; and
selecting the Kth-largest idle duration from the idle durations for the plurality of reclaimable memory pages according to the reclaiming number, and taking the Kth-largest idle duration as a duration threshold, the number of reclaimable memory pages each having an idle duration greater than the Kth-largest idle duration being the reclaiming number, K being a natural number not greater than the reclaiming number.
Solution 18. The electronic device of solution 17, wherein acquiring a reclaiming number of reclaimable memory pages includes:
acquiring correspondences between re-starting durations and reclaiming proportions corresponding to the application to be processed, the re-starting duration being a duration for restarting the application to be processed after the reclaiming proportion of the reclaimable memory pages occupied by the application to be processed are reclaimed;
determining a reclaiming proportion of reclaimable memory pages according to the correspondences between reclaiming proportions and re-starting durations; and
determining a reclaiming number according to the reclaiming proportion and the total number of the reclaimable memory pages.
Solution 19. The electronic device of solution 11, wherein the acquiring a plurality of reclaimable memory pages occupied by an application to be processed includes:
traversing a plurality of memory-mapped files of the application to be processed;
querying, in the plurality of memory-mapped files, all memory pages occupied by the application to be processed; and
eliminating a memory page carrying an occupation mark from all the memory pages to acquire reclaimable memory pages from memory pages other than the eliminated memory page.
Solution 20. The electronic device of solution 11, wherein the processor is further configured to:
before acquiring reclaimable memory pages occupied by an application to be processed, detect whether a foreground application depends on the application to be processed;
if a foreground application depends on the application to be processed, adjusting the priority of the application to be processed to match the foreground application; and
if a foreground application does not depend on the application to be processed, perform the operation of acquiring reclaimable memory pages occupied by an application to be processed.
Solution 21. A non-transitory computer-readable storage medium having a computer program stored thereon that when executed by a processor, causes the processor to implement a method, the method including:
acquiring a plurality of reclaimable memory pages occupied by an application to be processed;
acquiring an idle duration of the application to be processed for each reclaimable memory page;
determining a duration threshold according to the idle durations for the reclaimable memory pages; and
reclaiming at least one memory page, for which the idle duration exceeds the duration threshold, of the plurality of reclaimable memory pages.
Solution 22. A device for processing a memory, including:
a memory page acquisition module, configured to acquire reclaimable memory pages occupied by an application to be processed;
a duration determination module, configured to acquire an idle duration of the application to be processed for each reclaimable memory page, and determine a duration threshold according to the idle durations for the reclaimable memory pages; and
a memory reclaiming module, configured to select from the reclaimable memory pages a memory page for which the idle duration exceeds the duration threshold and reclaim the memory page.
In an embodiment, as illustrated in
A person skilled in the art may understand that the structure illustrated in
In an embodiment, as illustrated in
In an embodiment, as illustrated in
In block 302, reclaimable memory pages occupied by an application to be processed are acquired.
The application to be processed represents an application of which the occupied memory needs to be reclaimed. Usually, the application to be processed is a background application. The background application is an application operating in the background, and correspondingly, an application operating in the foreground is a foreground application. The operation of an application (APP) is usually embodied by the operation of multiple associated processes. The process is an operation activity of a program in a computer about a certain data set, is a basic unit of a system for resource allocation and scheduling, and is the basis of an operating system structure. A process involved in the operation of the foreground application is a foreground process, and a process involved in the operation of the background application is a background process.
The application in an operating state needs to occupy a memory space to store data during operation. Memory spaces occupied by different applications in different operating states are not necessarily the same. A memory page is a memory management unit of the operating system, and unit memory sizes occupied by memory pages set by different electronic devices are not necessarily the same. For example, the memory space in the electronic device is divided into 100,000 memory pages, memory pages occupied by the application to be processed are the memory page 100 to the memory page 200, and the memory page 130 to the memory page 200 therein are reclaimable memory pages.
In an embodiment, the electronic device may pre-record all memory pages occupied by the application to be processed during operation, and reclaimable memory pages are acquired from all the memory pages. The reclaimable memory pages represent memory pages which are reclaimable and do not affect or slightly affect the operation of the application to be processed or other applications.
In an embodiment, the electronic device may record which memory pages are reclaimable memory pages and which memory pages are non-reclaimable memory pages among all the memory pages, and may acquire reclaimable memory pages occupied by the application to be processed according to record information.
In block 304, an idle duration of the application to be processed for each reclaimable memory page is acquired.
Since the data stored in the memory page is not always used by the application, the idle duration of the memory page represents a duration that the data stored in the memory page is in a non-used state after being used recently after the system allocates a memory to the application to be processed. The electronic device updates the idle duration of each memory page in real time according to the data using situation of each memory page, and when it is prepared to reclaim the memory page occupied by the application to be processed, the idle duration of each reclaimable memory page recently recorded may be acquired.
In an embodiment, under the situation of recently initiating allocation, reclaiming, release and the like of the memory page, or under the condition of querying the using condition of a cache in the processor, it is determined that data in the memory page correspondingly involved is used, and the time of recently using the data in the memory page for the system under the corresponding situation is generated, the difference between the current time and the recent time being the idle duration of the corresponding memory page.
In an embodiment, the electronic device may create a corresponding timestamp for each memory page, and the timestamp records the recent using time of the data in the corresponding memory page. In the operating system, every time the allocation, reclaiming, release and the like of the memory page are initiated, the activity of the corresponding memory page may be updated, and the update time is recorded in the timestamp. Or, when the system checks the using condition of the cache of the processor regularly, it may be determined that data in the current cache is currently used data, a timestamp of the involved memory page is updated, and the update time is recorded in the timestamp. Alternatively, the previous update time may be replaced with the update time recently recorded, so as to reduce the resource occupation of the update time.
In block 306, a duration threshold is determined according to the idle durations for the reclaimable memory pages.
The duration threshold represents a critical value used to determine whether to reclaim the reclaimable memory page. The duration threshold may be a fixed value, or a duration threshold determined according to the idle duration of each reclaimable memory page. If the idle durations are different, the determined duration thresholds are not necessarily the same.
In an embodiment, the duration threshold may be a weighted average value of the idle durations of all reclaimable memory pages, or an idle duration may be selected from the idle durations of all the reclaimable memory pages, and the selected idle duration is taken as a duration threshold. For example, an idle duration approximate to a median or at a certain position may be selected from the idle durations of all the reclaimable memory pages, and the selected idle duration is taken as a duration threshold.
In block 308, a memory page for which the idle duration exceeds the duration threshold is selected from the reclaimable memory pages to be reclaimed.
The electronic device may select a memory page for which the idle duration exceeds the duration threshold from the reclaimable memory pages occupied by the application to be processed according to the determined duration threshold for reclaiming, so as to release the reclaimable memory page corresponding to the duration threshold to be used by the foreground application or other applications, thereby improving the comprehensive processing efficiency of the system. Alternatively, the electronic device may reclaim the memory page from the reclaimable memory pages through the above-mentioned process memory reclaiming module 234 according to the duration threshold, and release a memory that has been unused for a long time, so that the memory using efficiency is improved, and after the memory page is reclaimed, the influence on the application to be processed is slight.
For example, there are 100 reclaimable memory pages, the corresponding idle durations are between 5 s to 15 min respectively, when a duration threshold determined according to the idle duration is 5 min, memory pages of which the idle duration exceeds 5 min may be reclaimed from the 100 reclaimable memory pages, and the reclaimed memory pages are released, so that the idle memory pages of the electronic device are correspondingly increased, and may be used by the foreground application or other background applications.
In the above-mentioned method for processing a memory, reclaimable memory pages occupied by an application to be processed and an idle duration thereof are acquired, a duration threshold is determined according to the idle duration, and a memory page for which the idle duration exceeds the duration threshold is reclaimed. Since the reclaimed object is a reclaimable memory page and not all the reclaimable memory pages are necessarily reclaimed, a memory page of which the idle duration exceeds a corresponding duration threshold is selected to be reclaimed according to the idle duration of each reclaimable memory page, thus reducing the operation influence on the application to be processed. Moreover, the reclaimed memory page may be released and used by other applications, thereby ensuring that the adverse impact on each application is slight when the entire system memory is increased, improving the memory using efficiency, and maintaining the balance between the reclaiming and operation of the memory of the application to be processed. In other words, the operation efficiency of a foreground application can be improved and the influence on the operation of a memory-reclaimed application can be reduced.
In an embodiment, block 304 includes: acquiring update time recorded by a timestamp of each reclaimable memory page, and calculating an idle duration for the reclaimable memory page according to the update time.
The electronic device may create a timestamp for each memory page through the above-mentioned resource priority and limitation management module 222, the timestamp is used to record the corresponding update time, and the update time represents the recent using time of the corresponding memory page. When it is detected that the memory in each memory page is used, the update time recorded by the timestamp may be updated.
Under the situation of recently initiating allocation, reclaiming, release and the like of the memory page, or under the condition of querying the using condition of a cache in the processor, it is determined that data in the memory page correspondingly involved is used, and the system time under the corresponding situation is generated as the update time. When a memory reclaiming mechanism starts to be executed, the idle duration of the corresponding memory page may be calculated according to the update time recorded by the timestamp and the current system time. The difference between the current time and the recent time is the idle duration of the corresponding memory page.
The update time of each reclaimable memory page is recorded in a manner of creating a timestamp through software, and the idle duration is determined according to the update time, so that different processors may be effectively compatible, and the universality of memory reclaiming is improved.
In an embodiment, block 304 includes: acquiring update time of each reclaimable memory page recorded through an LRU management unit, and calculating an idle duration for the reclaimable memory page according to the update time.
A corresponding LRU management unit is disposed in a memory management or cache unit in the processor, and configured to make statistics on the recently used memories. The LRU management unit may record each memory address and update time of the memory address, and when the memory corresponding to a certain address is used, the processor puts the corresponding memory address and update time into the LRU management unit for saving. When a memory reclaiming mechanism starts to be executed, a memory page corresponding to each memory address may be known according to correspondences between the memory address and the memory page, so that the update time of the corresponding memory page may be read from the LRU management unit. Under the situation of recently initiating allocation, reclaiming, release and the like of the memory page, or under the condition of querying the using condition of a cache in the processor, it is determined that data in the memory page correspondingly involved is used, and the system time under the corresponding situation is generated as the update time.
When the LRU management unit expires, interruption information may be generated and notified to the operating system, and the operating system may empty data therein after reading the data of the LRU management unit, so that the LRU management unit may restart working to store information such as each memory address and the corresponding update information.
In the present embodiment, by creating an LRU management unit, the using condition of each memory may be accurately tracked, thereby improving the detection accuracy of the update time of the memory page, and also improving the convenience of memory reclaiming.
In an embodiment, block 306 includes calculating an average idle duration of the application to be processed for the reclaimable memory pages according to the idle durations for the reclaimable memory pages, and taking the average idle duration as a duration threshold.
The average idle duration may be an average value of occupation durations of each memory page in reclaimable memory pages occupied by the application to be processed. The electronic device may call the corresponding calculation unit to perform calculation according to the counted occupation duration of each memory page, so as to calculate the average idle duration and take the average idle duration as a duration threshold.
By taking the average idle duration as a duration threshold, the calculation efficiency of the duration threshold may be improved, and the calculation is simple, so as to correspondingly improve the efficiency of memory reclaiming.
In an embodiment, the operation of determining a duration threshold according to the idle durations for the reclaimable memory pages includes acquiring a reclaiming number of the reclaimable memory pages; selecting the Kth-largest idle duration from the idle durations for the reclaimable memory pages according to the reclaiming number, and taking the selected idle duration as a duration threshold, the number of idle durations greater than the Kth-largest idle duration being the reclaiming number.
The reclaiming number is a reclaiming number of memory pages, the number being a positive integer. The reclaiming number may be determined according to one or more of the priority of the application to be processed, the total number of occupied reclaimable memory pages, the idle duration or the like. Alternatively, the reclaiming number may be negatively correlated to the priority of the corresponding application, and positively correlated to the total number of the reclaimable memory pages. When the priority of the corresponding application is lower, the reclaiming number is larger accordingly; and when the total number of the reclaimable memory pages is larger, the corresponding reclaiming number is also larger.
The electronic device may sort the idle durations of each reclaimable memory page in an ascending order, and select the Kth-largest idle duration as the duration threshold. The number of idle durations greater than the Kth-largest idle duration is the reclaiming number. It may be understood that K is a natural number not greater than the reclaiming number. For example, the total number of the reclaimable memory pages is 100, when the determined reclaiming number is 50, K=51, the 51st-largest idle duration may be selected from the idle durations of the 100 reclaimable memory pages as the duration threshold, and 50 reclaimable memory pages of which the idle durations exceed the 51st-largest idle duration are selected to be reclaimed.
The Kth-largest idle duration is selected as the duration threshold, so that the reclaiming flexibility of reclaimable memory pages is improved.
In an embodiment, the operation of acquiring a reclaiming number of reclaimable memory pages includes acquiring a reclaiming proportion corresponding to the application to be processed; and determining the reclaiming number according to the reclaimable memory pages and the reclaiming proportion.
The reclaiming proportion represents a proportion of reclaiming of memories to be reclaimed, and the reclaiming proportion is used to guide the magnitude of reclaiming reclaimable memories. For example, the reclaimed portion is 50%, which represents that 50% of occupied memories may be reclaimed. The electronic device presets reclaiming proportions corresponding to different applications. Alternatively, correspondences between different reclaiming proportions and application identifiers may be established, and the electronic device may acquire the corresponding reclaiming proportion according to the corresponding relationship between the application identifier of the application to be processed and the reclaiming proportion. The application identifier is used to uniquely identify an application, and may be constituted by one or more of a preset digit of number, letter or other characters.
In an embodiment, the reclaiming proportion may be determined according to the re-starting duration of the application to be processed, and the electronic device may pre-test reclaiming of reclaimable memory pages occupied by the application to be processed according to different proportions. The starting duration needed when the application to be processed is re-started after the memory page corresponding to the proportion is reclaimed is detected, the starting duration being the re-starting duration. A relatively appropriate proportion is determined according to the re-starting duration corresponding to different proportions, and the determined proportion is taken as the reclaiming proportion corresponding to the application to be processed.
The reclaiming number may be a product between the total number of the reclaimable memory pages and the determined reclaiming proportion. When the product is not an integer, an integer approximate to the product may be selected. For example, a most approximate integer may be determined as the reclaiming number in a round-off manner, or a corresponding integer may be determined as the reclaiming number according to methods such as a truncation method or a carry method.
The reclaiming number is determined in the round-off manner herein. For example, when there are 100 reclaimable memory pages, if the reclaiming proportion is 30.5% and an obtained product is 30.5, 31 pages may be reclaimed from the 100 reclaimable memory pages, and if the reclaiming proportion is 21.2%, 21 pages may be reclaimed.
By acquiring the reclaiming proportion corresponding to the application to be processed and then determining the reclaiming number according to the reclaiming proportion, the determination flexibility of the reclaiming number may be further improved.
In an embodiment, the operation of acquiring the reclaiming proportion corresponding to the application to be processed includes acquiring an application type of the application to be processed; and acquiring a reclaiming proportion calculated according to a reclaiming model corresponding to the application type.
The application type is the type set according to the operation influence on the application to be processed after memory reclaiming. The application type includes an unrelated type, a linear type and a non-linear type. The unrelated type represents no remarkable influence on the corresponding application regardless of the reclaiming number after reclaimable memories of the application to be processed are reclaimed. The linear type represents that with the increase of the reclaiming proportion of the reclaimable memories, the re-starting duration of the corresponding application is also increased, wherein the re-starting duration and the reclaiming proportion have a relationship of linear or approximately linear increase. The non-linear type represents other types neither the unrelated type nor the linear type. The no remarkable influence represents that an greater than proportion of re-starting durations corresponding to different reclaiming proportions relative to a normal starting duration is smaller than a preset proportion range. The approximately linear increase represents that an error between a re-starting duration fitted by different reclaiming proportions according to the corresponding approximate slope and a re-starting duration under the corresponding reclaiming proportion does not exceed an error within a preset range.
The electronic device sets, for different applications, an application type corresponding to this application according to the influence on the application after the memories are reclaimed according to different reclaiming proportions. The electronic device further sets a corresponding reclaiming model for each application type, and calculates, according to the reclaiming model, the size of the re-starting duration corresponding to the application type after reclaimable memory pages are reclaimed according to different proportions.
An optimal reclaiming proportion is determined according to different reclaiming proportions and the corresponding re-starting durations, so that under the condition of keeping the re-starting duration not greatly increased relative to the normal starting duration, the reclaiming proportion is maximum, and the optimal reclaiming proportion is acquired.
In an embodiment, when the application type of the application to be processed is the unrelated type, the reclaiming proportion calculated through the reclaiming model may be 100%, that is, the reclaimable memory page may be reclaimed by 100%. When the application type of the application to be processed is the non-linear type, an appropriate proportion may be selected as the reclaiming proportion, so that the cost performance between the number of the reclaimed memory pages and the re-starting duration of the corresponding application is highest. For example, a proportion corresponding to the re-starting duration which is a preset duration threshold may be selected, and the proportion is taken as the reclaiming proportion. Or, a proportion corresponding to the re-starting duration which is a preset multiple of a normal starting duration may be selected, and the proportion is taken as the reclaiming proportion. The preset duration threshold or the preset multiple may be an appropriate value set according to an empirical value. For example, the duration threshold may be 2 s or 3 s, and the preset multiple may be 1.5 or 2.
When the application type of the application to be processed is the linear type, the corresponding reclaiming proportion may be determined according to different slopes, wherein the slope represents the magnitude of inclination of a curve formed by the corresponding re-starting duration under different reclaiming proportions relative to the reclaiming proportion. As the slope is larger, the determined reclaiming proportion is relatively smaller, so as to maintain the balance between the reclaiming and operation of the memory of the application to be processed.
For example, as illustrated in
In an embodiment, as illustrated in
In block 502, correspondences between different reclaiming proportions of the application to be processed and re-starting durations is acquired.
The reclaiming proportion represents a proportion of reclaiming of memories to be reclaimed, and the reclaiming proportion is used to guide the magnitude of reclaiming reclaimable memories. For example, the reclaimed portion is 50%, which represents that 50% of occupied memories may be reclaimed. The re-starting duration refers to a duration for restarting the application to be processed after the reclaiming proportion of the reclaimable memory pages occupied by the application to be processed are reclaimed.
The electronic device may set correspondences between a corresponding reclaiming proportion and a re-starting duration for each application. The corresponding relationship represents a corresponding re-starting duration after reclaimable memories in different proportions are reclaimed from memories occupied by the application. Alternatively, the corresponding relationship may be a comparison table between a corresponding reclaiming proportion and a re-starting duration, or a reclaiming proportion curve. The curve is a corresponding re-starting duration under different reclaiming proportions.
In block 504, a reclaiming proportion of reclaimable memory pages is determined according to the correspondences between reclaiming proportions and re-starting durations.
In block 506, a reclaiming number is determined according to the reclaiming proportion and the total number of the reclaimable memory pages.
Alternatively, the electronic device may set a corresponding starting duration threshold, and when the second starting duration reaches the starting duration threshold, the corresponding proportion is determined as the reclaiming proportion of reclaimable memory pages. The starting duration threshold may be a preset empirical value, and further, starting duration thresholds corresponding to different applications may not be necessarily the same. For example, the corresponding starting duration threshold may be determined according to a normal starting duration of the corresponding application, and a duration which is 1.5 or 2 times the normal starting duration is taken as the starting duration threshold.
An appropriate proportion is selected according to the corresponding relationship with reference to different re-starting durations and taken as the reclaiming proportion of reclaimable memory pages occupied by the application, thus maintaining the balance between the reclaiming and operation of the memory of the application to be processed.
In an embodiment, block 302 includes querying all memory pages of a memory occupied by the application to be processed; and acquiring reclaimable memory pages from all the memory pages.
Alternatively, the electronic device may record memory pages of memories occupied by different applications in real time, and further record, in real time, whether each occupied memory page is reclaimable. For example, when data in a certain memory page is currently used by other applications or the application to be processed, it is determined that the memory page is a non-reclaimable memory page; and when it is recorded that data in the occupied memory page is not used by an application or the duration of this state exceeds a preset duration, it is determined that the memory page is a reclaimable memory page.
All memory pages occupied by the application to be processed may be queried from the pre-recorded information, it is judged, according to the using state of each recorded memory page, whether the memory page is a reclaimable memory page, and then all reclaimable memory pages are acquired.
In an embodiment, the operation of querying all memory pages of a memory occupied by the application to be processed includes traversing memory-mapped files of the application to be processed; and querying, in the memory-mapped files, all memory pages occupied by the application to be processed.
The memory-mapped files are mapping from a file to a memory. The electronic device establishes corresponding memory-mapped files for the application to be processed, the memory-mapped files are provided with memory pages occupied by the corresponding application, the memory-mapped files corresponding to the application to be processed are traversed, and the memory pages occupied by the application to be processed are read from each traversed memory-mapped file, so that all memory pages occupied by the application to be processed may be acquired, and the query efficiency and query comprehensiveness of the memory pages occupied by the application to be processed are improved.
In an embodiment, the operation of acquiring reclaimable memory pages from all the memory pages includes eliminating a memory page carrying an occupation mark from all the memory pages; and acquiring reclaimable memory pages from memory pages other than the eliminated memory page.
For all the queried memory pages occupied by the application to be processed, the electronic device may detect whether each queried memory page carries an occupation mark or whether it is occupied by multiple applications. The occupation mark represents that data stored in the corresponding memory page is currently used by the application to be processed, or data therein is necessary when the application to be processed keeps normal operation. After the data is deleted, either the application to be processed cannot normally operate or it is necessary to repeatedly occupy a new memory page to store corresponding data. The electronic device may set occupation marks for memory pages storing these types of detected data, so as to indicate that the corresponding memory pages cannot be reclaimed.
The data stored in the memory page occupied by the application to be processed may also be used by other applications. That is, multiple applications use the data in the memory page. Occupation marks may also be set for this type of memory pages, so that the electronic device eliminates it likewise, so as to indicate that this type of memory pages will not be reclaimed.
The memory pages remained relative to the eliminated memory pages are reclaimable memory pages, and the electronic device may reclaim a memory from the memory pages.
In an embodiment, the electronic device may call the resource priority and limitation management module 222 as illustrated in
In an embodiment, as illustrated in
In block 602, memory-mapped files of an application to be processed are traversed, and all memory pages occupied by the application to be processed are queried in the memory-mapped files.
In an embodiment, the electronic device may trigger a memory reclaiming mechanism when it is detected that the memory using rate of the system exceeds a preset proportion or a memory reclaiming instruction triggered by a user operation is received, and determine a memory reclaiming application from all operating applications, the determined application being the application to be processed.
In an embodiment, after detecting that a certain application is switched from the foreground to the background and setting the application to a process deep freezing mode through the platform freezing management module 224, the electronic device may trigger a memory reclaiming mechanism of the application.
The electronic device may traverse memory-mapped files of the application to be processed through the above-mentioned resource priority and limitation management module 222, and query a memory page occupied by the application to be processed from each traversed memory-mapped file, so that all memory pages occupied by the application to be processed can be queried.
In block 604, a memory page carrying an occupation mark is eliminated from all the memory pages, and reclaimable memory pages are acquired from memory pages other than the eliminated memory page.
Secondary traversal may be performed on each queried memory page, the secondary traversal is used to detect whether each queried memory page is a reclaimable memory page, when a memory page carrying an occupation mark is detected, it is determined that the memory page is a non-reclaimable memory page, the memory page is eliminated, the memory pages obtained after the secondary traversal are reclaimable memory pages, and the electronic device may select a memory page to be reclaimed from all the reclaimable memory pages. The secondary traversal may improve the detection comprehensiveness of reclaimable memory pages.
In block 606, correspondences between re-starting durations and reclaiming proportions corresponding to the application to be processed is acquired, a reclaiming proportion of reclaimable memory pages is determined according to the correspondences between reclaiming proportions and re-starting durations, and a reclaiming number is determined according to the reclaiming proportion and the total number of the reclaimable memory pages.
The re-starting duration refers to a duration for restarting the application to be processed after the reclaiming proportion of the reclaimable memory pages occupied by the application to be processed are reclaimed. The corresponding relationship may be a comparison table between a corresponding reclaiming proportion and a re-starting duration, or a reclaiming proportion curve. The curve is a corresponding re-starting duration under different reclaiming proportions, and the curve may be the curve as illustrated in
The electronic device may determine a relatively appropriate reclaiming proportion according to the curve in accordance with different application types. The reclaiming proportion and the total number of the reclaimable memory pages are multiplied to obtain a product, and an integer approximate to the product is taken as the reclaiming number.
In block 608, the Kth-largest idle duration is selected from the idle durations of each reclaimable memory page according to the reclaiming number, and the selected idle duration is taken as a duration threshold.
The number of reclaimable memory pages greater than the Kth-largest idle duration is the reclaiming number, and the Kth-largest idle duration is the duration threshold. Reclaiming numbers determined by different reclaiming proportions are different, and corresponding K values are different under different reclaiming numbers, that is, duration thresholds are different. For example, the total number of the reclaimable memory pages is 100, when the reclaiming proportion is 50%, the corresponding reclaiming number is 50, K=51, and the duration threshold is the 51st-largest idle duration; and when the reclaiming proportion is 30.3%, the corresponding reclaiming number is 30, K=31, and the duration threshold is the 31st-largest idle duration.
In block 610, a memory page for which the idle duration exceeds the duration threshold is selected from the reclaimable memory pages to be reclaimed.
The electronic device may reclaim the memory page from the reclaimable memory pages through the above-mentioned process memory reclaiming module 234 according to the duration threshold, and release a memory that has been unused for a long time, so that the memory using efficiency is improved, and after the memory page is reclaimed, the influence on the application to be processed is slight.
In the above-mentioned method for processing a memory, reclaimable memory pages occupied by an application to be processed and an idle duration thereof are acquired, a duration threshold is determined according to the idle duration, and a memory page for which the idle duration exceeds the duration threshold is reclaimed. Since the reclaimed object is a reclaimable memory page and not all the reclaimable memory pages are necessarily reclaimed, a memory page of which the idle duration exceeds a corresponding duration threshold is selected to be reclaimed according to the idle duration of each reclaimable memory page, thus reducing the operation influence on the application to be processed. Moreover, the reclaimed memory page may be released and used by other applications, thereby ensuring that the adverse impact on each application is slight when the entire system memory is increased, improving the memory using efficiency, and maintaining the balance between the reclaiming and operation of the memory of the application to be processed.
In an embodiment, before acquiring reclaimable memory pages occupied by an application to be processed, the method further includes detecting whether a foreground application depends on the application to be processed; if a foreground application depends on the application to be processed, adjusting the priority of the application to be processed to match the foreground application; and if a foreground application does not depend on the application to be processed, performing the operation of acquiring reclaimable memory pages occupied by an application to be processed.
In an embodiment, when the foreground application ends the dependency on the application to be processed, the operation of acquiring reclaimable memory pages occupied by an application to be processed is performed.
The dependency represents a relationship that an application can smoothly implement normal operation of another application by using data of another or more applications. Two applications having a dependency relationship are a depended application and a depending application respectively, and the electronic device determines the detected application to be processed which is depended by a foreground application and operates in the background as a background application depended by the foreground application. The electronic device may set a corresponding depended mark for the detected background application depended by the foreground application, acquire a background application with the depended mark from a background application pool, and determine the background application as the background application depended by the foreground application. The foreground application is an application operating in the foreground.
If the application to be processed is depended by the foreground application, the application to be processed may be determined as an application depended by the foreground application, and the priority of the application to be processed which is depended by the foreground application is adjusted to match the priority of the foreground application.
Alternatively, the electronic device may adjust the priority of the queried application to be processed which is depended by the foreground application, so that the adjusted priority matches the priority of the foreground application. The electronic device may set a matching relationship between the priority of different applications to be processed which are depended by the foreground application and the foreground priority. The corresponding priority of the application to be processed which is applicable to being depended by the foreground application is acquired according to the matching relationship, and the priority of the application to be processed which is depended by the foreground application is adjusted to this priority, so that the resource limitation degree of the application to be processed which is depended by the foreground application is reduced, and the limitation degree of resources available for the application to be processed which is depended by the foreground application matches the limitation degree of the foreground application.
In an embodiment, the priority matching the priority of the foreground application may be the priority which is the same as the priority of the foreground application. That is, the electronic device may adjust the priority of the application to be processed which is depended by the foreground application to the priority which is the same as the priority of the foreground application, so that the limitation degree of resources available for the application to be processed which is depended by the foreground application is the same as the limitation degree of the foreground application.
By detecting a dependency relationship on the application to be processed, the priority of the application to be processed which is depended by the foreground application is adjusted to the priority matching the foreground application. Since the priority of the foreground application is highest usually, the corresponding limitation degree of available resources is lowest, and the priority of a background process is lower, so as to prevent influence on the foreground application due to occupation of excessive resources by the background process. However, the background process has a situation of being depended by the foreground application, and the execution efficiency of the depended background process may also affect the foreground application. In the embodiments of the disclosure, by adjusting the priority of the depended application to be processed to the priority matching the foreground priority, the limitation degree of resources available for the depended application to be processed may be reduced, and the processing efficiency of the depended application to be processed is improved. The processing efficiency of the depended application to be processed is improved, so that the processing efficiency of the foreground application depending on the depended application to be processed is also improved.
In an embodiment, when socket communication, binder communication, memory share or lock waiting exists between the application to be processed and the foreground application, it is determined that a communication mechanism exists between the background process and the foreground application.
It may be detected whether a background process having a communication mechanism with the foreground application exists in any one or more of the following manners:
(1) detecting whether a background process having socket and/or binder communication with the foreground application exists;
(2) detecting whether a background process having memory share with the foreground application exists; and
(3) detecting whether a background process waiting on lock resources with the foreground application exists.
The electronic device may provide a detection mechanism for detecting whether Binder communication exists between the foreground application and the background process in a Binder drive, call the detection mechanism provided in the Binder drive to detect the background process having Binder communication with the foreground application, and determine the detected background process as the background process depended by the foreground application.
In an embodiment, the electronic device may detect various lock resources, the lock resources including a thread lock, a file handle, a signal and the like. It may be detected whether lock waiting namely lock resource waiting occurs to each lock resource. When it is detected that lock waiting is generated, it may be further detected whether the waiting behavior occurs on the foreground application. If a foreground application depends on the application to be processed, all background processes waiting on the lock resource are traversed, and the detected background processes waiting on the lock resource are determined as the background process depended by the foreground application.
In an embodiment, the electronic device may provide a lock resource monitoring module and a priority adjustment module in a kernel space of the operating system, and embed the lock resource monitoring module into an original waiting interface of the kernel. The lock resource monitoring module detects whether various lock resources such as the thread lock, the file handle and the signal wait, and whether the waiting behavior occurs on the foreground application, and sends, if a foreground application depends on the application to be processed, a detected message to the priority adjustment module. The priority adjustment module traverses all background processes waiting on the lock resource, and determines these background processes as the background process depended by the foreground application. The priority adjustment module adjusts the priority of the corresponding application to be processed to the matching priority.
In an embodiment, when a synchronization mechanism exists between the background process and the foreground application, the application to be processed having the synchronization mechanism is determined as the background process depended by the foreground application.
The electronic device may also detect, by calling a futex system, whether a background process having the synchronization mechanism with the foreground application exists in a background process set, and determine the background process having the synchronization mechanism as the background process depended by the foreground application.
In concurrent programming, the access of each process to a public variable must be restricted, this restriction being referred to as synchronization. In the operating system, a synchronization mechanism of a user mode may be implemented by calling the futex system. The user mode refers to a non-privileged state. The synchronization mechanism includes a semaphore, an exclusive lock or the like. When it is detected that a background process having any one synchronization mechanism with the foreground application exists by calling the futex system, the detected background process may be determined as the background process depended by the foreground application.
By detecting a communication mechanism and/or a synchronization mechanism between the foreground application and the background process, the detected background process having the communication mechanism and/or the synchronization mechanism with the foreground application is determined as the background process depended by the foreground application, so that the detection efficiency of the application to be processed which is depended by the foreground application can be improved.
It should be understood that although various operations in the flowchart in
In an embodiment, as illustrated in
In an embodiment, the duration determination module 704 is further configured to acquire update time recorded by a timestamp of each reclaimable memory page, and calculate an idle duration for the reclaimable memory page according to the update time.
In an embodiment, the duration determination module 704 is further configured to acquire update time of each reclaimable memory page recorded through an LRU management unit, and calculate an idle duration for the reclaimable memory page according to the update time.
In an embodiment, the duration determination module 704 is further configured to calculate an average idle duration of the application to be processed for the reclaimable memory pages according to the idle durations for the reclaimable memory pages, and take the average idle duration as a duration threshold.
In an embodiment, the duration determination module 704 is further configured to acquire a reclaiming number of the reclaimable memory pages, select the Kth-largest idle duration from the idle durations for the reclaimable memory pages according to the reclaiming number, and take the selected idle duration as a duration threshold, the number of idle durations greater than the Kth-largest idle duration being the reclaiming number, K being a natural number not greater than the reclaiming number.
In an embodiment, the duration determination module 704 is further configured to: acquire correspondences between re-starting durations and reclaiming proportions corresponding to the application to be processed, the re-starting duration being a duration for restarting the application to be processed after the reclaiming proportion of the reclaimable memory pages occupied by the application to be processed are reclaimed; determine a reclaiming proportion of reclaimable memory pages according to the correspondences between reclaiming proportions and re-starting durations; and determine a reclaiming number according to the reclaiming proportion and the total number of the reclaimable memory pages.
In an embodiment, the memory page acquisition module 702 is further configured to: traverse memory-mapped files of the application to be processed; query, in the memory-mapped files, all memory pages occupied by the application to be processed; eliminate a memory page carrying an occupation mark from all the memory pages; and acquire reclaimable memory pages from memory pages other than the eliminated memory page.
In an embodiment, as illustrated in
The dependency detection module 708 is configured to detect whether a foreground application depends on the application to be processed.
The priority adjustment module 710 is configured to adjust, when the application to be processed is depended on the foreground application, the priority of the application to be processed to match the foreground application.
In the above-mentioned device for processing a memory, reclaimable memory pages occupied by an application to be processed and an idle duration thereof are acquired, a duration threshold is determined according to the idle duration, and a memory page for which the idle duration exceeds the duration threshold is reclaimed. Since the reclaimed object is a reclaimable memory page and not all the reclaimable memory pages are necessarily reclaimed, a memory page of which the idle duration exceeds a corresponding duration threshold is selected to be reclaimed according to the idle duration of each reclaimable memory page, thus reducing the operation influence on the application to be processed. Moreover, the reclaimed memory page may be released and used by other applications, thereby ensuring that the adverse impact on each application is slight when the entire system memory is increased, improving the memory using efficiency, and maintaining the balance between the reclaiming and operation of the memory of the application to be processed.
The division of each module in the above-mentioned device for processing a memory is only for illustration, and in other embodiments, the device for processing a memory may be divided into different modules as needed to complete all or some functions of the above-mentioned device for processing a memory.
Specific limitations about the device for processing a memory may refer to limitations to the method for processing a memory, and will not be elaborated herein. Various modules in the above-mentioned device for processing a memory may be implemented by software, hardware or a combination thereof totally or partially. Various modules may be embedded into or dependent from the processor of the electronic device in the form of hardware, and may also be stored in the memory of the electronic device in the form of software, in order that the processor calls to perform the operation corresponding to each module.
Each module in the device for processing a memory provided in the embodiments of the disclosure may be implemented in the form of a computer program. The computer program may operate on the electronic device such as a terminal or a server. A program module formed by the computer program may be stored on the memory of the electronic device. The computer program is executed by a processor to implement the operations of the method for processing a memory described in the embodiments of the disclosure.
In an embodiment, an electronic device is provided, which includes a memory, a processor and a computer program stored on the memory and runnable on the processor, the processor executing the computer program to implement the operations of the method for processing a memory provided in various embodiments.
In an embodiment, a computer-readable storage medium is also provided, which has a computer program stored thereon, the computer program being executed by a processor to implement the operations of the method for processing a memory described in various embodiments of the disclosure.
In an embodiment, a computer program product including an instruction is provided. When the computer program product operates on a computer, the computer performs the method for processing a memory described in various embodiments of the disclosure.
The embodiments of the disclosure also provide a computer device. As illustrated in
The RF circuit 910 may be configured to receive and send a signal during information receiving and transmitting or during a call, may receive downlink information of a base station and then send the information to the processor 980 for processing, or may send uplink data to the base station. Usually, the RF circuit includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, etc. In addition, the RF circuit 910 may further communicate with other devices via wireless communication and a network. The wireless communication may use any one communication standard or protocol, including, but not limited to, a Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), an E-mail, Short Messaging Service (SMS), etc.
The memory 920 may be configured to store a software program and a module, and the processor 980 executes various function APPs and data processing of the mobile phone by running the software program and the module stored in the memory 920. The memory 920 may mainly include a storage program region and a storage data region, wherein the storage program region may store an operation system, an APP needed for at least one function (an application program of a sound playing function, an application program of an image playing function, etc.), etc; and the storage data region may store data (audio data, contacts, etc.) created according to use of the mobile phone. In addition, the memory 920 may include a high-speed RAM, and may further include a non-volatile memory such as a disk storage device, a flash device, or other non-volatile solid storage devices.
The input unit 930 may be configured to receive input digital or character information and generate key signal input associated with user setting and functional control of the mobile phone 900. Specifically, the input unit 930 may include a touch panel 931 and other input devices 932. The touch panel 931 also referred to as a touch screen may collect touch operations of a user thereon or nearby (such as an operation of the user on the touch panel 931 or nearby the touch panel 931 by using any suitable objects or attachments such as a finger or a stylus), and drives a corresponding connecting apparatus according to a preset program. In an embodiment, the touch panel 931 may include a touch detection apparatus and a touch controller. The touch detection apparatus detects the touch orientation of the user, detects a signal brought by the touch operation, and transmits the signal to the touch controller; and the touch controller receives touch information from the touch detection apparatus, converts it to touch coordinates, transmits the touch coordinates to the processor 980, and can receive a command sent by the processor 980 and execute the command. In addition, the touch panel 931 may be implemented by using multiple types such as resistance, capacitance, infrared rays and surface acoustic wave. The input unit 930 may further include, in addition to the touch panel 931, other input devices 932. Specifically, the other input devices 932 may include, but are not limited to, one or more of a physical keyboard, a functional key (such as a volume control key and a switch key), etc.
The display unit 940 may be configured to display information input by the user or information provided for the user or various menus of the mobile phone. The display unit 940 may include a display panel 941. In an embodiment, the display panel 941 may be configured in a form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), etc. In an embodiment, the touch panel 931 may cover the display panel 941, when the touch panel 931 detects the touch operation thereon or nearby, the touch operation is transmitted to the processor 980 to determine the type of a touch event, and then the processor 980 provides a corresponding visual output on the display panel 941 according to the type of the touch event. Although the touch panel 931 and the display panel 941 implement input of the mobile phone and input functions by serving as two independent parts in
The mobile phone 900 may further include at least one sensor 950 such as a light sensor, a motion sensor and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the luminance of the display panel 941 according to the brightness of ambient light, and the proximity sensor may close the display panel 941 and/or backlight. The motion sensor may include an accelerometer sensor, which may detect the magnitude of an accelerated speed in each direction and may detect the size and direction of a gravity while resting. The accelerometer sensor may be configured to identify an APP of a mobile phone gesture (e.g., horizontal and vertical screen switching), and vibration identification relevant functions (e.g., pedometer and knocking). In addition, the mobile phone may also be configured with other sensors such as a gyroscope sensor, a barometer sensor, a hygrometer sensor, a thermometer sensor and an infrared sensor.
The audio circuit 960, a loudspeaker 961 and a microphone 962 may provide an audio interface between the user and the mobile phone. The audio circuit 960 may transmit an electric signal converted from the received audio data to the loudspeaker 961, and the loudspeaker 961 converts the electric signal into a sound signal for output. Besides, the microphone 962 converts a collected sound signal into an electric signal, the audio circuit 960 converts the received electric signal into audio data and then outputs the audio data to the processor 980 for processing, the audio data is transmitted to another mobile phone via the RF circuit 910, or the audio data is output to the memory 920 for further processing.
WiFi belongs to a short-range wireless transmission technology, the mobile phone may assist the user in E-mail receiving and sending, webpage browsing, access to streaming media and the like by means of the WiFi module 970, and it provides a wireless wideband internet access for the user. Although
The processor 980 is a control center of the mobile phone, and is configured to connect all parts of the whole mobile phone by utilizing various interfaces and lines, to run or execute the software program and/or the module stored in the memory 920, and to call data stored in the memory 920 to execute various functions and processing data of the mobile phone, so as to wholly monitor the mobile phone. In an embodiment, the processor 980 may include one or more processing units. In an embodiment, the processor 980 may be integrated with an application processor and a modulation-demodulation processor, wherein the application processor mainly processes an operation system, a user interface, an application program and the like, and the modulation-demodulation processor mainly processes wireless communication. It may be understood that the modulation-demodulation processor may not be integrated into the processor 980. For example, the processor 980 may integrate an application processor and a baseband processor, and the baseband processor and other peripheral chips may constitute the modulation-demodulation processor. The mobile phone 900 may further include a power supply 990 (such as a battery) for supplying power to each component. Preferably, the power supply may be connected with the processor 980 logically via a power supply management system, so as to implement functions of charging, discharging and power consumption management by means of the power supply management system.
In an embodiment, the mobile phone 900 may further include a camera, a Bluetooth module and the like.
In the embodiments of the disclosure, the processor included by the mobile phone executes the computer program stored on the memory to implement the above-described method for processing a memory.
Any reference used in the disclosure to a memory, storage, a database or other media may include non-volatile and/or volatile memories. The appropriate non-volatile memory may include a ROM, a Programmable ROM (PROM), an Electrically Programmable ROM (EPROM), an Electrically Erasable Programmable ROM (EEPROM), or a flash memory. The volatile memory may include a RAM, used as an external cache memory. As being illustrative instead of being limitative, the RAM may be obtained in multiple forms such as a Static RAM (SRAM), a Dynamic RAM (DRAM), a Synchronous DRAM (SDRAM), a Dual Data Rate SDRAM (DDR SDRAM), an Enhanced SDRAM (ESDRAM), a Synchlink DRAM (SLDRAM), a Rambus Direct RAM (RDRAM), a Direct Rambus Dynamic RAM (DRDRAM), and a Rambus Dynamic RAM (RDRAM).
The above embodiment only describes several implementation manners of the disclosure more specifically and in more detail, but cannot be thus understood as limitation to the patent scope of the disclosure. It should be pointed out that those of ordinary skill in the art may also make several variations and improvements without departing from the concept of the disclosure. These variations and improvements fall within the scope of protection of the disclosure. Therefore, the scope of protection of the disclosure should be defined by the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
2017 1 1489135 | Dec 2017 | CN | national |
Number | Name | Date | Kind |
---|---|---|---|
5592432 | Vishlitzky | Jan 1997 | A |
5787473 | Vishlitzky | Jul 1998 | A |
9535768 | Reis | Jan 2017 | B2 |
9747028 | Allen | Aug 2017 | B1 |
9747222 | Armangau et al. | Aug 2017 | B1 |
20020108017 | Kenchammana-Hoskote | Aug 2002 | A1 |
20020108020 | Take | Aug 2002 | A1 |
20060129780 | Dunshea | Jun 2006 | A1 |
20060184718 | Sinclair | Aug 2006 | A1 |
20100017576 | Bomma | Jan 2010 | A1 |
20130326168 | Chang | Dec 2013 | A1 |
20160321183 | Govindan | Nov 2016 | A1 |
20170123700 | Sinha | May 2017 | A1 |
20180307600 | Wang | Oct 2018 | A1 |
20190205266 | Fang | Jul 2019 | A1 |
20190220318 | Yang | Jul 2019 | A1 |
20190370171 | Desai | Dec 2019 | A1 |
Number | Date | Country |
---|---|---|
101833512 | Sep 2010 | CN |
105760225 | Jul 2016 | CN |
106250223 | Dec 2016 | CN |
107220076 | Sep 2017 | CN |
0919927 | Jun 1999 | EP |
2017114288 | Jul 2017 | WO |
Entry |
---|
W. Zhang, H. Xie and C. Hsu, “Automatic Memory Control of Multiple Virtual Machines on a Consolidated Server,” in IEEE Transactions on Cloud Computing, vol. 5, No. 1, pp. 2-14, Jan. 1-Mar. 2017. (Year: 2017). |
International Search Report in international application No. PCT/CN2018/112067, dated Jan. 25, 2019. |
Written Opinion of the International Search Authority in international application No. PCT/CN2018/112067, dated Jan. 25, 2019. |
Supplementary European Search Report in the European application No. 18201257.5, dated Apr. 25, 2019. |
Vivek Narasayya et al : “Sharing buffer pool memory in multi-tenant relational database-as-a-service”, Proceedings of the VLDB Endowment; [ACM Digital Library], Assoc. of Computing Machinery, New York, NY, vol. 8, No. 7, Feb. 1, 2015, pp. 726-737, XP058067355, ISSN: 2150-8097, DOI: 10.14778/2752939.2752942. |
Ahmed Hussein et al: “One Process to Reap Them All ”, Virtual Execution Environments, ACM, 2 Penn Plaza, Suite 701 New York NY 10121-0701 USA, Apr. 8, 2017, pp. 171-186, XP058327086, DOI: 10.1145/3050748.3050754 ISBN: 978-1-4503-4948-2. |
Kan Zhong et al: “Building NVRAM-Aware Swapping Through Code Migration in Mobile Devices”, IEEE Transactions on Parallel and Distributed Systems., vol. ⋅.28, No. 11, Nov. 1, 2017, 3089-3099, XP055522583, US ISSN: 1045-9219, DOI: 10 .1109/TPDS. 2017. 2713780. |
Xiaoning Ding et al: “A buffer cache management scheme exploiting both temporal and spatial localities”, ACM Transactions on Storage, Association for Computing Machinery, New York, NY, US, vol. 3, No. 2, Jun. 1, 2007, pp. 5-es, XP058106799, ISSN: 1553-3077, DOI: 10.1i45/1242520.1242522. |
Number | Date | Country | |
---|---|---|---|
20190205265 A1 | Jul 2019 | US |