WO2019128542A1 - Application processing method, electronic device, computer readable storage medium - Google Patents

Application processing method, electronic device, computer readable storage medium Download PDF

Info

Publication number
WO2019128542A1
WO2019128542A1 PCT/CN2018/116507 CN2018116507W WO2019128542A1 WO 2019128542 A1 WO2019128542 A1 WO 2019128542A1 CN 2018116507 W CN2018116507 W CN 2018116507W WO 2019128542 A1 WO2019128542 A1 WO 2019128542A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
processed
memory
memory page
foreground
Prior art date
Application number
PCT/CN2018/116507
Other languages
French (fr)
Chinese (zh)
Inventor
方攀
陈岩
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2019128542A1 publication Critical patent/WO2019128542A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44594Unloading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • G06F2212/1024Latency reduction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/70Details relating to dynamic memory management

Definitions

  • the present application relates to the field of data processing, and in particular, to an application processing method, an electronic device, and a computer readable storage medium.
  • An embodiment of the present application provides an application processing method, an electronic device, and a computer readable storage medium.
  • An application processing method includes: acquiring a memory page occupied by an application to be processed; migrating data stored in the memory page to a temporary storage space for temporarily recovering the data; running in a preset loading interface The to-be-processed application; the data used in the temporary storage space in the process of running the to-be-processed application is read back into the memory page, and the unused data is recovered.
  • An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following operations:
  • a computer readable storage medium having stored thereon a computer program, the computer program being executed by a processor, causing the processor to:
  • FIG. 1 is a schematic diagram showing the internal structure of an electronic device in an embodiment.
  • FIG. 2 is a partial block diagram of a system in an electronic device in an embodiment.
  • 3 is a flow chart of an application processing method in one embodiment.
  • FIG. 4 is a flow chart of an application processing method in another embodiment.
  • Figure 5 is a schematic illustration of an interface that does not receive focus and that is invisible to the screen in one embodiment.
  • Figure 6 is a block diagram showing the structure of an application processing device in an embodiment.
  • Figure 7 is a block diagram showing the structure of an application processing device in another embodiment.
  • Figure 8 is a block diagram showing the structure of an application processing device in still another embodiment.
  • Figure 9 is a block diagram showing a portion of the structure of a handset in an embodiment.
  • an internal structure diagram of an electronic device includes a processor, memory, and display screen connected by a system bus.
  • the processor is used to provide computing and control capabilities to support the operation of the entire electronic device.
  • the memory is used to store data, programs, and/or instruction codes, etc., and the memory stores at least one computer program, which can be executed by the processor to implement an application processing method suitable for an electronic device provided in the embodiments of the present application.
  • the memory may include a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random storage memory (Random-Access-Memory, RAM).
  • the memory includes a non-volatile storage medium and an internal memory.
  • Non-volatile storage media stores operating systems, databases, and computer programs.
  • the database stores data related to an application processing method provided by the above various embodiments, such as storing a name of each application and a memory page allocated for each application.
  • the computer program can be executed by a processor for implementing an application processing method provided by various embodiments of the present application.
  • the internal memory provides a cached operating environment for operating systems, databases, and computer programs in non-volatile storage media.
  • the display screen can be a touch screen, such as a capacitive screen or an electronic screen, for displaying interface display information of the foreground application, and can also be used for detecting a touch operation acting on the display screen, and generating corresponding instructions, such as performing front and back applications. Switch instructions, etc.
  • FIG. 1 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution of the present application is applied.
  • the specific electronic device may be It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements.
  • the electronic device further includes a network interface connected through a system bus, and the network interface may be an Ethernet card or a wireless network card, etc., for communicating with an external electronic device, for example, for communicating with a server.
  • the architecture of the electronic device includes a JAVA spatial layer 210, a local framework layer 220, and a kernel space layer 230.
  • the JAVA spatial layer 210 may include a freeze management application 212 through which the electronic device can implement a freeze policy for each application, and freeze and thaw the related applications of the background power consumption.
  • the resource priority and restriction management module 222 and the platform freeze management module 224 are included in the local framework layer 220.
  • the electronic device can maintain different applications in different priorities and different resource organizations through the resource priority and limit management module 222, and adjust the resource group of the application according to the requirements of the upper layer to achieve optimized performance and save power. effect.
  • the electronic device can allocate the tasks that can be frozen in the background to the frozen layer corresponding to the preset different levels according to the length of the entering freeze time through the platform freeze management module 224.
  • the frozen layer can include three, respectively: the CPU Limit sleep mode, CPU freeze sleep mode, process deep freeze mode.
  • the CPU restricts the sleep mode to limit the CPU resources occupied by the related processes, so that the related processes occupy less CPU resources, and the free CPU resources are tilted to other unfrozen processes, thereby limiting the occupation of CPU resources.
  • the kernel space layer 230 includes a UID management module 231, a Cgroup module 232, a Binder management module 233, a process memory recovery module 234, and a freeze timeout exit module 235.
  • the UID management module 231 is configured to implement an application-based User Identifier (UID) to manage resources of a third-party application or freeze. Compared with the Process Identifier (PID) for process management and control, it is easier to uniformly manage the resources of a user's application through UID.
  • the Cgroup module 232 is used to provide a complete set of Central Processing Unit (CPU), CPUSET, memory, input/output (I/O), and Net related resource restriction mechanisms.
  • the Binder management module 233 is used to implement the priority control of the background binder communication.
  • the interface module of the local framework layer 220 includes a binder interface developed to the upper layer, and the upper layer framework or application sends a resource restriction or frozen instruction to the resource priority and restriction management module 222 and the platform freeze management module 224 through the provided binder interface.
  • the process memory recovery module 234 is configured to implement the process deep freeze mode, so that when a third-party application is in a frozen state for a long time, the file area of the process is mainly released, thereby saving the memory module and speeding up the application next time. The speed at startup.
  • the freeze timeout exit module 235 is configured to resolve an exception generated by the freeze timeout scenario.
  • an application processing method is provided.
  • the embodiment is applied to the electronic device shown in FIG. 1 as an example for description.
  • the method includes:
  • the pending application indicates that an application that needs to recycle memory is needed.
  • the memory also known as random access memory, RAM
  • the memory indicates the memory used when running the program (that is, running memory). It can only temporarily store data for exchanging cache data with the CPU, but the memory itself cannot be used. Long-term storage of data, which can be an internal memory as shown in FIG.
  • the pending application is a background application.
  • the background application is an application running in the background; correspondingly, the application running in the foreground is the foreground application.
  • the operation of an application (APP) is usually reflected by the operation of multiple related processes.
  • a process is a running activity of a program on a computer on a data set. It is the basic unit for resource allocation and scheduling, and is the basis of the operating system structure.
  • the process involved in the foreground application runtime is the foreground process
  • the process involved in the background application runtime is the background process.
  • the application needs to occupy memory space in the running state to store data during the running process.
  • the memory space occupied by different applications in different running states may not be the same.
  • the memory page is the unit that the operating system manages the memory.
  • the memory size of the memory page set by different electronic devices is not necessarily the same. For example, the memory space in the electronic device is divided into 100000 memory pages, and the memory page occupied by the to-be-processed application is the memory page 100 to the memory page 200, and the memory page 130 to the memory page 200 are recyclable memory pages.
  • the electronic device can record all the memory pages used by the pending application at runtime, such as recording the memory pages that are used by the runtime to be stored to the memory pages of the memory page.
  • Operation 304 the data stored in the memory page is migrated to a temporary storage space for temporarily reclaiming data.
  • the data stored in the memory page is the data used or generated by the corresponding application during the running process, and the data is temporarily cached in the memory.
  • the temporary storage space is a preset storage space for temporarily reclaiming and storing the memory data.
  • the temporary storage space may be a storage space in any one or several storage media such as a block cache, a page cache, a virtual memory, a flash flash or an external storage medium.
  • An electronic device can migrate data stored in some or all of the memory pages into temporary storage space.
  • the temporary storage space is used for temporarily reclaiming and storing the data stored in the memory page, and performing the operations of relocating or migrating the stored data to other storage spaces or deleting them under certain conditions, and setting the temporary storage space.
  • Operation 306 running the to-be-processed application in a preset loading interface.
  • the preset loading interface is a pre-set bearer interface for running the application to be processed.
  • the size and location of the loading interface can be any suitable size and location preset.
  • the loading interface can be a split screen interface preset on the electronic device such that the pending application can be run on the interface.
  • the loading interface can be an interface that does not receive focus and that is not visible to the screen.
  • the focus indicates the ability to receive the user's click or keyboard input, and the interface that does not receive the focus indicates that the click, input, and the like performed on the interface are not received or responded.
  • the screen is not visible to indicate the interface that the user cannot see, but for the system, there is an interface.
  • the interface display effect can be similar to the display effect of the completely transparent interface, so that the user cannot view the information displayed on the interface. By setting an interface that does not receive focus and the screen is invisible, the operation generated on the interface does not affect the user's operation.
  • the electronic device runs the pending application based on the data migrated to the temporary storage space at a preset interface that does not receive the focus and is invisible to the screen to detect the data required to run the application.
  • the data used includes at least one of data migrated into the temporary storage space and data not migrated in the remaining memory pages.
  • the manner of running the to-be-processed application may include a manner of starting the application to be processed, that is, by starting the to-be-processed application in the interface that does not receive the focus and being invisible to the screen, to detect the data that is needed during the startup process. .
  • Operation 308 the data used in the temporary storage space during the running of the application to be processed is read back into the memory page, and the unused data is recycled.
  • the electronic device can determine the data that is used when the application is run by detecting the used data in the process of running the application, and can read the part of the data from the temporary storage space back to the memory page. So that when the user needs to run the application, the data in the memory page can be quickly read back to prevent the running efficiency of the pending application from decreasing.
  • the electronic device can recycle the data, for example, the unused data can be recycled to the flash memory, thereby reducing the occupation of the memory space, so that in the process of running the application to be processed, When you need to use this data, read it back into the memory page.
  • the electronic device may re-allocate a new memory page to the to-be-processed application, and write the data used in the temporary storage space into the memory address corresponding to the reallocated memory page.
  • the electronic device migrates data in the memory page occupied by the application to be used in a temporary storage space for temporarily reclaiming data, and then re-runs the to-be-processed application to detect that the data in the memory page is migrated.
  • the migrated data used in the process of running the application to be processed on the preset loading interface, and the electronic device re-reads the detected used data after re-running the to-be-processed application.
  • To the memory page to prevent accidental recycling, and for the unused data, it will be recycled, thus achieving accurate recycling of the data that is not needed for the application to be processed, which not only improves the storage space of the available memory, but also prevents the data from being stored. Handling the decline in the speed at which the application resumes running.
  • operation 302 includes querying all memory pages of memory occupied by the application to be processed; and obtaining recyclable memory pages from all memory pages.
  • the electronic device can pre-record all memory pages occupied by the application to be processed, and obtain a retrievable memory page from all the memory pages.
  • Recyclable memory pages represent memory pages that can be recycled and that have no impact on the operation of the application and other applications after they are recycled.
  • the electronic device can record, among the memory pages, which memory pages are recyclable memory pages, which memory pages are non-recyclable memory pages, and according to the record information, obtain recyclable memory pages occupied by the to-be-processed application.
  • the electronic device can record memory pages of memory occupied by different applications in real time, and further record in real time whether it can be recycled for each occupied memory page. For example, when there is data in a certain memory page being used by another application or the application to be processed, it is determined that the memory page is a non-recyclable memory page, and when the data recorded in the occupied memory page is in no application. When the usage state, or the duration of the non-application use state exceeds the preset duration, the memory page is determined to be a reclaimable memory page.
  • the electronic device can query all the memory pages occupied by the pre-recorded information, and determine whether it is a recyclable memory page according to the used state of each memory page, and then obtain all the available Recycle the memory page.
  • querying all memory pages of the memory occupied by the application to be processed includes: traversing a memory mapped file of the to-be-processed application; and querying all memory pages occupied by the to-be-processed application through the memory mapped file.
  • Memory-Mapped Files are mappings from one file to one memory.
  • the electronic device establishes a corresponding memory mapping file for the to-be-processed application, where the memory mapping file is set with a memory page occupied by the corresponding application, and the electronic device traverses the memory mapping file corresponding to the to-be-processed application, and traverses from each
  • the memory page occupied by the to-be-processed application is read in the memory mapping file, so that all the memory pages occupied by the to-be-processed application are obtained, and the query efficiency of the memory page occupied by the application to be processed and the comprehensiveness of the query are improved.
  • the reclaimable memory page is obtained from all of the memory pages, including: removing the memory page carrying the occupied mark from all the memory pages; and obtaining the recyclable memory page from the rejected memory page.
  • the electronic device can detect whether each of the queried memory pages carries an occupation mark or is occupied by multiple applications, for all the memory pages occupied by the queried application.
  • the occupancy mark indicates that the data stored in the corresponding memory page is being used by the application to be processed, or the data therein is indispensable data in the process of the pending application being kept in normal operation, and when the data is deleted, The pending application may not be able to run normally, or it may need to repeatedly occupy a new memory page to store corresponding data.
  • the electronic device may set an occupancy flag on the memory page storing the data to indicate the corresponding Memory pages cannot be recycled.
  • the memory page occupied by the application to be processed, the data stored therein may also be used by other applications, that is, multiple applications are using the data in the memory page, and the memory page may also be set to occupy the mark. , so that the electronic device also culls it to indicate that it is not recycled from the memory page.
  • the reserved memory page is a recyclable memory page from which the electronic device can perform memory reclamation.
  • the electronic device may invoke the resource priority and restriction management module 222 as shown in FIG. 2 to traverse the memory mapped file of the to-be-processed application; query all memory pages occupied by the to-be-processed application through the memory-mapped file, and
  • the resource priority and limit management module 222 detects whether each memory page is a reclaimable memory page, and the electronic device can set a corresponding occupation mark for the non-recyclable memory page, and record whether each memory page is occupied by multiple applications.
  • the memory page carrying the occupancy flag and/or occupied by multiple applications is removed from all the memory pages that are queried; the reclaimable memory page is obtained from the culled memory page.
  • the electronic device can further reduce the impact on the application or other application to be processed, and can also reduce the ongoing operation. The amount of data migration during the temporary recovery process.
  • the method before operation 304, further includes: obtaining an idle duration of the to-be-processed application for each memory page; determining a duration threshold according to an idle duration of each memory page; operation 304 includes: setting the idle duration to a duration threshold The data stored in the memory page is migrated to the temporary storage space.
  • the idle duration of the memory page indicates that after the system allocates a memory page for the pending application, the data stored in the memory page is not used after being used most recently.
  • the electronic device updates the idle time of each memory page in real time according to the data usage of each memory page. When the memory page occupied by the application to be processed is ready for recycling, the idle time of each memory page of the latest record can be obtained.
  • the allocation, reclaim, release, etc. of the memory page is initiated recently, or the usage of the cache in the processor is queried, it is determined that the data of the corresponding memory page is used. And will generate the data usage time of the most recent time on the memory page of the system time in the corresponding situation. The difference between the current time and the latest time is the idle time of the corresponding memory page.
  • the electronic device can create a corresponding timestamp for each memory page that records the most recent usage time of the data in the corresponding memory page.
  • the electronic device can update the activity of the corresponding memory page whenever the initiative allocates the memory allocation, collection, release, etc., and records the update time in the timestamp.
  • the system periodically checks the usage of the processor cache, and the electronic device can determine that the data in the current cache is the currently used data, and update the timestamp of the memory page involved, and record the update time in the timestamp.
  • the electronic device may replace the latest updated update time with the last update time to reduce the resource consumption of the update time.
  • the duration threshold represents the critical value used to decide whether to recycle the memory page.
  • the duration threshold may be a fixed value, or may be a duration threshold determined according to the idle duration of each memory page, the idle duration is different, and the determined duration thresholds are not necessarily the same.
  • the duration threshold may be a weighted average of the idle durations of all memory pages, or may also be an idle duration selected by the electronic device from the idle duration of the all memory pages, and the selected idle duration is used as the duration threshold.
  • the electronic device may select the idle duration that is close to the median or is in a certain position in the idle duration of all the memory pages occupied by the to-be-processed application, and select the idle duration as the duration threshold.
  • the electronic device may temporarily collect the memory page whose idle time exceeds the duration threshold from the memory page occupied by the to-be-processed application according to the determined duration threshold, and write the data stored in the selected memory page into the temporary storage space.
  • the electronic device may use the process memory collection module 234 to recover the memory page from the memory page according to the duration threshold, and write the data stored in the recovered memory page into the temporary storage space.
  • the memory page has 100 pages, and the corresponding idle duration is between 5 seconds and 15 minutes respectively.
  • the duration threshold determined according to the idle duration is 5 minutes, the 100 pages of memory pages can be recovered.
  • the memory page that is temporarily reclaimed to store data is a reclaimable memory page.
  • the electronic device selects a memory page whose idle time exceeds a corresponding duration threshold according to the idle time of each memory page, thereby further reducing the operational impact of the application to be processed, and improving the accuracy of temporarily recovering data. It reduces the amount of data that needs to be read back into the memory page, minimizes the negative impact on each application, improves the memory usage efficiency, and maintains the balance between the recycling and operation of the application memory to be processed.
  • obtaining the idle duration of the memory page of the to-be-processed application includes: obtaining an update time of the timestamp record of each memory page, and calculating an idle duration of the corresponding memory page according to the update time.
  • the electronic device can create a timestamp for each memory page by using the resource priority and limit management module 222 described above, the timestamp is used to record the corresponding update time, and the update time indicates the time when the corresponding memory page is recently used.
  • the update time of the timestamp record can be updated.
  • the electronic device determines that the data of the corresponding memory page is used whenever the last time the memory page is allocated, recycled, released, or the like, or the cached usage of the processor is used. And will generate the system time in the corresponding situation as the update time.
  • the electronic device can calculate the idle duration of the corresponding memory page according to the update time recorded by the time stamp and the current system time. The difference between the current time and the most recent time is the idle time for the corresponding memory page.
  • the electronic device records the update time of each memory page by using the software to create a time stamp, and determines the idle duration according to the update time, which can effectively be compatible with different processors, and improves the versatility of memory recovery.
  • obtaining the idle duration of the memory to be processed by the application to be processed includes: obtaining an update time of each memory page recorded by the latest unused LRU management unit, and calculating the idleness of the corresponding memory page according to the update time. duration.
  • LRU Least Recently Used
  • the LRU management unit can record each memory address and the update time of the memory address.
  • the processor stores the corresponding memory address and update time in the LRU management unit.
  • the electronic device can obtain the memory page corresponding to each memory address according to the correspondence between the memory address and the memory page, and further read the update time of the corresponding memory page from the LRU management unit. .
  • the electronic device determines that the data of the corresponding memory page is used whenever the last time the memory page is allocated, recycled, released, or the like, or the cached usage of the processor is used. And will generate the system time in the corresponding situation as the update time.
  • the electronic device can generate an interrupt message and notify the operating system, and the operating system can clear the data after reading the data of the LRU management unit, so that the LRU management unit can restart work and store each memory address. And its corresponding update time and other information.
  • the electronic device can accurately track the usage of each memory, improve the accuracy of detecting the update time of the memory page, and improve the convenience of memory recovery.
  • determining the duration threshold according to the idle duration of each memory page includes: calculating an average idle duration of the to-be-processed application to the memory page according to the idle duration of each memory page, and using the average idle duration as the duration threshold.
  • the average idle duration may be an average value of the occupied duration of each memory page in the memory page occupied by the application to be processed.
  • the electronic device may calculate the average idle duration by using the corresponding calculation unit to calculate the average duration of each memory page according to the occupied duration of each memory page, and use the average idle duration as the duration threshold.
  • the electronic device can increase the calculation efficiency of the duration threshold by using the average idle duration as the duration threshold, and the calculation is simple, thereby correspondingly improving the efficiency of memory recovery.
  • FIG. 4 another application processing method is provided, the method comprising:
  • Operation 402 Acquire a reclaimable memory page occupied by the to-be-processed application.
  • the electronic device may traverse the memory mapped file of the to-be-processed application; query all memory pages occupied by the to-be-processed application through the memory-mapped file; and remove the memory page carrying the occupied mark from all the memory pages; from the eliminated memory page Get reclaimable memory pages.
  • Operation 404 Acquire an idle duration of the to-be-processed application for each recyclable memory page.
  • the electronic device may acquire an update time of the timestamp record of each memory page, calculate an idle duration of the corresponding memory page according to the update time, or acquire each memory page recorded by the most recently unused LRU management unit.
  • the update time based on the update time, calculates the idle duration of the corresponding memory page.
  • Operation 406 calculating an average idle duration of the to-be-processed application to the memory page according to the idle duration of each reclaimable memory page, and using the average idle duration as the duration threshold.
  • the average idle duration is the length of time calculated by averaging the idle duration of each recyclable memory page.
  • Operation 408 migrating data stored in the reclaimable memory page whose idle time exceeds the duration threshold to the storage space in the page cache.
  • the page cache may be a pre-defined storage medium for temporarily storing data stored in a memory page.
  • An electronic device can improve the efficiency of migration of data by migrating data from a reclaimable memory page to a page cache.
  • Operation 410 running the pending application in an interface that does not receive focus and is invisible to the screen.
  • the size of the screen that is not in focus and that is not visible to the screen is the same size as the system display interface.
  • a schematic diagram of an interface that does not receive focus and that is invisible to the screen is included in one embodiment.
  • the interface 502 is an interface that does not receive the focus and is invisible to the screen
  • the interface 504 is a normal system display interface.
  • the interface may be a mobile phone operation interface, and the interface that does not receive the focus and the screen is invisible may be the same interface as the screen size of the mobile phone.
  • the electronic device runs the to-be-processed application on an interface that is identifiable by the system and is invisible to the user and does not receive the focus, so that the foreground operation is not affected, and the operation of the processing application is not disturbed, so that the focus is not received.
  • the data used is also the data that needs to be used when running the pending application on the normal display interface of the system, so that the data required for running the pending application can be realized.
  • the running the application to be processed may be to start the application to be processed.
  • Operation 412 the data used in the storage space in the page cache in the process of running the application to be processed is read back into the memory page, and the unused data is recycled.
  • the electronic device can determine the data that needs to be used when the application is run, and can detect the used data to be read back from the page cache to the data used in the process of running the application.
  • the memory page can be a reallocated memory page or a memory page that corresponds to the data stored in the migration store.
  • the electronic device can recycle it into the flash memory so that it can be loaded back from the flash memory when needed later.
  • the electronic device migrates the data stored in the memory page occupied by the application to be processed into a temporary storage space for temporarily reclaiming data, and then runs in an interface that does not receive the focus and is invisible to the screen. Processing the application, so that the data used by the to-be-processed application can be accurately detected, and the data used in the temporary storage space is read back into the memory page, and the unused data is recycled, and the treatment is realized. Handling the memory data that is not needed by the application for accurate recovery, which not only improves the storage space of the available memory, but also prevents the running speed of the pending application from being resumed.
  • the method before acquiring the memory page occupied by the to-be-processed application, the method further includes: detecting whether the to-be-processed application is dependent on the foreground application; if yes, adjusting the priority of the to-be-processed application to match the foreground application; otherwise , execute the memory page occupied by the application to be processed.
  • the memory page occupied by the application to be processed is executed.
  • Dependency indicates that an application needs to utilize data from one or more applications in order to successfully implement the normal operation of the application.
  • There are two applications of the dependency which are the dependent application and the dependent application, respectively, and the electronic device detects the pending application to be processed by the foreground application to be determined by the foreground application as the background application that is depended by the foreground application.
  • the electronic device may set a corresponding dependency mark to the detected background application that is determined by the foreground application, and obtain a background application with the dependency mark from the background application pool, and determine the background application as a background that is depended by the foreground application.
  • the foreground application is the application running in the foreground.
  • the electronic device may determine that the to-be-processed application is an application that is dependent on the foreground application, and adjust the priority of the to-be-processed application that is affected by the foreground application to be prioritized with the foreground application. match.
  • the electronic device may adjust the priority of the queried application to be processed by the foreground application, so that the adjusted priority matches the priority of the foreground application.
  • the electronic device can set different matching relationships between the priority of the pending application and the foreground priority that are depended by the foreground application. According to the matching relationship, the electronic device may obtain a corresponding priority applicable to the to-be-processed application that is dependent on the foreground application, and adjust the priority of the to-be-processed application that is to be processed by the foreground application to the priority, thereby reducing the dependency on the foreground application.
  • the resource limit of the pending application is such that the degree of restriction on the resources that can be used by the pending application that is dependent on the foreground application matches the limit of the foreground application.
  • the priority that matches the priority of the foreground application may be the same priority as the foreground application. That is, the electronic device can adjust the priority of the to-be-processed application that is dependent on the foreground application to the same priority as the foreground application, so that the degree of limitation on resources that can be used by the to-be-processed application that is dependent on the foreground application is The foreground application is limited to the same extent.
  • the electronic device performs dependency detection by the application to be processed, and adjusts the priority of the to-be-processed application that the foreground application depends on to the priority of the foreground application. Because the foreground application has the highest priority, the limit of the available resources is the lowest, and the background process has the lower priority to prevent the background process from occupying too many resources and affecting the foreground application. However, there are situations in the background process that are depended on by the foreground application. When the background process is dependent on the execution efficiency, it will also affect the foreground application.
  • the embodiment of the present application adjusts the priority of the dependent application to be processed to the priority matching the foreground priority, thereby reducing the degree of limitation of resources that can be used by the dependent application to be processed, thereby improving the dependency.
  • the processing efficiency of the pending application Since the processing efficiency of the dependent pending application is improved, the processing efficiency of the foreground application depending on the dependent pending application is also improved.
  • socket communication when there is socket communication, binder communication, memory sharing or lock waiting between the to-be-processed application and the foreground application, it is determined that there is a communication mechanism between the background process and the foreground application.
  • the electronic device can set a detection mechanism for the Binder communication between the foreground application and the background process in the Binder driver, and call the detection mechanism set in the Binder driver to detect the background process that the Binder communication exists with the foreground application, and the detection will be detected.
  • the background process is determined to be a background process that is dependent on the foreground application.
  • the electronic device can detect individual lock resources, including thread locks, file handles, signals, and the like. For each lock resource, it can be detected whether a lock wait occurs, that is, the lock resource waits. When it is detected that a lock wait is generated, it may be further detected whether the behavior of the occurrence of the wait occurs on the foreground application. If so, all the background processes waiting for the lock resource are traversed, and the detected background processes waiting on the lock resource are all determined to be background processes that are depended by the foreground application.
  • the electronic device may set 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 the kernel's native waiting interface.
  • the lock resource monitoring module detecting thread locks, file handles, signals, etc. lock various lock resources, whether a wait occurs, whether the waiting behavior occurs in the foreground application, and if it occurs on the foreground task, it will detect
  • the message is sent to the priority adjustment module.
  • the electronic device traverses all the background threads waiting for the lock resource by the priority adjustment, and determines these background processes as the background processes that are depended by the foreground application.
  • the priority adjustment module adjusts the priority of the corresponding pending application to the matching priority.
  • the to-be-processed application with the synchronization mechanism is a background process that is dependent on the foreground application.
  • the electronic device can also detect the background process in the background process set by calling the futex system call, whether there is a background process having a synchronization mechanism with the foreground application, and determine the background process with the synchronization mechanism as the background process that is depended by the foreground application.
  • the user mode synchronization mechanism can be implemented by calling the futex system call.
  • the user state refers to the non-privileged state.
  • Synchronization mechanisms include semaphores, mutex locks, and more.
  • the electronic device determines, by the detection of at least one of a communication mechanism and a synchronization mechanism between the foreground application and the background process, that the detected background process having at least one of a communication mechanism and a synchronization mechanism with the foreground application is the foreground
  • Application-dependent background processes can improve the efficiency of detection of pending applications that are dependent on the foreground application.
  • FIGS. 3 and 4 are sequentially displayed as indicated by the arrows, these operations are not necessarily performed in the order indicated by the arrows. Except as explicitly stated herein, the execution of these operations is not strictly limited, and the operations may be performed in other sequences. Moreover, at least some of the operations in FIGS. 3 and 4 may include multiple sub-operations or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, or The order of execution of the stages is also not necessarily sequential, but may be performed alternately or alternately with at least a portion of the sub-operations or stages of other operations or other operations.
  • an application processing apparatus includes a memory page acquisition module 602, a storage data processing module 604, and an application processing module 606.
  • the memory page obtaining module 602 is configured to acquire a memory page occupied by the to-be-processed application; the storage data processing module 604 is configured to migrate data stored in the memory page to a temporary storage space for temporarily reclaiming data; and the application processing module 606 For running the to-be-processed application in the preset loading interface; the storage data processing module 604 is further configured to read back the data used in the temporary storage space in the process of running the to-be-processed application to the memory page, and the unused data will be unused. The data obtained is recycled.
  • the memory page obtaining module 602 is further configured to: traverse the memory mapped file of the to-be-processed application; query all memory pages occupied by the to-be-processed application through the memory-mapped file; and remove the memory page carrying the occupied mark from all the memory pages; Get reclaimable memory pages from the stripped memory page.
  • another memory processing device is provided, the device further comprising:
  • the duration determining module 608 is configured to obtain an idle duration of the to-be-processed application for each memory page; and determine a duration threshold according to the idle duration of each memory page.
  • the storage data processing module 604 is further configured to migrate data stored in the memory page whose idle duration exceeds the duration threshold into the temporary storage space.
  • the duration determining module 608 is further configured to obtain an update time of the timestamp record of each memory page, calculate an idle duration of the corresponding memory page according to the update time, or obtain a record that is recorded by the most recently unused LRU management unit. The update time of each memory page, and the idle time of the corresponding memory page is calculated according to the update time.
  • the duration determining module 608 is further configured to calculate an average idle duration of the to-be-processed application for the memory page according to the idle duration of each memory page, and use the average idle duration as the duration threshold.
  • the temporary storage space includes a storage space in the page cache;
  • the loading interface is an interface that does not receive the focus and is invisible to the screen, and the size of the loading interface is the same as the size of the system display interface.
  • yet another application processing device is provided, the device further comprising:
  • the dependency detection module 610 is configured to detect whether the to-be-processed application is dependent on the foreground application.
  • the priority adjustment module 612 is configured to adjust the priority of the to-be-processed application to match the foreground application when the to-be-processed application is dependent on the foreground application.
  • each module in the application processing device is for illustrative purposes only. In other embodiments, the application processing device may be divided into different modules as needed to complete all or part of the functions of the application processing device. For specific definitions of the application processing device, reference may be made to the above definition of the application processing method, and details are not described herein again.
  • the various modules in the application processing device described above may be implemented in whole or in part by software, hardware, and combinations thereof. Each of the above modules may be embedded in or independent of the processor in the electronic device, or may be stored in a memory in the electronic device in a software format, so that the processor calls to perform operations corresponding to the above modules.
  • each module in the application processing apparatus may be in the form of a computer program.
  • the computer program can run on an electronic device such as a terminal or a server.
  • the program module of the computer program can be stored on a memory of the electronic device.
  • the computer program is executed by the processor, the operation of the application processing method described in the embodiment of the present application is implemented.
  • an electronic device including a memory, a processor, and a computer program stored on the memory and operable on the processor, and the application processing provided by the above embodiments is implemented when the processor executes the computer program The operation of the method.
  • a computer readable storage medium having stored thereon a computer program for performing application processing as described in various embodiments of the present application when executed by a processor The operation of the method.
  • a computer program product comprising instructions, when executed on a computer, causes the computer to perform the application processing methods described in the various embodiments of the present application.
  • the embodiment of the present application also provides a computer device. As shown in FIG. 9 , for the convenience of description, only the parts related to the embodiments of the present application are shown. If the specific technical details are not disclosed, please refer to the method part of the embodiment of the present application.
  • the computer device may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, a wearable device, and the like, taking a computer device as a mobile phone as an example. :
  • FIG. 9 is a block diagram showing a part of a structure of a mobile phone related to a computer device according to an embodiment of the present application.
  • the mobile phone includes: a radio frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a wireless fidelity (WiFi) module 970, and a processor 980.
  • RF radio frequency
  • RF radio frequency
  • memory 920 includes: a radio frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a wireless fidelity (WiFi) module 970, and a processor 980.
  • WiFi wireless fidelity
  • power supply 990 and other components.
  • the RF circuit 910 can be used for receiving and transmitting signals during the transmission and reception of information or during a call.
  • the downlink information of the base station can be received and processed by the processor 980.
  • the uplink data can also be sent to the base station.
  • RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like.
  • LNA Low Noise Amplifier
  • RF circuitry 910 can also communicate with the network and other devices via wireless communication.
  • the above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Messaging Service (SMS), and the like.
  • GSM Global System of Mobile communication
  • GPRS General
  • the memory 920 can be used to store software programs and modules, and the processor 980 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 920.
  • the memory 920 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as an application of a sound playing function, an application of an image playing function, etc.);
  • the data storage area can store data (such as audio data, address book, etc.) created according to the use of the mobile phone.
  • memory 920 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • the input unit 930 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the handset 900.
  • 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, can collect touch operations on or near the user (such as the user using a finger, a stylus, or the like on the touch panel 931 or near the touch panel 931. Operation) and drive the corresponding connection device according to a preset program.
  • the touch panel 931 can include two portions of a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
  • the processor 980 is provided and can receive commands from the processor 980 and execute them.
  • the touch panel 931 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 930 may also include other input devices 932.
  • other input devices 932 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.).
  • the display unit 940 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone.
  • the display unit 940 can include a display panel 941.
  • the display panel 941 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
  • the touch panel 931 can cover the display panel 941. When the touch panel 931 detects a touch operation on or near it, the touch panel 931 transmits to the processor 980 to determine the type of the touch event, and then the processor 980 is The type of touch event provides a corresponding visual output on display panel 941.
  • touch panel 931 and the display panel 941 are used as two independent components to implement the input and input functions of the mobile phone in FIG. 9, in some embodiments, the touch panel 931 and the display panel 941 may be integrated. Realize the input and output functions of the phone.
  • the handset 900 can also include at least one type of sensor 950, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 941 according to the brightness of the ambient light, and the proximity sensor may close the display panel 941 and/or when the mobile phone moves to the ear. Or backlight.
  • the motion sensor may include an acceleration sensor, and the acceleration sensor can detect the magnitude of the acceleration in each direction, and the magnitude and direction of the gravity can be detected at rest, and can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching), and vibration recognition related functions (such as Pedometer, tapping, etc.; in addition, the phone can also be equipped with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors.
  • the acceleration sensor can detect the magnitude of the acceleration in each direction, and the magnitude and direction of the gravity can be detected at rest, and can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching), and vibration recognition related functions (such as Pedometer, tapping, etc.; in addition, the phone can also be equipped with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors.
  • Audio circuitry 960, speaker 961, and microphone 962 can provide an audio interface between the user and the handset.
  • the audio circuit 960 can transmit the converted electrical data of the received audio data to the speaker 961, and convert it into a sound signal output by the speaker 961.
  • the microphone 962 converts the collected sound signal into an electrical signal, and the audio circuit 960 After receiving, it is converted into audio data, and after being processed by the audio data output processor 980, it can be sent to another mobile phone via the RF circuit 910, or the audio data can be output to the memory 920 for subsequent processing.
  • WiFi is a short-range wireless transmission technology
  • the mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 970, which provides users with wireless broadband Internet access.
  • FIG. 9 shows the WiFi module 970, it can be understood that it does not belong to the essential configuration of the mobile phone 900 and can be omitted as needed.
  • the processor 980 is the control center of the handset, which connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 920, and invoking data stored in the memory 920, executing The phone's various functions and processing data, so that the overall monitoring of the phone.
  • processor 980 can include one or more processing units.
  • processor 980 can integrate an application processor and a modem, where the application processor primarily processes an operating system, user interface, applications, etc.; the modem primarily processes wireless communications. It will be appreciated that the above described modems may also not be integrated into the processor 980.
  • the processor 980 can integrate an application processor and a baseband processor, and the baseband processor and other peripheral chips can form a modem.
  • the mobile phone 900 also includes a power source 990 (such as a battery) that supplies power to various components.
  • the power source can be logically coupled to the processor 980 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
  • the handset 900 can also include a camera, a Bluetooth module, and the like.
  • the processor included in the mobile phone implements the application processing method described above when executing a computer program stored in the memory.
  • Non-volatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory can include random access memory (RAM), which acts as an external cache.
  • RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronization.
  • SRAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDR SDRAM dual data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM Link (Synchlink) DRAM
  • SLDRAM Memory Bus
  • Rambus Direct RAM
  • RDRAM Direct Memory Bus Dynamic RAM
  • RDRAM Memory Bus Dynamic RAM

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Memory System (AREA)

Abstract

An application processing method comprises: acquiring a memory page occupied by an application to be processed; migrating data stored in the memory page into a temporary storage space for temporarily recovering the data; running said application in a preset loading interface; and reading the data used in the temporary storage space during the running of said application back into the memory page, and recovering unused data.

Description

应用处理方法、电子设备、计算机可读存储介质Application processing method, electronic device, computer readable storage medium
相关申请的交叉引用Cross-reference to related applications
本申请要求于2017年12月29日提交中国专利局、申请号为201711484431.X、发明名称为“应用处理方法和装置、电子设备、计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to the Chinese Patent Application, filed on Dec. 29, 2017, the application No. The entire contents are incorporated herein by reference.
技术领域Technical field
本申请涉及数据处理领域,特别是涉及一种应用处理方法、电子设备、计算机可读存储介质。The present application relates to the field of data processing, and in particular, to an application processing method, an electronic device, and a computer readable storage medium.
背景技术Background technique
电子设备上安装的应用在运行时,需要占用一定的内存。内存是一个应用在运行过程中数据的主要存储介质。由于电子设备上的内存容量有限,当后台应用占据的内存过多时,会影响前台应用的运行效率。因而需要对内存进行回收,以提高前台应用的运行效率。Applications installed on electronic devices require a certain amount of memory when they are running. Memory is the primary storage medium for data that is applied during the run. Due to the limited memory capacity on the electronic device, when the background application occupies too much memory, it will affect the operating efficiency of the foreground application. Therefore, the memory needs to be recycled to improve the operating efficiency of the foreground application.
传统对应用处理方法是将处于后台运行的单个应用占据的内存全部回收。然而,将单个应用使用的内存完全回收后将导致该应用下次启动和执行过程中需要将几乎所有被回收的内存重新加载回来,导致被回收内存的应用的运行速度显著降低。The traditional approach to application processing is to recycle all of the memory occupied by a single application running in the background. However, completely reclaiming the memory used by a single application will cause the application to reload almost all of the reclaimed memory during the next startup and execution, resulting in a significantly slower running of the application that is reclaiming memory.
发明内容Summary of the invention
本申请实施例提供一种应用处理方法、电子设备、计算机可读存储介质。An embodiment of the present application provides an application processing method, an electronic device, and a computer readable storage medium.
一种应用处理方法,包括:获取待处理应用所占用的内存页;将所述内存页中存储的数据迁移至用于临时回收所述数据的临时存储空间中;在预设的加载界面中运行所述待处理应用;将运行所述待处理应用的过程中在所述临时存储空间中使用到的数据重新读回至内存页中,将未使用到的数据进行回收。An application processing method includes: acquiring a memory page occupied by an application to be processed; migrating data stored in the memory page to a temporary storage space for temporarily recovering the data; running in a preset loading interface The to-be-processed application; the data used in the temporary storage space in the process of running the to-be-processed application is read back into the memory page, and the unused data is recovered.
一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行以下操作:An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following operations:
获取待处理应用所占用的内存页;将所述内存页中存储的数据迁移至用于临时回收所述数据的临时存储空间中;在预设的加载界面中运行所述待处理应用;将运行所述待处理应用的过程中在所述临时存储空间中使用到的数据重新读回至内存页中,将未使用到的数据进行回收。Obtaining a memory page occupied by the to-be-processed application; migrating the data stored in the memory page to a temporary storage space for temporarily retrieving the data; running the to-be-processed application in a preset loading interface; The data used in the temporary storage space in the process of the to-be-processed application is read back into the memory page, and the unused data is collected.
一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时,使得所述处理器执行以下操作:A computer readable storage medium having stored thereon a computer program, the computer program being executed by a processor, causing the processor to:
获取待处理应用所占用的内存页;将所述内存页中存储的数据迁移至用于临时回收所述数据的临时存储空间中;在预设的加载界面中运行所述待处理应用;将运行所述待处理应用的过程中在所述临时存储空间中使用到的数据重新读回至内存页中,将未使用到的数据进行回收。Obtaining a memory page occupied by the to-be-processed application; migrating the data stored in the memory page to a temporary storage space for temporarily retrieving the data; running the to-be-processed application in a preset loading interface; The data used in the temporary storage space in the process of the to-be-processed application is read back into the memory page, and the unused data is collected.
附图说明DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings to be used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present application, and other drawings can be obtained according to the drawings without any creative work for those skilled in the art.
图1为一个实施例中电子设备的内部结构示意图。FIG. 1 is a schematic diagram showing the internal structure of an electronic device in an embodiment.
图2为一个实施例中电子设备中的系统的部分框架示意图。2 is a partial block diagram of a system in an electronic device in an embodiment.
图3为一个实施例中应用处理方法的流程图。3 is a flow chart of an application processing method in one embodiment.
图4为另一个实施例中应用处理方法的流程图。4 is a flow chart of an application processing method in another embodiment.
图5为一个实施例中包含不接收焦点的、屏幕不可见的界面的示意图。Figure 5 is a schematic illustration of an interface that does not receive focus and that is invisible to the screen in one embodiment.
图6为一个实施例中应用处理装置的结构框图。Figure 6 is a block diagram showing the structure of an application processing device in an embodiment.
图7为另一个实施例中应用处理装置的结构框图。Figure 7 is a block diagram showing the structure of an application processing device in another embodiment.
图8为又一个实施例中应用处理装置的结构框图。Figure 8 is a block diagram showing the structure of an application processing device in still another embodiment.
图9为一个实施例中手机的部分结构的框图。Figure 9 is a block diagram showing a portion of the structure of a handset in an embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the objects, technical solutions, and advantages of the present application more comprehensible, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
在一个实施例中,如图1所示,提供了一种电子设备的内部结构示意图。该电子设备包括通过系统总线连接的处理器、存储器和显示屏。其中,该处理器用于提供计算和控制能力,支撑整个电子设备的运行。存储器用于存储数据、程序、和/或指令代码等,存储器上存储至少一个计算机程序,该计算机程序可被处理器执行,以实现本申请实施例中提供的适用于电子设备的应用处理方法。存储器可包括磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random-Access-Memory,RAM)等。例如,在一个实施例中,存储器包括非易失性存储介质及内存储器。非易失性存储介质存储有操作系统、数据库和计算机程序。该数据库中存储有用于实现以上各个实施例所提供的一种应用处理方法相关的数据,比如可存储有每个应用的名称以及为每个应用分配的内存页等信息。该计算机程序可被处理器所执行,以用于实现本申请各个实施例所提供的一种应用处理方法。内存储器为非易失性存储介质中的操作系统、数据库和计算机程序提供高速缓存的运行环境。显示屏可以是触摸屏,比如为电容屏或电子屏,用于显示前台应用的界面展示信息,还可以被用于检测作用于该显示屏的触摸操作,生成相应的指令,比如进行前后台应用的切换指令等。In one embodiment, as shown in FIG. 1, an internal structure diagram of an electronic device is provided. The electronic device includes a processor, memory, and display screen connected by a system bus. The processor is used to provide computing and control capabilities to support the operation of the entire electronic device. The memory is used to store data, programs, and/or instruction codes, etc., and the memory stores at least one computer program, which can be executed by the processor to implement an application processing method suitable for an electronic device provided in the embodiments of the present application. The memory may include a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random storage memory (Random-Access-Memory, RAM). For example, in one embodiment, the memory includes a non-volatile storage medium and an internal memory. Non-volatile storage media stores operating systems, databases, and computer programs. The database stores data related to an application processing method provided by the above various embodiments, such as storing a name of each application and a memory page allocated for each application. The computer program can be executed by a processor for implementing an application processing method provided by various embodiments of the present application. The internal memory provides a cached operating environment for operating systems, databases, and computer programs in non-volatile storage media. The display screen can be a touch screen, such as a capacitive screen or an electronic screen, for displaying interface display information of the foreground application, and can also be used for detecting a touch operation acting on the display screen, and generating corresponding instructions, such as performing front and back applications. Switch instructions, etc.
本领域技术人员可以理解,图1中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的电子设备的限定,具体的电子设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。如该电子设备还包括通过系统总线连接的网络接口,网络接口可以是以太网卡或无线网卡等,用于与外部的电子设备进行通信,比如可用于同服务器进行通信。A person skilled in the art can understand that the structure shown in FIG. 1 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution of the present application is applied. The specific electronic device may be It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements. For example, the electronic device further includes a network interface connected through a system bus, and the network interface may be an Ethernet card or a wireless network card, etc., for communicating with an external electronic device, for example, for communicating with a server.
在一个实施例中,如图2所示,提供了一种电子设备的部分架构图。其中,该电子设备的架构系统中包括JAVA空间层210、本地框架层220以及内核(Kernel)空间层230。JAVA空间层210上可包含冻结管理应用212,电子设备可通过该冻结管理应用212来实现对各个应用的冻结策略,对后台耗电的相关应用做冻结和解冻等操作。本地框架层220中包含资源优先级和限制管理模块222和平台冻结管理模块224。电子设备可通过资源优先级和限制管理模块222实时维护不同的应用处于不同优先级和不同资源的组织中,并根据上层的需求来调整应用程序的资源组别从而达到优化性能,节省功耗的作用。电子设备可通过平台冻结管理模块224将后台可以冻结的任务按照进入冻结时间的长短,分配到对应预设的不同层次的冻结层,可选地,该冻结层可包括三个,分别是:CPU限制睡眠模式、CPU冻结睡眠模式、进程深度冻结模式。其中,CPU限制睡眠模式是指对相关进程所占用的CPU资源进行限制,使相关进程占用较少的CPU资源,将空余的CPU资源向其它未被冻结的进程倾斜,限制了对CPU资源的占用,也相应限制了进程对网络资源以及I/O接口资源的占用;CPU冻结睡眠模式是指禁止相关进程使用CPU,而保留对内存的占用,当禁止使用CPU资源时,相应的网络资源以及I/O接口资源也被禁止使用;进程深度冻结模式是指除禁止使用CPU资源 之外,进一步对相关进程所占用的内存资源进行回收,回收的内存可供其它进程使用。内核空间层230中包括UID管理模块231、Cgroup模块232、Binder管控模块233、进程内存回收模块234以及冻结超时退出模块235。其中,UID管理模块231用于实现基于应用的用户身份标识(User Identifier,UID)来管理第三方应用的资源或进行冻结。相比较于基于进程身份标识(Process Identifier,PID)来进行进程管控,通过UID更便于统一管理一个用户的应用的资源。Cgroup模块232用于提供一套完善的中央处理器(Central Processing Unit,CPU)、CPUSET、内存(memory)、输入/输出(input/output,I/O)和Net相关的资源限制机制。Binder管控模块233用于实现后台binder通信的优先级的控制。其中,本地框架层220的接口模块包含开发给上层的binder接口,上层的框架或者应用通过提供的binder接口来发送资源限制或者冻结的指令给资源优先级和限制管理模块222和平台冻结管理模块224。进程内存回收模块234用于实现进程深度冻结模式,这样能当某个第三方应用长期处于冻结状态的时候,会主要释放掉进程的文件区,从而达到节省内存的模块,也加快该应用在下次启动时的速度。冻结超时退出模块235用于解决出现冻结超时场景产生的异常。通过上述的架构,可实现本申请各个实施例中的应用处理方法。In one embodiment, as shown in FIG. 2, a partial architectural diagram of an electronic device is provided. The architecture of the electronic device includes a JAVA spatial layer 210, a local framework layer 220, and a kernel space layer 230. The JAVA spatial layer 210 may include a freeze management application 212 through which the electronic device can implement a freeze policy for each application, and freeze and thaw the related applications of the background power consumption. The resource priority and restriction management module 222 and the platform freeze management module 224 are included in the local framework layer 220. The electronic device can maintain different applications in different priorities and different resource organizations through the resource priority and limit management module 222, and adjust the resource group of the application according to the requirements of the upper layer to achieve optimized performance and save power. effect. The electronic device can allocate the tasks that can be frozen in the background to the frozen layer corresponding to the preset different levels according to the length of the entering freeze time through the platform freeze management module 224. Optionally, the frozen layer can include three, respectively: the CPU Limit sleep mode, CPU freeze sleep mode, process deep freeze mode. The CPU restricts the sleep mode to limit the CPU resources occupied by the related processes, so that the related processes occupy less CPU resources, and the free CPU resources are tilted to other unfrozen processes, thereby limiting the occupation of CPU resources. It also limits the occupation of network resources and I/O interface resources by the process; CPU freeze sleep mode refers to prohibiting related processes from using the CPU, while preserving the occupation of memory, when prohibiting the use of CPU resources, the corresponding network resources and I The /O interface resource is also forbidden; the process deep freeze mode means that in addition to prohibiting the use of CPU resources, the memory resources occupied by the related processes are further recovered, and the recovered memory can be used by other processes. The kernel space layer 230 includes a UID management module 231, a Cgroup module 232, a Binder management module 233, a process memory recovery module 234, and a freeze timeout exit module 235. The UID management module 231 is configured to implement an application-based User Identifier (UID) to manage resources of a third-party application or freeze. Compared with the Process Identifier (PID) for process management and control, it is easier to uniformly manage the resources of a user's application through UID. The Cgroup module 232 is used to provide a complete set of Central Processing Unit (CPU), CPUSET, memory, input/output (I/O), and Net related resource restriction mechanisms. The Binder management module 233 is used to implement the priority control of the background binder communication. The interface module of the local framework layer 220 includes a binder interface developed to the upper layer, and the upper layer framework or application sends a resource restriction or frozen instruction to the resource priority and restriction management module 222 and the platform freeze management module 224 through the provided binder interface. . The process memory recovery module 234 is configured to implement the process deep freeze mode, so that when a third-party application is in a frozen state for a long time, the file area of the process is mainly released, thereby saving the memory module and speeding up the application next time. The speed at startup. The freeze timeout exit module 235 is configured to resolve an exception generated by the freeze timeout scenario. Through the above architecture, the application processing method in various embodiments of the present application can be implemented.
在一个实施例中,如图3所示,提供了一种应用处理方法,本实施例以该方法应用于如图1所示的电子设备为例进行说明。该方法包括:In an embodiment, as shown in FIG. 3, an application processing method is provided. The embodiment is applied to the electronic device shown in FIG. 1 as an example for description. The method includes:
操作302,获取待处理应用所占用的内存页。In operation 302, the memory page occupied by the application to be processed is obtained.
待处理应用表示需要进行对占用内存进行回收的应用。该内存(又称随机存取存储器,random access memory,RAM)表示运行程序时使用的内存(即运行内存),只能临时存储数据,用于与CPU交换高速缓存数据,但是内存本身不能用于长期存储数据,可为如图1所示的内存储器。通常的,待处理应用为后台应用。后台应用为处于后台运行的应用;对应地,处于前台运行的应用即为前台应用。一个应用(Application,简称APP)的运行通常是由相关的多个进程的运行而体现的。进程(process)是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位,是操作系统结构的基础。前台应用运行时涉及的进程即为前台进程,后台应用运行时涉及的进程即为后台进程。The pending application indicates that an application that needs to recycle memory is needed. The memory (also known as random access memory, RAM) indicates the memory used when running the program (that is, running memory). It can only temporarily store data for exchanging cache data with the CPU, but the memory itself cannot be used. Long-term storage of data, which can be an internal memory as shown in FIG. Typically, the pending application is a background application. The background application is an application running in the background; correspondingly, the application running in the foreground is the foreground application. The operation of an application (APP) is usually reflected by the operation of multiple related processes. A process is a running activity of a program on a computer on a data set. It is the basic unit for resource allocation and scheduling, and is the basis of the operating system structure. The process involved in the foreground application runtime is the foreground process, and the process involved in the background application runtime is the background process.
应用在运行的状态下需要占用内存空间来存储运行过程中的数据。不同的应用在不同的运行状态占用的内存空间大小不一定相同。内存页是操作系统对内存进行管理的单位,不同的电子设备设置的内存页占据的单位内存大小不一定相同。比如电子设备内的内存空间被划分为100000个内存页,待处理应用占用的内存页为内存页100至内存页200,而其中的内存页130至内存页200为可回收内存页。The application needs to occupy memory space in the running state to store data during the running process. The memory space occupied by different applications in different running states may not be the same. The memory page is the unit that the operating system manages the memory. The memory size of the memory page set by different electronic devices is not necessarily the same. For example, the memory space in the electronic device is divided into 100000 memory pages, and the memory page occupied by the to-be-processed application is the memory page 100 to the memory page 200, and the memory page 130 to the memory page 200 are recyclable memory pages.
电子设备可记录待处理应用在运行时所使用的所有内存页,如记录其在运行时所使用到的数据被存储至内存页的内存页需要等信息。The electronic device can record all the memory pages used by the pending application at runtime, such as recording the memory pages that are used by the runtime to be stored to the memory pages of the memory page.
操作304,将内存页中存储的数据迁移至用于临时回收数据的临时存储空间中。 Operation 304, the data stored in the memory page is migrated to a temporary storage space for temporarily reclaiming data.
内存页中存储的数据即为相应应用在运行过程中所使用到的或生成的数据,该数据被临时缓存在内存中。临时存储空间为预先设置的用于对内存数据进行临时回收存储的存储空间。该临时存储空间可为块缓存(block cache)、页缓存(page cache)、虚拟内存、flash闪存或外接存储介质等其中的任意一种或几种存储介质中的存储空间。电子设备可将部分或全部内存页中存储的数据迁移至临时存储空间中。临时存储空间用于对内存页中存储的数据进行临时回收和存储,并在一定条件下将存储的数据进行回迁或迁移至其它存储空间中或者进行删除等操作,通过设置临时存储空间,可实现对该待处理应用所占用内存的全部或部分的临时回收和存储。The data stored in the memory page is the data used or generated by the corresponding application during the running process, and the data is temporarily cached in the memory. The temporary storage space is a preset storage space for temporarily reclaiming and storing the memory data. The temporary storage space may be a storage space in any one or several storage media such as a block cache, a page cache, a virtual memory, a flash flash or an external storage medium. An electronic device can migrate data stored in some or all of the memory pages into temporary storage space. The temporary storage space is used for temporarily reclaiming and storing the data stored in the memory page, and performing the operations of relocating or migrating the stored data to other storage spaces or deleting them under certain conditions, and setting the temporary storage space. Temporary recovery and storage of all or part of the memory occupied by the application to be processed.
操作306,在预设的加载界面中运行待处理应用。 Operation 306, running the to-be-processed application in a preset loading interface.
预设的加载界面为预先设置的用于对待处理应用进行运行的承载界面。该加载界面的尺寸和位置可为预设的任意合适的尺寸和位置。在一个实施例中,该加载界面可为电子设 备上预设的一种分屏界面,使得可在该界面上运行待处理应用。The preset loading interface is a pre-set bearer interface for running the application to be processed. The size and location of the loading interface can be any suitable size and location preset. In one embodiment, the loading interface can be a split screen interface preset on the electronic device such that the pending application can be run on the interface.
在一个实施例中,该加载界面可为不接收焦点的、屏幕不可见的界面。其中,焦点表示接收用户的点击或键盘输入的能力,不接收焦点的界面表示在该界面上进行的点击、输入等操作均不做接收或响应。屏幕不可见表示用户视觉看不到的界面,而针对系统来说,是存在的一个界面。其界面展示效果可类似于完全透明的界面的展示效果,使得用户无法查看到该界面上展示的信息。通过设置不接收焦点的、屏幕不可见的界面,使得在该界面上产生的运行不会对用户的操作产生影响。In one embodiment, the loading interface can be an interface that does not receive focus and that is not visible to the screen. The focus indicates the ability to receive the user's click or keyboard input, and the interface that does not receive the focus indicates that the click, input, and the like performed on the interface are not received or responded. The screen is not visible to indicate the interface that the user cannot see, but for the system, there is an interface. The interface display effect can be similar to the display effect of the completely transparent interface, so that the user cannot view the information displayed on the interface. By setting an interface that does not receive focus and the screen is invisible, the operation generated on the interface does not affect the user's operation.
电子设备根据迁移至临时存储空间中的数据在预设的不接收焦点的、屏幕不可见的界面来运行该待处理应用,以检测运行该应用时所需使用到的数据。其中,该使用到的数据包括迁移至临时存储空间中的数据和剩余内存页中未迁移的数据中的至少一种。其中,运行待处理应用的方式可包括对待处理应用进行启动的方式,即通过在该不接收焦点的、屏幕不可见的界面中启动待处理应用,以检测在启动过程中所需使用到的数据。通过在不接收焦点的、屏幕不可见的界面中运行该待处理应用,可降低对用户操作以及系统造成影响,The electronic device runs the pending application based on the data migrated to the temporary storage space at a preset interface that does not receive the focus and is invisible to the screen to detect the data required to run the application. The data used includes at least one of data migrated into the temporary storage space and data not migrated in the remaining memory pages. The manner of running the to-be-processed application may include a manner of starting the application to be processed, that is, by starting the to-be-processed application in the interface that does not receive the focus and being invisible to the screen, to detect the data that is needed during the startup process. . By running the pending application in an interface that does not receive focus and is invisible to the screen, the impact on user operations and the system can be reduced.
操作308,将运行待处理应用的过程中在临时存储空间中使用到的数据重新读回至内存页中,将未使用到的数据进行回收。 Operation 308, the data used in the temporary storage space during the running of the application to be processed is read back into the memory page, and the unused data is recycled.
电子设备针对在运行该应用的过程中检测出所使用到的数据,即可判定为在运行该应用时需要用到的数据,可将该部分数据从该临时存储空间中重新读回至内存页中,以使得用户在需要运行该应用时,可迅速使用重新读回至内存页中的数据,防止待处理应用的运行效率降低。而针对未被使用到的数据,电子设备可对其进行回收,比如可将该未被使用到的数据回收至flash闪存中,降低对内存空间的占用,使得在运行待处理应用的过程中,需要使用到该数据时再将其重新读回至内存页中。可选地,电子设备可重新为待处理应用分配新的内存页,并将在临时存储空间中使用到的数据写入重新分配的内存页对应的内存地址中。The electronic device can determine the data that is used when the application is run by detecting the used data in the process of running the application, and can read the part of the data from the temporary storage space back to the memory page. So that when the user needs to run the application, the data in the memory page can be quickly read back to prevent the running efficiency of the pending application from decreasing. For the data that is not used, the electronic device can recycle the data, for example, the unused data can be recycled to the flash memory, thereby reducing the occupation of the memory space, so that in the process of running the application to be processed, When you need to use this data, read it back into the memory page. Optionally, the electronic device may re-allocate a new memory page to the to-be-processed application, and write the data used in the temporary storage space into the memory address corresponding to the reallocated memory page.
上述的应用处理方法,电子设备通过将待处理应用占用的内存页中的数据迁移至用于临时回收数据的临时存储空间中,然后重新运行待处理应用,以检测迁移了内存页中的数据之后,在预设的加载界面上运行待处理应用的过程中所需使用到的被迁移的数据,电子设备通过重新运行该待处理应用后,将检测出的所需使用到的数据再重新读回至内存页中,防止造成误回收,而对于未使用到的数据,则将其进行回收,从而实现了对待处理应用无需使用的数据进行精准回收,既提高了可用内存的存储空间,又防止待处理应用恢复运行时的运行速度的下降。In the above application processing method, the electronic device migrates data in the memory page occupied by the application to be used in a temporary storage space for temporarily reclaiming data, and then re-runs the to-be-processed application to detect that the data in the memory page is migrated. The migrated data used in the process of running the application to be processed on the preset loading interface, and the electronic device re-reads the detected used data after re-running the to-be-processed application. To the memory page, to prevent accidental recycling, and for the unused data, it will be recycled, thus achieving accurate recycling of the data that is not needed for the application to be processed, which not only improves the storage space of the available memory, but also prevents the data from being stored. Handling the decline in the speed at which the application resumes running.
在一个实施例中,操作302包括:查询待处理应用所占用的内存的所有内存页;从所有内存页中获取可回收内存页。In one embodiment, operation 302 includes querying all memory pages of memory occupied by the application to be processed; and obtaining recyclable memory pages from all memory pages.
电子设备可预先记录待处理应用在运行所占用的所有内存页,并从该所有内存页中获取可收回内存页。可回收内存页表示可进行回收,且回收后对待处理应用以及其它应用的运行不造成影响或者造成的影响较小的内存页。电子设备可记录该所有内存页中,哪些内存页为可回收内存页,哪些内存页为不可回收内存页,并根据该记录信息来获取待处理应用占用的可回收内存页。The electronic device can pre-record all memory pages occupied by the application to be processed, and obtain a retrievable memory page from all the memory pages. Recyclable memory pages represent memory pages that can be recycled and that have no impact on the operation of the application and other applications after they are recycled. The electronic device can record, among the memory pages, which memory pages are recyclable memory pages, which memory pages are non-recyclable memory pages, and according to the record information, obtain recyclable memory pages occupied by the to-be-processed application.
在一个实施例中,电子设备可实时记录不同的应用所占用内存的内存页,并针对该每个被占用的内存页,进一步实时记录其是否可被回收。比如,当存在某一内存页中的数据正在被其它应用或者该待处理应用所使用时,则判定该内存页为不可回收的内存页,当记录到被占用的内存页中的数据处于无应用使用状态,或者处于该无应用使用状态的持续时长超过预设时长时,则判定该内存页为可回收内存页。In one embodiment, the electronic device can record memory pages of memory occupied by different applications in real time, and further record in real time whether it can be recycled for each occupied memory page. For example, when there is data in a certain memory page being used by another application or the application to be processed, it is determined that the memory page is a non-recyclable memory page, and when the data recorded in the occupied memory page is in no application. When the usage state, or the duration of the non-application use state exceeds the preset duration, the memory page is determined to be a reclaimable memory page.
针对待处理应用,电子设备可从预先记录的信息中查询其所占用所有的内存页,并根据所记录的每个内存页的使用状态,判定其是否为可回收内存页,然后获取所有的可回收 内存页。For the application to be processed, the electronic device can query all the memory pages occupied by the pre-recorded information, and determine whether it is a recyclable memory page according to the used state of each memory page, and then obtain all the available Recycle the memory page.
在一个实施例中,查询待处理应用所占用的内存的所有内存页,包括:遍历待处理应用的内存映射文件;通过内存映射文件查询待处理应用占用的所有内存页。In one embodiment, querying all memory pages of the memory occupied by the application to be processed includes: traversing a memory mapped file of the to-be-processed application; and querying all memory pages occupied by the to-be-processed application through the memory mapped file.
内存映射文件(Memory-Mapped Files)是由一个文件到一块内存的映射。电子设备针对该待处理应用建立了对应的内存映射文件,该内存映射文件中设置了对应的应用所占用的内存页,电子设备通过遍历该待处理应用对应的内存映射文件,并从每个遍历到的内存映射文件中读取该待处理应用占用的内存页,从而可获取到该待处理应用所占用的所有的内存页,提高了对待处理应用占用的内存页的查询效率和查询的全面性。Memory-Mapped Files are mappings from one file to one memory. The electronic device establishes a corresponding memory mapping file for the to-be-processed application, where the memory mapping file is set with a memory page occupied by the corresponding application, and the electronic device traverses the memory mapping file corresponding to the to-be-processed application, and traverses from each The memory page occupied by the to-be-processed application is read in the memory mapping file, so that all the memory pages occupied by the to-be-processed application are obtained, and the query efficiency of the memory page occupied by the application to be processed and the comprehensiveness of the query are improved. .
在一个实施例中,从所有内存页中获取可回收内存页,包括:从所有内存页中剔除携带占用标记的内存页;从剔除后的内存页中获取可回收内存页。In one embodiment, the reclaimable memory page is obtained from all of the memory pages, including: removing the memory page carrying the occupied mark from all the memory pages; and obtaining the recyclable memory page from the rejected memory page.
其中,针对查询出的被待处理应用所占用的所有的内存页,电子设备可检测每个查询出的内存页是否携带有占用标记,或者是否被多个应用所占用。其中,占用标记表示对应的内存页中存储的数据正处于对待处理应用所使用,或者是其中的数据是待处理应用在保持正常运行的过程中,不可缺少的数据,当该数据被删除后,待处理应用要么无法正常运行,或者需要反复占用新的内存页来存放对应的数据,针对检测出的这类数据,电子设备可对存储该类数据的内存页而设置占用标记,以表示对应的内存页不能回收。The electronic device can detect whether each of the queried memory pages carries an occupation mark or is occupied by multiple applications, for all the memory pages occupied by the queried application. The occupancy mark indicates that the data stored in the corresponding memory page is being used by the application to be processed, or the data therein is indispensable data in the process of the pending application being kept in normal operation, and when the data is deleted, The pending application may not be able to run normally, or it may need to repeatedly occupy a new memory page to store corresponding data. For such detected data, the electronic device may set an occupancy flag on the memory page storing the data to indicate the corresponding Memory pages cannot be recycled.
被待处理应用占用的内存页中,其中存储的数据还可能被其它应用所使用,即有多个应用均在使用该内存页中的数据,针对该类内存页,也可将其设置占用标记,使电子设备同样将其剔除,以表示不从该类内存页中进行回收。The memory page occupied by the application to be processed, the data stored therein may also be used by other applications, that is, multiple applications are using the data in the memory page, and the memory page may also be set to occupy the mark. , so that the electronic device also culls it to indicate that it is not recycled from the memory page.
针对剔除后的内存页,保留下来的内存页即为可回收内存页,电子设备可从该内存页中进行内存回收。For the culled memory page, the reserved memory page is a recyclable memory page from which the electronic device can perform memory reclamation.
在一个实施例中,电子设备可调用如图2中所示的资源优先级和限制管理模块222来遍历待处理应用的内存映射文件;通过内存映射文件查询待处理应用占用的所有内存页,并通过该资源优先级和限制管理模块222检测每个内存页是否为可回收内存页,电子设备可以对于不可回收内存页设置对应的占用标记,同时记录每个内存页是否还多个应用所占用,从查询出的所有内存页中剔除携带占用标记和/或被多个应用占用的内存页;从剔除后的内存页中获取可回收内存页。In an embodiment, the electronic device may invoke the resource priority and restriction management module 222 as shown in FIG. 2 to traverse the memory mapped file of the to-be-processed application; query all memory pages occupied by the to-be-processed application through the memory-mapped file, and The resource priority and limit management module 222 detects whether each memory page is a reclaimable memory page, and the electronic device can set a corresponding occupation mark for the non-recyclable memory page, and record whether each memory page is occupied by multiple applications. The memory page carrying the occupancy flag and/or occupied by multiple applications is removed from all the memory pages that are queried; the reclaimable memory page is obtained from the culled memory page.
由于进行临时回收的对象是可回收内存页中存储的数据,对于被占用的内存页则并进行临时回收,电子设备可进一步降低对待处理应用或其它应用造成的影响,并且还可降低对在进行临时回收的过程中的数据迁移量。Since the object to be temporarily reclaimed is the data stored in the recyclable memory page, and the occupied memory page is temporarily reclaimed, the electronic device can further reduce the impact on the application or other application to be processed, and can also reduce the ongoing operation. The amount of data migration during the temporary recovery process.
在一个实施例中,在操作304之前,还包括:获取待处理应用对每个内存页的空闲时长;根据每个内存页的空闲时长确定时长阈值;操作304包括:将空闲时长超过时长阈值的内存页中存储的数据迁移至临时存储空间中。In one embodiment, before operation 304, the method further includes: obtaining an idle duration of the to-be-processed application for each memory page; determining a duration threshold according to an idle duration of each memory page; operation 304 includes: setting the idle duration to a duration threshold The data stored in the memory page is migrated to the temporary storage space.
由于内存页中存储的数据并非一直被应用所使用,对内存页的空闲时长表示系统为该待处理应用分配内存页后,该内存页中存储的数据在最近一次被使用之后,处于未被使用状态的持续时长。电子设备根据每个内存页的数据使用情况,来实时更新每个内存页的空闲时长,当准备进行对待处理应用占用的内存页进行回收时,可获取最新记录的每个内存页的空闲时长。Since the data stored in the memory page is not always used by the application, the idle duration of the memory page indicates that after the system allocates a memory page for the pending application, the data stored in the memory page is not used after being used most recently. The duration of the state. The electronic device updates the idle time of each memory page in real time according to the data usage of each memory page. When the memory page occupied by the application to be processed is ready for recycling, the idle time of each memory page of the latest record can be obtained.
在一个实施例中,当最近一次发起对内存页的分配、回收、释放等情形,或者对处理器中缓存的使用情况进行查询的情况,均判定对相应涉及到的内存页的数据进行了使用,并将产生对应情形下的系统时间最为最近一次对内存页的数据使用时间,当前时间和该最近时间之差即为对相应内存页的空闲时长。In one embodiment, when the allocation, reclaim, release, etc. of the memory page is initiated recently, or the usage of the cache in the processor is queried, it is determined that the data of the corresponding memory page is used. And will generate the data usage time of the most recent time on the memory page of the system time in the corresponding situation. The difference between the current time and the latest time is the idle time of the corresponding memory page.
在一个实施例中,电子设备可对每个内存页创建对应的时间戳,该时间戳记录对应内存页中的数据在最近一次的使用时间。在操作系统中,每当主动发起对内存的分配、回收、 释放等时机,电子设备可对相应内存页的活跃度进行更新,并将该更新时间记录在该时间戳中。或者在系统定时检查处理器缓存的使用情况,电子设备可判定当前缓存中的数据都为当前使用的数据,并更新所涉及到的内存页的时间戳,将该更新时间记录在该时间戳中。可选地,电子设备可将最新记录到的更新时间替换掉上一次的更新时间,以减少更新时间的资源占用。In one embodiment, the electronic device can create a corresponding timestamp for each memory page that records the most recent usage time of the data in the corresponding memory page. In the operating system, the electronic device can update the activity of the corresponding memory page whenever the initiative allocates the memory allocation, collection, release, etc., and records the update time in the timestamp. Or the system periodically checks the usage of the processor cache, and the electronic device can determine that the data in the current cache is the currently used data, and update the timestamp of the memory page involved, and record the update time in the timestamp. . Optionally, the electronic device may replace the latest updated update time with the last update time to reduce the resource consumption of the update time.
时长阈值表示用于决定是否对内存页进行回收的临界数值。时长阈值可为固定的数值,或者还可根据每个内存页的空闲时长而确定的时长阈值,空闲时长不同,所确定的时长阈值也不一定相同。The duration threshold represents the critical value used to decide whether to recycle the memory page. The duration threshold may be a fixed value, or may be a duration threshold determined according to the idle duration of each memory page, the idle duration is different, and the determined duration thresholds are not necessarily the same.
在一个实施例中,时长阈值可为所有内存页的空闲时长的加权平均值,或者还可为电子设备从该所有内存页的空闲时长中选取一个空闲时长,将选取的空闲时长作为时长阈值。比如电子设备可在该待处理应用占用的所有内存页的空闲时长中,选取处于与中位数相接近的,或者处于排序在某一位置上的空闲时长,将选取的空闲时长作为时长阈值。In one embodiment, the duration threshold may be a weighted average of the idle durations of all memory pages, or may also be an idle duration selected by the electronic device from the idle duration of the all memory pages, and the selected idle duration is used as the duration threshold. For example, the electronic device may select the idle duration that is close to the median or is in a certain position in the idle duration of all the memory pages occupied by the to-be-processed application, and select the idle duration as the duration threshold.
电子设备可按照所确定的时长阈值,从该待处理应用占用的内存页中,选取空闲时长超过该时长阈值的内存页进行临时回收,将选取的内存页中存储的数据写入临时存储空间中。可选地,电子设备可通过上述的进程内存回收模块234,按照该时长阈值从内存页中进行内存页的回收,将回收的内存页中存储的数据写入临时存储空间中。The electronic device may temporarily collect the memory page whose idle time exceeds the duration threshold from the memory page occupied by the to-be-processed application according to the determined duration threshold, and write the data stored in the selected memory page into the temporary storage space. . Optionally, the electronic device may use the process memory collection module 234 to recover the memory page from the memory page according to the duration threshold, and write the data stored in the recovered memory page into the temporary storage space.
举例来说,内存页有100页,相应的空闲时长分别处于5秒至15分钟之间,当根据该空闲时长而确定的时长阈值为5分钟时,可从该100页的内存页中,回收空闲时长超过5分钟的内存页。For example, the memory page has 100 pages, and the corresponding idle duration is between 5 seconds and 15 minutes respectively. When the duration threshold determined according to the idle duration is 5 minutes, the 100 pages of memory pages can be recovered. A memory page that is idle for more than 5 minutes.
在一个实施例中,被临时回收存储数据的内存页为可回收内存页。In one embodiment, the memory page that is temporarily reclaimed to store data is a reclaimable memory page.
上述方法中,电子设备通过按照与每个内存页的空闲时长,选取空闲时长超过相应的时长阈值的内存页进行回收,进一步降低了对待处理应用的运行影响,并能提高临时回收数据的精准性,降低了后续需要重新读回内存页中的数据量,对每个应用的负面影响最小,又提高了内存使用效率,保持了对待处理应用内存的回收与运行之间的平衡性。In the above method, the electronic device selects a memory page whose idle time exceeds a corresponding duration threshold according to the idle time of each memory page, thereby further reducing the operational impact of the application to be processed, and improving the accuracy of temporarily recovering data. It reduces the amount of data that needs to be read back into the memory page, minimizes the negative impact on each application, improves the memory usage efficiency, and maintains the balance between the recycling and operation of the application memory to be processed.
在一个实施例中,获取待处理应用对每个内存页的空闲时长,包括:获取每个内存页的时间戳记录的更新时间,根据更新时间计算出对应内存页的空闲时长。In an embodiment, obtaining the idle duration of the memory page of the to-be-processed application includes: obtaining an update time of the timestamp record of each memory page, and calculating an idle duration of the corresponding memory page according to the update time.
电子设备可通过上述的资源优先级和限制管理模块222,为每个内存页创建一个时间戳,该时间戳用于记录对应的更新时间,更新时间表示对应内存页最近被使用的时间。当检测到每个内存页中的内存被使用时,可对该时间戳记录的更新时间进行更新。The electronic device can create a timestamp for each memory page by using the resource priority and limit management module 222 described above, the timestamp is used to record the corresponding update time, and the update time indicates the time when the corresponding memory page is recently used. When the memory in each memory page is detected to be used, the update time of the timestamp record can be updated.
其中,每当最近一次发起对内存页的分配、回收、释放等情形,或者对处理器中缓存的使用情况进行查询的情况时,电子设备均判定对相应涉及到的内存页的数据进行了使用,并将产生对应情形下的系统时间作为该更新时间。当开始执行内存回收机制时,电子设备可根据该时间戳记录的更新时间和当前系统时间,可计算出相应的内存页的空闲时长。当前时间和该最近时间之差即为对相应内存页的空闲时长。The electronic device determines that the data of the corresponding memory page is used whenever the last time the memory page is allocated, recycled, released, or the like, or the cached usage of the processor is used. And will generate the system time in the corresponding situation as the update time. When the memory reclamation mechanism is started, the electronic device can calculate the idle duration of the corresponding memory page according to the update time recorded by the time stamp and the current system time. The difference between the current time and the most recent time is the idle time for the corresponding memory page.
电子设备通过利用软件创建时间戳的方式来记录每个内存页的更新时间,根据该更新时间来确定空闲时长,可以有效兼容不同的处理器,提高了对内存回收的通用性。The electronic device records the update time of each memory page by using the software to create a time stamp, and determines the idle duration according to the update time, which can effectively be compatible with different processors, and improves the versatility of memory recovery.
在一个实施例中,获取待处理应用对每个内存页的空闲时长,包括:获取通过最近最久未使用LRU管理单元记录的每个内存页的更新时间,根据更新时间计算出对应内存页的空闲时长。In an embodiment, obtaining the idle duration of the memory to be processed by the application to be processed includes: obtaining an update time of each memory page recorded by the latest unused LRU management unit, and calculating the idleness of the corresponding memory page according to the update time. duration.
在处理器中的内存管理或缓存单元中,设置相应的最近最久未使用(Least Recently Used,LRU)管理单元,用于对最近使用到的内存进行统计。LRU管理单元可记录每个内存地址以及该内存地址的更新时间,当某一地址的内存被使用到时,处理器将对应的内存地址和更新时间放入LRU管理单元中保存。当开始执行内存回收机制时,电子设备可根据该内存地址和内存页之间的对应关系,可获知每个内存地址对应的内存页,进而可从LRU管 理单元中读取对应内存页的更新时间。其中,每当最近一次发起对内存页的分配、回收、释放等情形,或者对处理器中缓存的使用情况进行查询的情况时,电子设备均判定对相应涉及到的内存页的数据进行了使用,并将产生对应情形下的系统时间作为该更新时间。In the memory management or cache unit in the processor, set the corresponding Least Recently Used (LRU) management unit to collect statistics on the most recently used memory. The LRU management unit can record each memory address and the update time of the memory address. When the memory of an address is used, the processor stores the corresponding memory address and update time in the LRU management unit. When the memory recovery mechanism is started, the electronic device can obtain the memory page corresponding to each memory address according to the correspondence between the memory address and the memory page, and further read the update time of the corresponding memory page from the LRU management unit. . The electronic device determines that the data of the corresponding memory page is used whenever the last time the memory page is allocated, recycled, released, or the like, or the cached usage of the processor is used. And will generate the system time in the corresponding situation as the update time.
当LRU管理单元用满后,电子设备可产生中断信息并通知操作系统,操作系统在读取LRU管理单元的数据后可清空其中的数据,使得LRU管理单元可重新开始工作,存储每个内存地址及其对应的更新时间等信息。When the LRU management unit is full, the electronic device can generate an interrupt message and notify the operating system, and the operating system can clear the data after reading the data of the LRU management unit, so that the LRU management unit can restart work and store each memory address. And its corresponding update time and other information.
本实施例中,电子设备通过创建LRU管理单元,可以精确地追踪每一个内存的使用情况,提高了对内存页的更新时间检测的准确性,也提高了内存回收的便利性。In this embodiment, by creating an LRU management unit, the electronic device can accurately track the usage of each memory, improve the accuracy of detecting the update time of the memory page, and improve the convenience of memory recovery.
在一个实施例中,根据每个内存页的空闲时长确定时长阈值,包括:根据每个内存页的空闲时长计算出待处理应用对内存页的平均空闲时长,将平均空闲时长作为时长阈值。In one embodiment, determining the duration threshold according to the idle duration of each memory page includes: calculating an average idle duration of the to-be-processed application to the memory page according to the idle duration of each memory page, and using the average idle duration as the duration threshold.
其中,平均空闲时长可为待处理应用所占用的内存页中,每个内存页的占用时长的平均值。电子设备可根据统计到的每个内存页的占用时长,调用相应的计算单元进行计算,以计算出该平均空闲时长,将该平均空闲时长作为时长阈值。电子设备可以通过将平均空闲时长作为时长阈值,可提高对时长阈值的计算效率,且计算简单,从而也相应提高了对内存回收的效率。The average idle duration may be an average value of the occupied duration of each memory page in the memory page occupied by the application to be processed. The electronic device may calculate the average idle duration by using the corresponding calculation unit to calculate the average duration of each memory page according to the occupied duration of each memory page, and use the average idle duration as the duration threshold. The electronic device can increase the calculation efficiency of the duration threshold by using the average idle duration as the duration threshold, and the calculation is simple, thereby correspondingly improving the efficiency of memory recovery.
在一个实施例中,如图4所示,提供了另一种应用处理方法,该方法包括:In one embodiment, as shown in FIG. 4, another application processing method is provided, the method comprising:
操作402,获取待处理应用所占用的可回收内存页。Operation 402: Acquire a reclaimable memory page occupied by the to-be-processed application.
可选地,电子设备可遍历待处理应用的内存映射文件;通过内存映射文件查询待处理应用占用的所有内存页;从所有内存页中剔除携带占用标记的内存页;从剔除后的内存页中获取可回收内存页。Optionally, the electronic device may traverse the memory mapped file of the to-be-processed application; query all memory pages occupied by the to-be-processed application through the memory-mapped file; and remove the memory page carrying the occupied mark from all the memory pages; from the eliminated memory page Get reclaimable memory pages.
操作404,获取待处理应用对每个可回收内存页的空闲时长。Operation 404: Acquire an idle duration of the to-be-processed application for each recyclable memory page.
在一个实施例中,电子设备可获取每个内存页的时间戳记录的更新时间,根据更新时间计算出对应内存页的空闲时长;或获取通过最近最久未使用LRU管理单元记录的每个内存页的更新时间,根据更新时间计算出对应内存页的空闲时长。In one embodiment, the electronic device may acquire an update time of the timestamp record of each memory page, calculate an idle duration of the corresponding memory page according to the update time, or acquire each memory page recorded by the most recently unused LRU management unit. The update time, based on the update time, calculates the idle duration of the corresponding memory page.
操作406,根据每个可回收内存页的空闲时长计算出待处理应用对内存页的平均空闲时长,将平均空闲时长作为时长阈值。 Operation 406, calculating an average idle duration of the to-be-processed application to the memory page according to the idle duration of each reclaimable memory page, and using the average idle duration as the duration threshold.
平均空闲时长为根据每个可回收内存页的空闲时长进行求平均值而计算出的时长。电子设备通过将平均空闲时长作为时长阈值,可进一步提高对可回收内存页进行临时回收的准确性。The average idle duration is the length of time calculated by averaging the idle duration of each recyclable memory page. By using the average idle duration as the duration threshold, the electronic device can further improve the accuracy of temporarily recovering the recyclable memory page.
操作408,将空闲时长超过时长阈值的可回收内存页中存储的数据迁移至页缓存中的存储空间中。 Operation 408, migrating data stored in the reclaimable memory page whose idle time exceeds the duration threshold to the storage space in the page cache.
页缓存可为预先划分出的用于临时存储内存页中存储的数据的存储介质。电子设备通过将可回收内存页中的数据迁移至页缓存中,可提高对该数据的迁移效率。The page cache may be a pre-defined storage medium for temporarily storing data stored in a memory page. An electronic device can improve the efficiency of migration of data by migrating data from a reclaimable memory page to a page cache.
操作410,在不接收焦点的、屏幕不可见的界面中运行待处理应用。 Operation 410, running the pending application in an interface that does not receive focus and is invisible to the screen.
在一个实施例中,不接收焦点的、屏幕不可见的界面的尺寸与系统显示界面的尺寸相同。举例来说,如图5所示,为一个实施例中包含了不接收焦点的、屏幕不可见的界面的示意图。其中,界面502即为该不接收焦点的、屏幕不可见的界面,界面504为正常的系统显示界面。该界面可为手机操作界面,该不接收焦点的、屏幕不可见的界面可为与手机屏幕尺寸相同的界面。电子设备通过在系统可识别而用户不可见的、不接收焦点的界面上运行待处理应用,从而不会影响前台操作,也不会对待处理应用的运行造成干扰,使得在该不接收焦点的、屏幕不可见的界面上运行待处理应用时,所需使用到的数据也为在系统正常显示界面上运行待处理应用时所需使用到的数据,从而可实现对运行待处理应用所需使用数据的精准检测。其中,运行待处理应用可为启动待处理应用。In one embodiment, the size of the screen that is not in focus and that is not visible to the screen is the same size as the system display interface. For example, as shown in FIG. 5, a schematic diagram of an interface that does not receive focus and that is invisible to the screen is included in one embodiment. The interface 502 is an interface that does not receive the focus and is invisible to the screen, and the interface 504 is a normal system display interface. The interface may be a mobile phone operation interface, and the interface that does not receive the focus and the screen is invisible may be the same interface as the screen size of the mobile phone. The electronic device runs the to-be-processed application on an interface that is identifiable by the system and is invisible to the user and does not receive the focus, so that the foreground operation is not affected, and the operation of the processing application is not disturbed, so that the focus is not received. When the pending application is run on the interface that is not visible on the screen, the data used is also the data that needs to be used when running the pending application on the normal display interface of the system, so that the data required for running the pending application can be realized. Accurate detection. The running the application to be processed may be to start the application to be processed.
操作412,将运行待处理应用的过程中在页缓存中的存储空间中使用到的数据重新读 回至内存页中,将未使用到的数据进行回收。 Operation 412, the data used in the storage space in the page cache in the process of running the application to be processed is read back into the memory page, and the unused data is recycled.
针对在运行该应用的过程中检测出所使用到的数据,电子设备即可判定为在运行该应用时需要用到的数据,可将检测出的使用的到的数据从页缓存中重新读回至内存页中,该内存页可为重新分配的内存页,或者为对应存储迁移存储的数据的内存页。针对检测出未使用到的数据,电子设备可将其回收至flash闪存之中,使得后续需要使用时,可从该flash闪存中加载回来。The electronic device can determine the data that needs to be used when the application is run, and can detect the used data to be read back from the page cache to the data used in the process of running the application. In a memory page, the memory page can be a reallocated memory page or a memory page that corresponds to the data stored in the migration store. In order to detect unused data, the electronic device can recycle it into the flash memory so that it can be loaded back from the flash memory when needed later.
上述的应用处理方法,电子设备通过将待处理应用所占用的内存页中存储的数据迁移至用于临时回收数据的临时存储空间中,然后在不接收焦点的、屏幕不可见的界面中运行待处理应用,从而可准确检测出该待处理应用所需使用到的数据,进而将在临时存储空间中使用到的数据重新读回至内存页中,将未使用到的数据进行回收,实现了对待处理应用无需使用的内存数据进行精准回收,既提高了可用内存的存储空间,又防止待处理应用恢复运行时的运行速度的下降。In the above application processing method, the electronic device migrates the data stored in the memory page occupied by the application to be processed into a temporary storage space for temporarily reclaiming data, and then runs in an interface that does not receive the focus and is invisible to the screen. Processing the application, so that the data used by the to-be-processed application can be accurately detected, and the data used in the temporary storage space is read back into the memory page, and the unused data is recycled, and the treatment is realized. Handling the memory data that is not needed by the application for accurate recovery, which not only improves the storage space of the available memory, but also prevents the running speed of the pending application from being resumed.
在一个实施例中,在获取待处理应用所占用的内存页之前,还包括:检测待处理应用是否被前台应用依赖;若是,则将待处理应用的优先级调整至与前台应用相匹配;否则,执行获取待处理应用所占用的内存页。In an embodiment, before acquiring the memory page occupied by the to-be-processed application, the method further includes: detecting whether the to-be-processed application is dependent on the foreground application; if yes, adjusting the priority of the to-be-processed application to match the foreground application; otherwise , execute the memory page occupied by the application to be processed.
在一个实施例中,当前台应用结束对待处理应用的依赖时,执行获取待处理应用所占用的内存页。In one embodiment, when the current station application ends the dependency on the application to be processed, the memory page occupied by the application to be processed is executed.
依赖表示一个应用需要利用于另一个或多个应用的数据才能顺利实现对该一个应用的正常运行的关系。存在依赖关系的两个应用,分别为被依赖的应用和依赖的应用,电子设备将检测出的将被前台应用依赖的后台运行的待处理应用判定为被前台应用依赖的后台应用。电子设备可对检测出的被前台应用所依赖的后台应用设置对应的被依赖标记,并从后台应用池中获取带有被依赖标记的后台应用,将该后台应用判定为被前台应用依赖的后台应用。前台应用即为前台运行的应用。Dependency indicates that an application needs to utilize data from one or more applications in order to successfully implement the normal operation of the application. There are two applications of the dependency, which are the dependent application and the dependent application, respectively, and the electronic device detects the pending application to be processed by the foreground application to be determined by the foreground application as the background application that is depended by the foreground application. The electronic device may set a corresponding dependency mark to the detected background application that is determined by the foreground application, and obtain a background application with the dependency mark from the background application pool, and determine the background application as a background that is depended by the foreground application. application. The foreground application is the application running in the foreground.
针对该待处理应用,当被前台应用依赖时,电子设备可将待处理应用判定为被前台应用依赖的应用,将被前台应用依赖的待处理应用的优先级调整至与前台应用的优先级相匹配。For the to-be-processed application, when dependent on the foreground application, the electronic device may determine that the to-be-processed application is an application that is dependent on the foreground application, and adjust the priority of the to-be-processed application that is affected by the foreground application to be prioritized with the foreground application. match.
可选地,针对查询出的被前台应用依赖的待处理应用,电子设备可对其优先级进行调整,使得调整后的优先级与该前台应用的优先级相匹配。电子设备可设置不同的被前台应用依赖的待处理应用的优先级与前台优先级的匹配关系。根据该匹配关系,电子设备可以获取对应的适用于被前台应用依赖的待处理应用的优先级,并将被前台应用依赖的待处理应用的优先级调整至该优先级,降低对被前台应用依赖的待处理应用的资源限制程度,使得对被前台应用依赖的待处理应用所能使用的资源的限制程度与前台应用的限制程度相匹配。Optionally, the electronic device may adjust the priority of the queried application to be processed by the foreground application, so that the adjusted priority matches the priority of the foreground application. The electronic device can set different matching relationships between the priority of the pending application and the foreground priority that are depended by the foreground application. According to the matching relationship, the electronic device may obtain a corresponding priority applicable to the to-be-processed application that is dependent on the foreground application, and adjust the priority of the to-be-processed application that is to be processed by the foreground application to the priority, thereby reducing the dependency on the foreground application. The resource limit of the pending application is such that the degree of restriction on the resources that can be used by the pending application that is dependent on the foreground application matches the limit of the foreground application.
在一个实施例中,与该前台应用的优先级相匹配的优先级,可为与该前台应用的优先级相同的优先级。即电子设备可将该被前台应用依赖的待处理应用的优先级调整至与该前台应用的优先级相同的优先级,使得对被前台应用依赖的待处理应用所能使用的资源的限制程度与前台应用的限制程度相同。In one embodiment, the priority that matches the priority of the foreground application may be the same priority as the foreground application. That is, the electronic device can adjust the priority of the to-be-processed application that is dependent on the foreground application to the same priority as the foreground application, so that the degree of limitation on resources that can be used by the to-be-processed application that is dependent on the foreground application is The foreground application is limited to the same extent.
电子设备通过对待处理应用进行依赖关系检测,将被前台应用所依赖的待处理应用的优先级调整至与前台应用相配的优先级。由于通常前台应用的优先级最高,对应可使用的资源的限制程度最低,而后台进程的优先级较低,以防止后台进程占用过多的资源,对前台应用造成影响。然而后台进程中存在着被前台应用所依赖的情况,被依赖的后台进程执行效率时,也会对前台应用造成影响。本申请实施例通过调整被依赖的待处理应用的优先级调整至与前台优先级相匹配的优先级,从而可降低被依赖的待处理应用所能使用的资源的限制程度,从而提高了被依赖的待处理应用的处理效率。由于该被依赖的待处理应用的 处理效率提高了,从而也提高了依赖于该被依赖的待处理应用的前台应用的处理效率。The electronic device performs dependency detection by the application to be processed, and adjusts the priority of the to-be-processed application that the foreground application depends on to the priority of the foreground application. Because the foreground application has the highest priority, the limit of the available resources is the lowest, and the background process has the lower priority to prevent the background process from occupying too many resources and affecting the foreground application. However, there are situations in the background process that are depended on by the foreground application. When the background process is dependent on the execution efficiency, it will also affect the foreground application. The embodiment of the present application adjusts the priority of the dependent application to be processed to the priority matching the foreground priority, thereby reducing the degree of limitation of resources that can be used by the dependent application to be processed, thereby improving the dependency. The processing efficiency of the pending application. Since the processing efficiency of the dependent pending application is improved, the processing efficiency of the foreground application depending on the dependent pending application is also improved.
在一个实施例中,当待处理应用与前台应用之间存在socket通信、binder通信、内存共享或锁等待时,判定后台进程与前台应用之间存在通信机制。In one embodiment, when there is socket communication, binder communication, memory sharing or lock waiting between the to-be-processed application and the foreground application, it is determined that there is a communication mechanism between the background process and the foreground application.
可通过以下任意一种或几种方式检测是否存在与前台应用具有通信机制的后台进程:You can detect whether there is a background process that has communication mechanism with the foreground application by any one or several of the following methods:
(1)检测是否存在与前台应用具有socket和binder通信中的至少一种的后台进程;(1) detecting whether there is a background process having at least one of socket and binder communication with the foreground application;
(2)检测是否存在与前台应用之间进行内存共享的后台进程;(2) detecting whether there is a background process for memory sharing with the foreground application;
(3)检测是否存在前台应用等待在锁资源上的后台进程。(3) Detect whether there is a background process waiting for the foreground application to wait on the lock resource.
电子设备可在Binder驱动中设置对前台应用和后台进程之间是否存在Binder通信的检测机制,并调用在Binder驱动中设置的检测机制,以检测出与前台应用存在Binder通信的后台进程,将检测出的后台进程判定为被前台应用依赖的后台进程。The electronic device can set a detection mechanism for the Binder communication between the foreground application and the background process in the Binder driver, and call the detection mechanism set in the Binder driver to detect the background process that the Binder communication exists with the foreground application, and the detection will be detected. The background process is determined to be a background process that is dependent on the foreground application.
在一个实施例中,电子设备可检测各个锁资源,锁资源包括线程锁,文件句柄,信号等。针对每个锁资源,可检测是否发生锁等待,即锁资源等待。当检测到产生锁等待时,可进一步检测该发生等待的行为是否发生在前台应用上。若是,则遍历等待在该锁资源上面的所有后台进程,将检测到的等待在该锁资源上的后台进程均判定为被前台应用依赖的后台进程。In one embodiment, the electronic device can detect individual lock resources, including thread locks, file handles, signals, and the like. For each lock resource, it can be detected whether a lock wait occurs, that is, the lock resource waits. When it is detected that a lock wait is generated, it may be further detected whether the behavior of the occurrence of the wait occurs on the foreground application. If so, all the background processes waiting for the lock resource are traversed, and the detected background processes waiting on the lock resource are all determined to be background processes that are depended by the foreground application.
在一个实施例中,电子设备可在操作系统的内核空间中设置锁资源监控模块和优先级调整模块,将锁资源监控模块内嵌到内核原生的等待接口当中。通过该锁资源监控模块,检测线程锁,文件句柄,信号等锁各种锁资源,是否发生等待,发生等待的行为是否是发生在前台应用上面,如果是发生在前台任务上面,则将检测到的消息发送至优先级调整模块。电子设备通过该优先级调整遍历等待在该锁资源上面的所有后台线程,将这些后台进程判定为被前台应用依赖的后台进程。并通过该优先级调整模块将相应的待处理应用的优先级调整至相匹配的优先级。In one embodiment, the electronic device may set 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 the kernel's native waiting interface. Through the lock resource monitoring module, detecting thread locks, file handles, signals, etc. lock various lock resources, whether a wait occurs, whether the waiting behavior occurs in the foreground application, and if it occurs on the foreground task, it will detect The message is sent to the priority adjustment module. The electronic device traverses all the background threads waiting for the lock resource by the priority adjustment, and determines these background processes as the background processes that are depended by the foreground application. And the priority adjustment module adjusts the priority of the corresponding pending application to the matching priority.
在一个实施例中,当后台进程与前台应用之间存在同步机制时,判定具有同步机制的待处理应用为被前台应用依赖的后台进程。In an embodiment, when there is a synchronization mechanism between the background process and the foreground application, it is determined that the to-be-processed application with the synchronization mechanism is a background process that is dependent on the foreground application.
电子设备还可通过调用futex系统调用检测后台进程集合中,是否存在与前台应用具有同步机制的后台进程,将具有同步机制的后台进程判定为被前台应用依赖的后台进程。The electronic device can also detect the background process in the background process set by calling the futex system call, whether there is a background process having a synchronization mechanism with the foreground application, and determine the background process with the synchronization mechanism as the background process that is depended by the foreground application.
并发程序设计中,各进程对公共变量的访问必须加以制约,这种制约称为同步。在操作系统中,用户态(user mode)的同步机制可通过调用futex系统调用实现。其中,用户态指非特权状态。同步机制包括信号量、互斥锁等。当通过futex系统调用检测到与前台应用存在任意一种同步机制的后台进程时,电子设备可将检测到的后台进程判定为被前台应用依赖的后台进程。In concurrent programming, access to public variables must be restricted by each process. This constraint is called synchronization. In the operating system, the user mode synchronization mechanism can be implemented by calling the futex system call. Among them, the user state refers to the non-privileged state. Synchronization mechanisms include semaphores, mutex locks, and more. When a background process that detects any kind of synchronization mechanism with the foreground application is detected by the futex system call, the electronic device may determine the detected background process as a background process that is dependent on the foreground application.
电子设备通过对前台应用和后台进程之间的通信机制和同步机制中的至少一种的检测,将检测出的与前台应用具有通信机制和同步机制中的至少一种的后台进程判定为被前台应用依赖的后台进程,可提高对被前台应用依赖的待处理应用的检测的效率。The electronic device determines, by the detection of at least one of a communication mechanism and a synchronization mechanism between the foreground application and the background process, that the detected background process having at least one of a communication mechanism and a synchronization mechanism with the foreground application is the foreground Application-dependent background processes can improve the efficiency of detection of pending applications that are dependent on the foreground application.
应该理解的是,虽然图3和图4的流程图中的各个操作按照箭头的指示依次显示,但是这些操作并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些操作的执行并没有严格的顺序限制,这些操作可以以其它的顺序执行。而且,图3和图4中的至少一部分操作可以包括多个子操作或者多个阶段,这些子操作或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子操作或者阶段的执行顺序也不必然是依次进行,而是可以与其它操作或者其它操作的子操作或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the operations in the flowcharts of FIGS. 3 and 4 are sequentially displayed as indicated by the arrows, these operations are not necessarily performed in the order indicated by the arrows. Except as explicitly stated herein, the execution of these operations is not strictly limited, and the operations may be performed in other sequences. Moreover, at least some of the operations in FIGS. 3 and 4 may include multiple sub-operations or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, or The order of execution of the stages is also not necessarily sequential, but may be performed alternately or alternately with at least a portion of the sub-operations or stages of other operations or other operations.
在一个实施例中,如图6所示,提供了一种应用处理装置,该装置包括:内存页获取模块602、存储数据处理模块604以及应用处理模块606。其中,内存页获取模块602用于获取待处理应用所占用的内存页;存储数据处理模块604用于将内存页中存储的数据迁移至 用于临时回收数据的临时存储空间中;应用处理模块606用于在预设的加载界面中运行待处理应用;存储数据处理模块604还用于将运行待处理应用的过程中在临时存储空间中使用到的数据重新读回至内存页中,将未使用到的数据进行回收。In one embodiment, as shown in FIG. 6, an application processing apparatus is provided. The apparatus includes a memory page acquisition module 602, a storage data processing module 604, and an application processing module 606. The memory page obtaining module 602 is configured to acquire a memory page occupied by the to-be-processed application; the storage data processing module 604 is configured to migrate data stored in the memory page to a temporary storage space for temporarily reclaiming data; and the application processing module 606 For running the to-be-processed application in the preset loading interface; the storage data processing module 604 is further configured to read back the data used in the temporary storage space in the process of running the to-be-processed application to the memory page, and the unused data will be unused. The data obtained is recycled.
在一个实施例中,内存页获取模块602还用于遍历待处理应用的内存映射文件;通过内存映射文件查询待处理应用占用的所有内存页;从所有内存页中剔除携带占用标记的内存页;从剔除后的内存页中获取可回收内存页。In one embodiment, the memory page obtaining module 602 is further configured to: traverse the memory mapped file of the to-be-processed application; query all memory pages occupied by the to-be-processed application through the memory-mapped file; and remove the memory page carrying the occupied mark from all the memory pages; Get reclaimable memory pages from the stripped memory page.
在一个实施例中,如图7所示,提供了另一种内存处理装置,该装置还包括:In one embodiment, as shown in FIG. 7, another memory processing device is provided, the device further comprising:
时长确定模块608,用于获取待处理应用对每个内存页的空闲时长;根据每个内存页的空闲时长确定时长阈值。The duration determining module 608 is configured to obtain an idle duration of the to-be-processed application for each memory page; and determine a duration threshold according to the idle duration of each memory page.
存储数据处理模块604还用于将空闲时长超过时长阈值的内存页中存储的数据迁移至临时存储空间中。The storage data processing module 604 is further configured to migrate data stored in the memory page whose idle duration exceeds the duration threshold into the temporary storage space.
在一个实施例中,时长确定模块608还用于获取每个内存页的时间戳记录的更新时间,根据更新时间计算出对应内存页的空闲时长;或获取通过最近最久未使用LRU管理单元记录的每个内存页的更新时间,根据更新时间计算出对应内存页的空闲时长。In an embodiment, the duration determining module 608 is further configured to obtain an update time of the timestamp record of each memory page, calculate an idle duration of the corresponding memory page according to the update time, or obtain a record that is recorded by the most recently unused LRU management unit. The update time of each memory page, and the idle time of the corresponding memory page is calculated according to the update time.
在一个实施例中,时长确定模块608还用于根据每个内存页的空闲时长计算出待处理应用对内存页的平均空闲时长,将平均空闲时长作为时长阈值。In one embodiment, the duration determining module 608 is further configured to calculate an average idle duration of the to-be-processed application for the memory page according to the idle duration of each memory page, and use the average idle duration as the duration threshold.
在一个实施例中,临时存储空间包括页缓存中的存储空间;加载界面为不接收焦点的、屏幕不可见的界面,该加载界面的尺寸与系统显示界面的尺寸相同。In one embodiment, the temporary storage space includes a storage space in the page cache; the loading interface is an interface that does not receive the focus and is invisible to the screen, and the size of the loading interface is the same as the size of the system display interface.
在一个实施例中,如图8所示,提供了又一种应用处理装置,该装置还包括:In one embodiment, as shown in FIG. 8, yet another application processing device is provided, the device further comprising:
依赖检测模块610,用于检测待处理应用是否被前台应用依赖。The dependency detection module 610 is configured to detect whether the to-be-processed application is dependent on the foreground application.
优先级调整模块612,用于当待处理应用被前台应用依赖时,将待处理应用的优先级调整至与前台应用相匹配。The priority adjustment module 612 is configured to adjust the priority of the to-be-processed application to match the foreground application when the to-be-processed application is dependent on the foreground application.
上述应用处理装置中各个模块的划分仅用于举例说明,在其他实施例中,可将应用处理装置按照需要划分为不同的模块,以完成上述应用处理装置的全部或部分功能。关于应用处理装置的具体限定可以参见上文中对于应用处理方法的限定,在此不再赘述。上述应用处理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于电子设备中的处理器中,也可以以软件形式存储于电子设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。The division of each module in the application processing device is for illustrative purposes only. In other embodiments, the application processing device may be divided into different modules as needed to complete all or part of the functions of the application processing device. For specific definitions of the application processing device, reference may be made to the above definition of the application processing method, and details are not described herein again. The various modules in the application processing device described above may be implemented in whole or in part by software, hardware, and combinations thereof. Each of the above modules may be embedded in or independent of the processor in the electronic device, or may be stored in a memory in the electronic device in a software format, so that the processor calls to perform operations corresponding to the above modules.
本申请实施例中提供的应用处理装置中的各个模块的实现可为计算机程序的形式。该计算机程序可在终端或服务器等电子设备上运行。该计算机程序构成的程序模块可存储在电子设备的存储器上。该计算机程序被处理器执行时,实现本申请实施例中所描述的应用处理方法的操作。The implementation of each module in the application processing apparatus provided in the embodiments of the present application may be in the form of a computer program. The computer program can run on an electronic device such as a terminal or a server. The program module of the computer program can be stored on a memory of the electronic device. When the computer program is executed by the processor, the operation of the application processing method described in the embodiment of the present application is implemented.
在一个实施例中,提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现上述各实施例所提供的应用处理方法的操作。In one embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and operable on the processor, and the application processing provided by the above embodiments is implemented when the processor executes the computer program The operation of the method.
在一个实施例中,还提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序对处理器执行时,实现本申请各实施例中所描述的应用处理方法的操作。In one embodiment, there is also provided a computer readable storage medium having stored thereon a computer program for performing application processing as described in various embodiments of the present application when executed by a processor The operation of the method.
在一个实施例中,提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行本申请各实施例中所描述的应用处理方法。In one embodiment, a computer program product comprising instructions, when executed on a computer, causes the computer to perform the application processing methods described in the various embodiments of the present application.
本申请实施例还提供了一种计算机设备。如图9所示,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该计算机设备可以为包括手机、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑、穿戴式设备等任意终端设备,以计算机设备为手机为例:The embodiment of the present application also provides a computer device. As shown in FIG. 9 , for the convenience of description, only the parts related to the embodiments of the present application are shown. If the specific technical details are not disclosed, please refer to the method part of the embodiment of the present application. The computer device may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, a wearable device, and the like, taking a computer device as a mobile phone as an example. :
图9为与本申请实施例提供的计算机设备相关的手机的部分结构的框图。参考图9,手机包括:射频(Radio Frequency,RF)电路910、存储器920、输入单元930、显示单元940、传感器950、音频电路960、无线保真(wireless fidelity,WiFi)模块970、处理器980、以及电源990等部件。本领域技术人员可以理解,图9所示的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。FIG. 9 is a block diagram showing a part of a structure of a mobile phone related to a computer device according to an embodiment of the present application. Referring to FIG. 9, the mobile phone includes: a radio frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a wireless fidelity (WiFi) module 970, and a processor 980. And power supply 990 and other components. It will be understood by those skilled in the art that the structure of the handset shown in FIG. 9 does not constitute a limitation to the handset, and may include more or less components than those illustrated, or some components may be combined, or different component arrangements.
其中,RF电路910可用于收发信息或通话过程中,信号的接收和发送,可将基站的下行信息接收后,给处理器980处理;也可以将上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路910还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(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))、电子邮件、短消息服务(Short Messaging Service,SMS)等。The RF circuit 910 can be used for receiving and transmitting signals during the transmission and reception of information or during a call. The downlink information of the base station can be received and processed by the processor 980. The uplink data can also be sent to the base station. Generally, RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, RF circuitry 910 can also communicate with the network and other devices via wireless communication. The above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Messaging Service (SMS), and the like.
存储器920可用于存储软件程序以及模块,处理器980通过运行存储在存储器920的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器920可主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据手机的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器920可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 920 can be used to store software programs and modules, and the processor 980 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 920. The memory 920 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as an application of a sound playing function, an application of an image playing function, etc.); The data storage area can store data (such as audio data, address book, etc.) created according to the use of the mobile phone. Moreover, memory 920 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
输入单元930可用于接收输入的数字或字符信息,以及产生与手机900的用户设置以及功能控制有关的键信号输入。具体地,输入单元930可包括触控面板931以及其他输入设备932。触控面板931,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板931上或在触控面板931附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板931可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器980,并能接收处理器980发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板931。除了触控面板931,输入单元930还可以包括其他输入设备932。具体地,其他输入设备932可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。The input unit 930 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the handset 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, can collect touch operations on or near the user (such as the user using a finger, a stylus, or the like on the touch panel 931 or near the touch panel 931. Operation) and drive the corresponding connection device according to a preset program. In one embodiment, the touch panel 931 can include two portions of a touch detection device and a touch controller. Wherein, the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information. The processor 980 is provided and can receive commands from the processor 980 and execute them. In addition, the touch panel 931 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 931, the input unit 930 may also include other input devices 932. Specifically, other input devices 932 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.).
显示单元940可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元940可包括显示面板941。在一个实施例中,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板941。在一个实施例中,触控面板931可覆盖显示面板941,当触控面板931检测到在其上或附近的触摸操作后,传送给处理器980以确定触摸事件的类型,随后处理器980根据触摸事件的类型在显示面板941上提供相应的视觉输出。虽然在图9中,触控面板931与显示面板941是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板931与显示面板941集成而实现手机的输入和输出功能。The display unit 940 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone. The display unit 940 can include a display panel 941. In one embodiment, the display panel 941 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. In one embodiment, the touch panel 931 can cover the display panel 941. When the touch panel 931 detects a touch operation on or near it, the touch panel 931 transmits to the processor 980 to determine the type of the touch event, and then the processor 980 is The type of touch event provides a corresponding visual output on display panel 941. Although the touch panel 931 and the display panel 941 are used as two independent components to implement the input and input functions of the mobile phone in FIG. 9, in some embodiments, the touch panel 931 and the display panel 941 may be integrated. Realize the input and output functions of the phone.
手机900还可包括至少一种传感器950,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板941的亮度,接近传感器可在手机移动到耳边时,关闭显示面板 941和/或背光。运动传感器可包括加速度传感器,通过加速度传感器可检测各个方向上加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外,手机还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。The handset 900 can also include at least one type of sensor 950, such as a light sensor, 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 brightness of the display panel 941 according to the brightness of the ambient light, and the proximity sensor may close the display panel 941 and/or when the mobile phone moves to the ear. Or backlight. The motion sensor may include an acceleration sensor, and the acceleration sensor can detect the magnitude of the acceleration in each direction, and the magnitude and direction of the gravity can be detected at rest, and can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching), and vibration recognition related functions (such as Pedometer, tapping, etc.; in addition, the phone can also be equipped with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors.
音频电路960、扬声器961和传声器962可提供用户与手机之间的音频接口。音频电路960可将接收到的音频数据转换后的电信号,传输到扬声器961,由扬声器961转换为声音信号输出;另一方面,传声器962将收集的声音信号转换为电信号,由音频电路960接收后转换为音频数据,再将音频数据输出处理器980处理后,经RF电路910可以发送给另一手机,或者将音频数据输出至存储器920以便后续处理。 Audio circuitry 960, speaker 961, and microphone 962 can provide an audio interface between the user and the handset. The audio circuit 960 can transmit the converted electrical data of the received audio data to the speaker 961, and convert it into a sound signal output by the speaker 961. On the other hand, the microphone 962 converts the collected sound signal into an electrical signal, and the audio circuit 960 After receiving, it is converted into audio data, and after being processed by the audio data output processor 980, it can be sent to another mobile phone via the RF circuit 910, or the audio data can be output to the memory 920 for subsequent processing.
WiFi属于短距离无线传输技术,手机通过WiFi模块970可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图9示出了WiFi模块970,但是可以理解的是,其并不属于手机900的必须构成,可以根据需要而省略。WiFi is a short-range wireless transmission technology, and the mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 970, which provides users with wireless broadband Internet access. Although FIG. 9 shows the WiFi module 970, it can be understood that it does not belong to the essential configuration of the mobile phone 900 and can be omitted as needed.
处理器980是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器920内的软件程序和/或模块,以及调用存储在存储器920内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。在一个实施例中,处理器980可包括一个或多个处理单元。在一个实施例中,处理器980可集成应用处理器和调制解调器,其中,应用处理器主要处理操作系统、用户界面和应用程序等;调制解调器主要处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器980中。比如,该处理器980可集成应用处理器和基带处理器,基带处理器与和其它外围芯片等可组成调制解调器。手机900还包括给各个部件供电的电源990(比如电池),优选的,电源可以通过电源管理系统与处理器980逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The processor 980 is the control center of the handset, which connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 920, and invoking data stored in the memory 920, executing The phone's various functions and processing data, so that the overall monitoring of the phone. In one embodiment, processor 980 can include one or more processing units. In one embodiment, processor 980 can integrate an application processor and a modem, where the application processor primarily processes an operating system, user interface, applications, etc.; the modem primarily processes wireless communications. It will be appreciated that the above described modems may also not be integrated into the processor 980. For example, the processor 980 can integrate an application processor and a baseband processor, and the baseband processor and other peripheral chips can form a modem. The mobile phone 900 also includes a power source 990 (such as a battery) that supplies power to various components. Preferably, the power source can be logically coupled to the processor 980 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
在一个实施例中,手机900还可以包括摄像头、蓝牙模块等。In one embodiment, the handset 900 can also include a camera, a Bluetooth module, and the like.
在本申请实施例中,该手机所包括的处理器执行存储在存储器上的计算机程序时实现上述所描述的应用处理方法。In the embodiment of the present application, the processor included in the mobile phone implements the application processing method described above when executing a computer program stored in the memory.
本申请所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。合适的非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM),它用作外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDR SDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)。Any reference to a memory, storage, database or other medium used herein may include non-volatile and/or volatile memory. Suitable non-volatile memories can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM), which acts as an external cache. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronization. Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).
以上实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above embodiments are merely illustrative of several embodiments of the present application, and the description thereof is more specific and detailed, but is not to be construed as limiting the scope of the claims. It should be noted that a number of variations and modifications may be made by those skilled in the art without departing from the spirit and scope of the present application. Therefore, the scope of the invention should be determined by the appended claims.

Claims (30)

  1. 一种应用处理方法,包括:An application processing method includes:
    获取待处理应用所占用的内存页;Get the memory page occupied by the pending application;
    将所述内存页中存储的数据迁移至用于临时回收所述数据的临时存储空间中;Migrating data stored in the memory page to a temporary storage space for temporarily retrieving the data;
    在预设的加载界面中运行所述待处理应用;及Running the to-be-processed application in a preset loading interface; and
    将运行所述待处理应用的过程中在所述临时存储空间中使用到的数据重新读回至内存页中,将未使用到的数据进行回收。The data used in the temporary storage space in the process of running the to-be-processed application is read back into the memory page, and the unused data is recycled.
  2. 根据权利要求1所述的方法,其特征在于,所述获取待处理应用所占用的内存页,包括:The method according to claim 1, wherein the obtaining a memory page occupied by the application to be processed comprises:
    遍历待处理应用的内存映射文件;Traversing the memory mapped file of the pending application;
    通过所述内存映射文件查询所述待处理应用占用的所有内存页;Querying, by the memory mapping file, all memory pages occupied by the to-be-processed application;
    从所述所有内存页中剔除携带占用标记的内存页;及Removing the memory page carrying the occupied mark from all the memory pages; and
    从剔除后的内存页中获取可回收内存页。Get reclaimable memory pages from the stripped memory page.
  3. 根据权利要求1所述的方法,其特征在于,在所述将所述内存页中存储的数据迁移至用于临时回收所述数据的临时存储空间中之前,还包括:The method according to claim 1, wherein before the migrating the data stored in the memory page to the temporary storage space for temporarily recovering the data, the method further comprises:
    获取所述待处理应用对每个所述内存页的空闲时长;Obtaining an idle duration of the to-be-processed application for each of the memory pages;
    根据所述每个所述内存页的空闲时长确定时长阈值;及Determining a duration threshold according to an idle duration of each of the memory pages; and
    所述将所述内存页中存储的数据迁移至用于临时回收所述数据的临时存储空间中,包括:The migrating the data stored in the memory page to a temporary storage space for temporarily recovering the data includes:
    将空闲时长超过所述时长阈值的内存页中存储的数据迁移至临时存储空间中。The data stored in the memory page whose idle time exceeds the duration threshold is migrated to the temporary storage space.
  4. 根据权利要求3所述的方法,其特征在于,所述获取所述待处理应用对每个所述内存页的空闲时长,包括:The method according to claim 3, wherein the obtaining the idle duration of the to-be-processed application for each of the memory pages comprises:
    获取每个内存页的时间戳记录的更新时间,根据所述更新时间计算出对应内存页的空闲时长;或Obtaining an update time of the timestamp record of each memory page, and calculating an idle duration of the corresponding memory page according to the update time; or
    获取通过最近最久未使用LRU管理单元记录的每个内存页的更新时间,根据所述更新时间计算出对应内存页的空闲时长。The update time of each memory page recorded by the most recently unused LRU management unit is obtained, and the idle time of the corresponding memory page is calculated according to the update time.
  5. 根据权利要求3所述的方法,其特征在于,所述根据所述每个所述内存页的空闲时长确定时长阈值,包括:The method according to claim 3, wherein the determining the duration threshold according to the idle duration of each of the memory pages comprises:
    根据所述每个所述内存页的空闲时长计算出所述待处理应用对内存页的平均空闲时长,将所述平均空闲时长作为时长阈值。Calculating, according to the idle duration of each of the memory pages, an average idle duration of the to-be-processed application to the memory page, and using the average idle duration as a duration threshold.
  6. 根据权利要求1所述的方法,其特征在于,所述临时存储空间包括页缓存中的存储空间;所述加载界面为不接收焦点的、屏幕不可见的界面;所述加载界面的尺寸与系统显示界面的尺寸相同。The method according to claim 1, wherein the temporary storage space comprises a storage space in a page cache; the loading interface is an interface that does not receive a focus and is invisible to the screen; and the size and system of the loading interface The display interface is the same size.
  7. 根据权利要求1至6中任一项所述的方法,其特征在于,在所述获取待处理应用所占用的内存页之前,还包括:The method according to any one of claims 1 to 6, wherein before the obtaining the memory page occupied by the application to be processed, the method further comprises:
    检测待处理应用是否被前台应用依赖;Detect whether the pending application is dependent on the foreground application;
    当所述待处理应用被前台应用依赖时,将所述待处理应用的优先级调整至与前台应用相匹配;及When the to-be-processed application is dependent on the foreground application, adjusting the priority of the to-be-processed application to match the foreground application; and
    当所述待处理应用未被前台应用依赖时,执行所述获取待处理应用所占用的内存页。When the to-be-processed application is not dependent on the foreground application, the obtaining a memory page occupied by the to-be-processed application is performed.
  8. 根据权利要求7所述的方法,其特征在于,所述检测待处理应用是否被前台应用依赖,包括:The method according to claim 7, wherein the detecting whether the application to be processed is dependent on the foreground application comprises:
    检测所述待处理应用与所述前台应用之间是否存在通信机制和同步机制中的至少一种;及Detecting whether at least one of a communication mechanism and a synchronization mechanism exists between the to-be-processed application and the foreground application; and
    当所述待处理应用与所述前台应用之间存在通信机制和同步机制中的至少一种时,所 述待处理应用被所述前台应用依赖。The to-be-processed application is dependent on the foreground application when there is at least one of a communication mechanism and a synchronization mechanism between the to-be-processed application and the foreground application.
  9. 根据权利要求8所述的方法,其特征在于,当所述待处理应用与所述前台应用之间存在socket通信、binder通信、内存共享或锁等待时,所述待处理应用与所述前台应用之间存在通信机制。The method according to claim 8, wherein when the socket application, the binder communication, the memory sharing or the lock wait exists between the to-be-processed application and the foreground application, the to-be-processed application and the foreground application There is a communication mechanism between them.
  10. 根据权利要求7所述的方法,其特征在于,所述当所述待处理应用被前台应用依赖时,将所述待处理应用的优先级调整至与前台应用相匹配,包括:The method according to claim 7, wherein when the to-be-processed application is dependent on the foreground application, the priority of the to-be-processed application is adjusted to match the foreground application, including:
    获取被前台应用依赖的待处理应用的优先级与前台优先级的匹配关系;及Obtaining a matching relationship between the priority of the pending application and the foreground priority that are depended by the foreground application; and
    根据所述匹配关系将被前台应用依赖的待处理应用的优先级调整为对应的前台优先级。Adjusting, according to the matching relationship, the priority of the to-be-processed application that is to be processed by the foreground application to the corresponding foreground priority.
  11. 一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器执行以下操作:An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein when the computer program is executed by the processor, the processor performs the following operations:
    获取待处理应用所占用的内存页;Get the memory page occupied by the pending application;
    将所述内存页中存储的数据迁移至用于临时回收所述数据的临时存储空间中;Migrating data stored in the memory page to a temporary storage space for temporarily retrieving the data;
    在预设的加载界面中运行所述待处理应用;及Running the to-be-processed application in a preset loading interface; and
    将运行所述待处理应用的过程中在所述临时存储空间中使用到的数据重新读回至内存页中,将未使用到的数据进行回收。The data used in the temporary storage space in the process of running the to-be-processed application is read back into the memory page, and the unused data is recycled.
  12. 根据权利要求11所述的电子设备,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述获取待处理应用所占用的内存页时,还执行以下操作:The electronic device according to claim 11, wherein when the computer program is executed by the processor, the processor further performs the following operations when executing the memory page occupied by the application to be processed. :
    遍历待处理应用的内存映射文件;Traversing the memory mapped file of the pending application;
    通过所述内存映射文件查询所述待处理应用占用的所有内存页;Querying, by the memory mapping file, all memory pages occupied by the to-be-processed application;
    从所述所有内存页中剔除携带占用标记的内存页;及Removing the memory page carrying the occupied mark from all the memory pages; and
    从剔除后的内存页中获取可回收内存页。Get reclaimable memory pages from the stripped memory page.
  13. 根据权利要求11所述的电子设备,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述将所述内存页中存储的数据迁移至用于临时回收所述数据的临时存储空间中之前,还执行以下操作:The electronic device according to claim 11, wherein said computer program is executed by said processor to cause said processor to migrate said data stored in said memory page to be used for temporary recovery Before the temporary storage space of the data, the following operations are also performed:
    获取所述待处理应用对每个所述内存页的空闲时长;Obtaining an idle duration of the to-be-processed application for each of the memory pages;
    根据所述每个所述内存页的空闲时长确定时长阈值;及Determining a duration threshold according to an idle duration of each of the memory pages; and
    将空闲时长超过所述时长阈值的内存页中存储的数据迁移至临时存储空间中。The data stored in the memory page whose idle time exceeds the duration threshold is migrated to the temporary storage space.
  14. 根据权利要求13所述的电子设备,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述获取所述待处理应用对每个所述内存页的空闲时长时,还执行以下操作:The electronic device according to claim 13, wherein said computer program is executed by said processor to cause said processor to perform said acquisition of said pending application for each of said memory pages When the duration is long, the following operations are also performed:
    获取每个内存页的时间戳记录的更新时间,根据所述更新时间计算出对应内存页的空闲时长;或Obtaining an update time of the timestamp record of each memory page, and calculating an idle duration of the corresponding memory page according to the update time; or
    获取通过最近最久未使用LRU管理单元记录的每个内存页的更新时间,根据所述更新时间计算出对应内存页的空闲时长。The update time of each memory page recorded by the most recently unused LRU management unit is obtained, and the idle time of the corresponding memory page is calculated according to the update time.
  15. 根据权利要求13所述的电子设备,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述根据所述每个所述内存页的空闲时长确定时长阈值时,还执行以下操作:The electronic device according to claim 13, wherein said computer program is executed by said processor to cause said processor to determine a duration threshold according to said idle duration of said each of said memory pages When you do the following,
    根据所述每个所述内存页的空闲时长计算出所述待处理应用对内存页的平均空闲时长,将所述平均空闲时长作为时长阈值。Calculating, according to the idle duration of each of the memory pages, an average idle duration of the to-be-processed application to the memory page, and using the average idle duration as a duration threshold.
  16. 根据权利要求11所述的电子设备,其特征在于,所述临时存储空间包括页缓存中的存储空间;所述加载界面为不接收焦点的、屏幕不可见的界面;所述加载界面的尺寸与系统显示界面的尺寸相同。The electronic device according to claim 11, wherein the temporary storage space comprises a storage space in a page cache; the loading interface is an interface that does not receive a focus and is invisible to the screen; and the size of the loading interface is The system display interface has the same size.
  17. 根据权利要求11至16中任一项所述的电子设备,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述获取待处理应用所占用的内存页之前, 还执行以下操作:The electronic device according to any one of claims 11 to 16, wherein the computer program is executed by the processor, causing the processor to execute the memory page occupied by the acquiring application to be processed Previously, the following actions were also performed:
    检测待处理应用是否被前台应用依赖;Detect whether the pending application is dependent on the foreground application;
    当所述待处理应用被前台应用依赖时,将所述待处理应用的优先级调整至与前台应用相匹配;及When the to-be-processed application is dependent on the foreground application, adjusting the priority of the to-be-processed application to match the foreground application; and
    当所述待处理应用未被前台应用依赖时,执行所述获取待处理应用所占用的内存页。When the to-be-processed application is not dependent on the foreground application, the obtaining a memory page occupied by the to-be-processed application is performed.
  18. 根据权利要求17所述的电子设备,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述检测待处理应用是否被前台应用依赖时,还执行以下操作:The electronic device according to claim 17, wherein when said computer program is executed by said processor, said processor further performs the following operations when said detecting whether said application to be processed is dependent by a foreground application :
    检测所述待处理应用与所述前台应用之间是否存在通信机制和同步机制中的至少一种;及Detecting whether at least one of a communication mechanism and a synchronization mechanism exists between the to-be-processed application and the foreground application; and
    当所述待处理应用与所述前台应用之间存在通信机制和同步机制中的至少一种时,所述待处理应用被所述前台应用依赖。The to-be-processed application is dependent on the foreground application when there is at least one of a communication mechanism and a synchronization mechanism between the to-be-processed application and the foreground application.
  19. 根据权利要求18所述的电子设备,其特征在于,当所述待处理应用与所述前台应用之间存在socket通信、binder通信、内存共享或锁等待时,所述待处理应用与所述前台应用之间存在通信机制。The electronic device according to claim 18, wherein when there is socket communication, binder communication, memory sharing or lock waiting between the to-be-processed application and the foreground application, the to-be-processed application and the foreground There is a communication mechanism between applications.
  20. 根据权利要求17所述的电子设备,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述当所述待处理应用被前台应用依赖时,将所述待处理应用的优先级调整至与前台应用相匹配时,还执行以下操作:The electronic device according to claim 17, wherein said computer program is executed by said processor to cause said processor to perform said said when said pending application is dependent by a foreground application When the priority of the pending application is adjusted to match the foreground application, the following actions are also performed:
    获取被前台应用依赖的待处理应用的优先级与前台优先级的匹配关系;及Obtaining a matching relationship between the priority of the pending application and the foreground priority that are depended by the foreground application; and
    根据所述匹配关系将被前台应用依赖的待处理应用的优先级调整为对应的前台优先级。Adjusting, according to the matching relationship, the priority of the to-be-processed application that is to be processed by the foreground application to the corresponding foreground priority.
  21. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时,使得所述处理器执行以下操作:A computer readable storage medium having stored thereon a computer program, wherein when the computer program is executed by a processor, the processor causes the processor to:
    获取待处理应用所占用的内存页;Get the memory page occupied by the pending application;
    将所述内存页中存储的数据迁移至用于临时回收所述数据的临时存储空间中;Migrating data stored in the memory page to a temporary storage space for temporarily retrieving the data;
    在预设的加载界面中运行所述待处理应用;及Running the to-be-processed application in a preset loading interface; and
    将运行所述待处理应用的过程中在所述临时存储空间中使用到的数据重新读回至内存页中,将未使用到的数据进行回收。The data used in the temporary storage space in the process of running the to-be-processed application is read back into the memory page, and the unused data is recycled.
  22. 根据权利要求21所述的计算机可读存储介质,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述获取待处理应用所占用的内存页时,还执行以下操作:The computer readable storage medium according to claim 21, wherein when said computer program is executed by said processor, said processor further causes said processor to perform a memory page occupied by said application to be processed Do the following:
    遍历待处理应用的内存映射文件;Traversing the memory mapped file of the pending application;
    通过所述内存映射文件查询所述待处理应用占用的所有内存页;Querying, by the memory mapping file, all memory pages occupied by the to-be-processed application;
    从所述所有内存页中剔除携带占用标记的内存页;及Removing the memory page carrying the occupied mark from all the memory pages; and
    从剔除后的内存页中获取可回收内存页。Get reclaimable memory pages from the stripped memory page.
  23. 根据权利要求21所述的计算机可读存储介质,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述将所述内存页中存储的数据迁移至用于临时回收所述数据的临时存储空间中之前,还执行以下操作:A computer readable storage medium according to claim 21, wherein said computer program, when executed by said processor, causes said processor to perform said transfer of data stored in said memory page to Before you temporarily reclaim the temporary storage space for the data, you also do the following:
    获取所述待处理应用对每个所述内存页的空闲时长;Obtaining an idle duration of the to-be-processed application for each of the memory pages;
    根据所述每个所述内存页的空闲时长确定时长阈值;及Determining a duration threshold according to an idle duration of each of the memory pages; and
    将空闲时长超过所述时长阈值的内存页中存储的数据迁移至临时存储空间中。The data stored in the memory page whose idle time exceeds the duration threshold is migrated to the temporary storage space.
  24. 根据权利要求23所述的计算机可读存储介质,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述获取所述待处理应用对每个所述内存页的空闲时长时,还执行以下操作:A computer readable storage medium according to claim 23, wherein said computer program is executed by said processor such that said processor is performing said obtaining said pending application for each said memory When the page is idle, you also do the following:
    获取每个内存页的时间戳记录的更新时间,根据所述更新时间计算出对应内存页的空 闲时长;或Obtaining an update time of the timestamp record of each memory page, and calculating a free time of the corresponding memory page according to the update time; or
    获取通过最近最久未使用LRU管理单元记录的每个内存页的更新时间,根据所述更新时间计算出对应内存页的空闲时长。The update time of each memory page recorded by the most recently unused LRU management unit is obtained, and the idle time of the corresponding memory page is calculated according to the update time.
  25. 根据权利要求23所述的计算机可读存储介质,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述根据所述每个所述内存页的空闲时长确定时长阈值时,还执行以下操作:A computer readable storage medium according to claim 23, wherein said computer program is executed by said processor such that said processor is performing said idle time according to said each of said memory pages When determining the duration threshold, you also do the following:
    根据所述每个所述内存页的空闲时长计算出所述待处理应用对内存页的平均空闲时长,将所述平均空闲时长作为时长阈值。Calculating, according to the idle duration of each of the memory pages, an average idle duration of the to-be-processed application to the memory page, and using the average idle duration as a duration threshold.
  26. 根据权利要求21所述的计算机可读存储介质,其特征在于,所述临时存储空间包括页缓存中的存储空间;所述加载界面为不接收焦点的、屏幕不可见的界面;所述加载界面的尺寸与系统显示界面的尺寸相同。The computer readable storage medium according to claim 21, wherein the temporary storage space comprises a storage space in a page cache; the loading interface is an interface that does not receive a focus and is invisible to the screen; the loading interface The size is the same as the size of the system display interface.
  27. 根据权利要求21至26中任一项所述的计算机可读存储介质,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述获取待处理应用所占用的内存页之前,还执行以下操作:The computer readable storage medium according to any one of claims 21 to 26, wherein when the computer program is executed by the processor, causing the processor to occupy the application to be processed Before the memory page, you also do the following:
    检测待处理应用是否被前台应用依赖;Detect whether the pending application is dependent on the foreground application;
    当所述待处理应用被前台应用依赖时,将所述待处理应用的优先级调整至与前台应用相匹配;及When the to-be-processed application is dependent on the foreground application, adjusting the priority of the to-be-processed application to match the foreground application; and
    当所述待处理应用未被前台应用依赖时,执行所述获取待处理应用所占用的内存页。When the to-be-processed application is not dependent on the foreground application, the obtaining a memory page occupied by the to-be-processed application is performed.
  28. 根据权利要求27所述的计算机可读存储介质,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述检测待处理应用是否被前台应用依赖时,还执行以下操作:The computer readable storage medium of claim 27, wherein when the computer program is executed by the processor, causing the processor to perform the detecting whether the application to be processed is dependent on the foreground application, Do the following:
    检测所述待处理应用与所述前台应用之间是否存在通信机制和同步机制中的至少一种;及Detecting whether at least one of a communication mechanism and a synchronization mechanism exists between the to-be-processed application and the foreground application; and
    当所述待处理应用与所述前台应用之间存在通信机制和同步机制中的至少一种时,所述待处理应用被所述前台应用依赖。The to-be-processed application is dependent on the foreground application when there is at least one of a communication mechanism and a synchronization mechanism between the to-be-processed application and the foreground application.
  29. 根据权利要求28所述的计算机可读存储介质,其特征在于,当所述待处理应用与所述前台应用之间存在socket通信、binder通信、内存共享或锁等待时,所述待处理应用与所述前台应用之间存在通信机制。The computer readable storage medium according to claim 28, wherein when there is socket communication, binder communication, memory sharing or lock waiting between the to-be-processed application and the foreground application, the to-be-processed application and There is a communication mechanism between the foreground applications.
  30. 根据权利要求27所述的计算机可读存储介质,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器在执行所述当所述待处理应用被前台应用依赖时,将所述待处理应用的优先级调整至与前台应用相匹配时,还执行以下操作:A computer readable storage medium according to claim 27, wherein said computer program is executed by said processor such that said processor is executing said when said pending application is dependent by a foreground application When the priority of the pending application is adjusted to match the foreground application, the following operations are also performed:
    获取被前台应用依赖的待处理应用的优先级与前台优先级的匹配关系;及Obtaining a matching relationship between the priority of the pending application and the foreground priority that are depended by the foreground application; and
    根据所述匹配关系将被前台应用依赖的待处理应用的优先级调整为对应的前台优先级。Adjusting, according to the matching relationship, the priority of the to-be-processed application that is to be processed by the foreground application to the corresponding foreground priority.
PCT/CN2018/116507 2017-12-29 2018-11-20 Application processing method, electronic device, computer readable storage medium WO2019128542A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711484431.X 2017-12-29
CN201711484431.XA CN109992522A (en) 2017-12-29 2017-12-29 Application processing method and device, electronic equipment, computer readable storage medium

Publications (1)

Publication Number Publication Date
WO2019128542A1 true WO2019128542A1 (en) 2019-07-04

Family

ID=67065077

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/116507 WO2019128542A1 (en) 2017-12-29 2018-11-20 Application processing method, electronic device, computer readable storage medium

Country Status (2)

Country Link
CN (1) CN109992522A (en)
WO (1) WO2019128542A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111258965B (en) * 2020-01-10 2024-03-08 北京聚云立方科技有限公司 Data acquisition method and device, electronic equipment and storage medium
CN114942800A (en) * 2021-02-09 2022-08-26 荣耀终端有限公司 Method and device for accelerating running of application program
CN114168225B (en) * 2021-12-08 2024-05-14 深圳忆联信息系统有限公司 Method, device, computer equipment and storage medium for updating solid state disk mapping table in delayed mode
CN114861209A (en) * 2022-05-24 2022-08-05 Oppo广东移动通信有限公司 Method and device for acquiring occupation information of memory space and terminal

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101231619A (en) * 2008-02-22 2008-07-30 浙江大学 Method for managing dynamic internal memory base on discontinuous page
US20090259806A1 (en) * 2008-04-15 2009-10-15 Adtron, Inc. Flash management using bad page tracking and high defect flash memory
CN102831073A (en) * 2012-08-17 2012-12-19 广东威创视讯科技股份有限公司 Internal memory data processing method and system
CN106484472A (en) * 2016-09-29 2017-03-08 华为技术有限公司 A kind of method for recovering internal storage and terminal
CN107066335A (en) * 2017-03-23 2017-08-18 华南师范大学 A kind of optimization method of cloud platform internal memory and optimization system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101231619A (en) * 2008-02-22 2008-07-30 浙江大学 Method for managing dynamic internal memory base on discontinuous page
US20090259806A1 (en) * 2008-04-15 2009-10-15 Adtron, Inc. Flash management using bad page tracking and high defect flash memory
CN102831073A (en) * 2012-08-17 2012-12-19 广东威创视讯科技股份有限公司 Internal memory data processing method and system
CN106484472A (en) * 2016-09-29 2017-03-08 华为技术有限公司 A kind of method for recovering internal storage and terminal
CN107066335A (en) * 2017-03-23 2017-08-18 华南师范大学 A kind of optimization method of cloud platform internal memory and optimization system

Also Published As

Publication number Publication date
CN109992522A (en) 2019-07-09

Similar Documents

Publication Publication Date Title
US11099900B2 (en) Memory reclamation method and apparatus
EP3506106B1 (en) Method for processing application, electronic device, and computer-readable storage medium
WO2022089452A1 (en) Memory management method and apparatus, and electronic device and computer-readable storage medium
EP3506105B1 (en) Method and device for processing a memory and storage medium
WO2019137252A1 (en) Memory processing method, electronic device, and computer-readable storage medium
EP3506114B1 (en) Memory processing method and device and storage medium
WO2019128542A1 (en) Application processing method, electronic device, computer readable storage medium
WO2019137258A1 (en) Memory processing method, electronic device and computer readable storage medium
WO2019128540A1 (en) Resource management method, mobile terminal and computer readable storage medium
EP3937016A1 (en) Memory management method and apparatus
WO2018045934A1 (en) Application process management method and terminal device
WO2019128588A1 (en) Process processing method and apparatus, electronic device, computer readable storage medium
WO2019128537A1 (en) Application freezing method, and computer device and computer-readable storage medium
US11704240B2 (en) Garbage data scrubbing method, and device
WO2019137173A1 (en) Resource management method, mobile terminal and computer-readable storage medium
WO2019128574A1 (en) Information processing method and device, computer device and computer readable storage medium
WO2019128571A1 (en) Resource management method and device, mobile terminal, as well as computer readable storage medium
WO2019128573A1 (en) Information processing method, apparatus, computer device and computer-readable storage medium
CN112445766A (en) Terminal fragment sorting method and device and terminal
WO2019128569A1 (en) Method and apparatus for freezing application, and storage medium and terminal
CN110007968B (en) Information processing method, information processing device, computer equipment and computer readable storage medium
WO2019128545A1 (en) Process handling method, and electronic device and computer-readable storage medium

Legal Events

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

Ref document number: 18893464

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: 18893464

Country of ref document: EP

Kind code of ref document: A1