Nothing Special   »   [go: up one dir, main page]

WO2019128571A1 - 资源管理方法、装置、移动终端及计算机可读存储介质 - Google Patents

资源管理方法、装置、移动终端及计算机可读存储介质 Download PDF

Info

Publication number
WO2019128571A1
WO2019128571A1 PCT/CN2018/116944 CN2018116944W WO2019128571A1 WO 2019128571 A1 WO2019128571 A1 WO 2019128571A1 CN 2018116944 W CN2018116944 W CN 2018116944W WO 2019128571 A1 WO2019128571 A1 WO 2019128571A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
background
resource
foreground
restriction level
Prior art date
Application number
PCT/CN2018/116944
Other languages
English (en)
French (fr)
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 WO2019128571A1 publication Critical patent/WO2019128571A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/504Resource capping
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a resource management method, apparatus, mobile terminal, and computer readable storage medium.
  • the embodiment of the present application provides a resource management method, device, mobile terminal, and computer readable storage medium.
  • a resource management method including:
  • Resource management is performed on the background application according to the resource restriction level.
  • a resource management device comprising:
  • a scenario determining module configured to acquire a running feature of the background application, and determine an application scenario type of the background application according to the running feature, where the application scenario type includes a perceptible application and an imperceptible application;
  • a level determining module configured to determine a resource restriction level of the background application according to the application scenario type
  • a management module configured to perform resource management on the background application according to the resource restriction level.
  • a mobile terminal includes a memory and a processor in which is stored a computer program that, when executed by the processor, causes the processor to implement the method as described above.
  • a computer readable storage medium having stored thereon a computer program that, when executed by a processor, implements the method as described above.
  • the resource management method, the device, the mobile terminal, and the computer readable storage medium acquire the running characteristics of the background application, determine the application scenario type of the background application according to the running feature, and determine the resource restriction level of the background application according to the application scenario type, according to the resource limitation.
  • the level manages the resources of the background application, and can dynamically implement different levels of resource restrictions on the background application according to the application scenario type of the background application, optimize system performance, and save power consumption.
  • FIG. 1 is a block diagram of a mobile terminal in one embodiment.
  • FIG. 2 is a system architecture diagram of a resource management method in an embodiment.
  • FIG. 3 is a schematic flow chart of a resource management method in an embodiment.
  • 4 is a schematic diagram of different resource restriction levels in one embodiment.
  • FIG. 5 is a schematic flowchart of unified resource management for a process running in a background application in an embodiment
  • FIG. 6 is a schematic flowchart of reducing the resource restriction level of a background process having a dependency relationship with a foreground process in one embodiment.
  • Figure 7 is a block diagram of a resource management device in one embodiment.
  • FIG. 8 is a block diagram of a management module in one embodiment.
  • Figure 9 is a block diagram of a resource management apparatus in another embodiment.
  • Figure 10 is a block diagram of a mobile terminal in another embodiment.
  • first may be referred to as a second client
  • second client may be referred to as a first client, without departing from the scope of the present application.
  • Both the first client and the second client are clients, but they are not the same client.
  • the mobile terminal includes a processor, a memory, a display screen, and an input device connected through a system bus.
  • the memory may include a non-volatile storage medium and a processor.
  • the non-volatile storage medium of the mobile terminal stores an operating system and a computer program, which are executed by the processor to implement a resource management method provided in the embodiments of the present application.
  • the processor is used to provide computing and control capabilities to support the operation of the entire mobile terminal.
  • the internal memory in the mobile terminal provides an environment for the operation of a computer program in a non-volatile storage medium.
  • the display screen of the mobile terminal may be a liquid crystal display or an electronic ink display screen.
  • the input device may be a touch layer covered on the display screen, or may be a button, a trackball or a touchpad provided on the casing of the mobile terminal, or may be An external keyboard, trackpad, or mouse.
  • the mobile terminal can be a mobile phone, a tablet or a personal digital assistant or a wearable device.
  • 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 of the mobile terminal to which the solution of the present application is applied.
  • the specific mobile terminal may It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements.
  • the system architecture includes a JAVA spatial layer 210, a local framework layer 220, and a kernel space layer 230.
  • the JAVA spatial layer 210 can include a freeze management module 212.
  • the freeze management module 212 can implement a freeze policy for each running application, and freeze the related applications that consume more power in the background or preempt a large amount of system resources.
  • the resource priority and restriction management module 222 and the platform freeze management module 224 are included in the local framework layer 220.
  • the mobile terminal can maintain different applications in different resource usage priorities and different resource groups in real time through the resource priority and restriction management module 222, and adjust the resource group of the application according to the requirements of the upper layer to achieve optimized performance.
  • the mobile terminal can allocate the application that can be frozen in the background to the frozen layer corresponding to the preset different levels according to the length of the entry freeze time through the platform freeze management module 224.
  • the frozen layer may include three: a CPU limited sleep mode, a CPU freeze sleep mode, and a 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 local framework layer 220 may further include an interface module, where the interface module includes a binder interface developed to the upper layer, and the upper layer framework or the application sends the resource restriction or the frozen instruction to the resource priority and the limit management through the provided binder interface.
  • Module 222 and platform freeze management module 224 are also limited to 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 local framework layer 220 may further include an interface module, where the interface module includes a binder interface developed to the upper layer, and the upper layer framework or the application sends the resource restriction or the frozen instruction to the resource priority and the limit management through the provided binder interface.
  • the kernel space layer 230 may include a UID management module 231, a Cgroup module 233, a Binder management module 235, a process memory recovery module 237, and a freeze timeout exit module 239.
  • 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 233 is used to provide a complete set of CPU, CPUSET, memory, input/output (I/O) and Net related resource restriction mechanisms.
  • the Binder management module 235 is used to implement the priority control of the background binder communication.
  • the process memory recovery module 237 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 freeze timeout exit module 239 can be used to resolve an exception generated by the freeze timeout scenario.
  • a resource management method including the following operations:
  • the running feature of the background application is obtained, and the application scenario type of the background application is determined according to the running feature.
  • the mobile terminal can run one or more applications at the same time, and can include a foreground application running in the foreground and a background application running in the background.
  • the mobile terminal can obtain the running characteristics of the background application, and determine the application scenario type of each background application according to the running characteristics.
  • the application scenario type may include a perceptible application and an imperceptible application.
  • a perceptible application refers to an application that can be heard, seen, and the like that can be perceived by a user, such as a music application that is playing music, an application that is downloading a file, and the like, but is not limited thereto, although the application has entered Running in the background, but still being perceived by the user that the app is running.
  • An imperceptible application refers to an application that is not perceptible to the user, such as a social application running in the background, a payment application, etc., but is not limited thereto.
  • the non-aware application may include an imperceptible application that receives the process communication and an unperceivable application that has no process communication, wherein the non-aware application that receives the process communication refers to the process running under the application and other processes exist communication, etc.
  • An imperceptible application of interaction, an imperceptible application of no process communication refers to an imperceptible application in which a process running under an application does not communicate with other processes.
  • the mobile terminal can obtain the running features of each background application that is currently running in the background.
  • the running features can include, but are not limited to, the currently executed task, the communication event of each process under the application, the resource type and proportion currently occupied by the application, and the like.
  • the mobile terminal can determine the application scenario type of the background application according to the running feature of the background application, and the different application scenario types can preset the corresponding scenario conditions according to the actual requirements, and determine the application scenario type according to the scenario conditions that the running feature meets.
  • the application scenario type is a scenario condition corresponding to the perceptible application, which may include the currently executed task being a play task or a download task, and the application scenario type is an insensitive application that receives the process communication, and the application may include the process existing in the preset time period. Communication events, etc., but are not limited to this.
  • the application scenario type of the background application may change according to the running feature.
  • the application scenario type of the music application may be a perceptible application, and when the music application stops playing, When music is played, the type of application scene of the music application can be changed to an imperceptible application.
  • the mobile terminal may acquire running characteristics of each background application at intervals, and determine an application scenario type of each background application according to the running characteristics. The mobile terminal can also monitor the tasks performed by the various background applications. When it is detected that the background application starts executing the task or the task is completed, the running characteristics of the background application are obtained, and then the application scenario type of the background application is determined according to the running characteristics.
  • Operation 320 determining a resource restriction level of the background application according to the application scenario type.
  • the mobile terminal can set different resource restriction levels according to actual needs.
  • the resource restriction level can be used to indicate the extent to which the application usage resource is restricted. The higher the resource restriction level, the greater the degree of restriction.
  • Restricted resources may include, but are not limited to, CPU resources, memory resources, I/O resources, network resources, and the like.
  • the application scenarios of the background application are different, and may respectively correspond to different resource restriction levels.
  • the resource restriction level corresponding to the background application of the application-aware application type may be lower than the non-sensible application, and the application scenario type is the receiving process communication.
  • the background application of the non-perceived application may have a resource restriction level lower than that of the non-process communication.
  • the resource restriction level set by the mobile terminal may include an unrestricted level, a normal restriction level, a depth restriction level, and a freeze level.
  • An unrestricted level can mean that the resources used by the application are not restricted, and the applications running in the foreground can correspond to an unrestricted level, thereby ensuring the normal operation of the foreground application.
  • the normal restriction level may refer to an application that can use less resources, such as an application that can only use up to 50% of resources, etc., but is not limited thereto.
  • a background application whose application type is a perceptible application can correspond to a common restriction level, and the background application can reduce the preemption of resources in the case that the perceptible task of the background application can be executed normally.
  • the depth limit level can refer to the application to use very few resources, such as the application can only use up to 20% of resources, etc., but is not limited to this.
  • the background application whose application scenario type is an unperceived application that receives the communication of the process can correspond to the depth limit level, and the used resources can meet the processing requirements of the inter-process communication task.
  • the freeze level refers to the behavior of the application that cannot use any resources and stop the application.
  • a background application whose application scenario type is an insensible application of a processless communication application can correspond to a freeze level and save power. It can be understood that the resource restriction level can also be divided in other ways, and is not limited to the above several ways.
  • Operation 330 performing resource management on the background application according to the resource restriction level.
  • the different resource restriction levels may respectively correspond to different resource usage priorities.
  • the background application may configure the resource usage priority corresponding to the resource restriction level.
  • the resource usage priority configured by the application scenario type application-aware background application may be higher than the non-sensible application, and the application scenario type is the non-perceived application configured to receive the process communication, and the resource usage priority may be higher than the non-processless application of the non-process communication. .
  • the resource used by the background application may be managed according to the configured resource usage priority.
  • the mobile terminal may re-determine the resource usage level according to the changed application scenario type.
  • FIG. 4 is a schematic diagram of different resource restriction levels in one embodiment.
  • four different resource restriction levels can be set in the mobile terminal, including an unrestricted level, a normal limit level, a depth limit level, and a freeze level.
  • Unrestricted levels do not limit resources such as CPU, memory, I/O, and networking used by applications.
  • Ordinary limit level restrictions apply to using less resources such as CPU, memory, I/O, and networking.
  • the depth limit level limits the application to use very few resources such as CPU, memory, I/O, and networking.
  • Freeze level restrictions apply to resources such as CPU, memory, I/O, and networking.
  • the mobile terminal can determine the resource restriction level according to the application scenario type of the background application, and implement different levels of resource limitation for the background application of different application scenario types.
  • the running feature of the background application is obtained, and the application scenario type of the background application is determined according to the running feature, the resource restriction level of the background application is determined according to the application scenario type, and resource management is performed on the background application according to the resource restriction level.
  • the application scenario type of the background application dynamically implements different levels of resource limits for the background application, optimizes system performance, and saves power consumption.
  • operation 330 performs resource management on the background application according to the resource restriction level, including the following operations:
  • Operation 502 Obtain user group information of the background application.
  • Process is a computer program run on a set of data on the activities of the system is the basic unit of resource allocation and scheduling, is the underlying operating system architecture. There are usually multiple processes running on a mobile terminal, and different processes can be used to perform different tasks separately.
  • An application may run one or more processes. After the mobile terminal determines the resource restriction level according to the application scenario type of the background application, the unified resource management may be performed on each process running in the background application according to the resource restriction level.
  • the mobile terminal can assign different user groups to the running application, manage the permissions of the application through the user group, and the like.
  • the mobile terminal can obtain the user group information of the background application, and obtain the processes running under the background application according to the user group information, where the user group information can include the user group identifier, etc., and the user group identifier can be represented by numbers, letters, symbols, and the like. One or more are constructed.
  • Operation 504 querying a process identifier that has a mapping relationship with the user group information.
  • the mobile terminal can query the process identifiers that are in a mapping relationship with the user group information according to the user group information of the background application, thereby obtaining each process running under the background application.
  • the kernel space layer of the mobile terminal can collect the user group information to which the process belongs in real time. When the process is created or destroyed, the kernel can allocate and release the user group information to which the process belongs, and the process can also occur during the running process. The case where the user group information is changed.
  • the kernel space layer collects user group information of each process in real time, and can establish a mapping relationship between process information such as process ID and process name and user group information.
  • the process identifier of the mapping relationship may be directly queried according to the user group information of the background application, and the process running under the background application is found by directly traversing all the running processes, and directly searching and The process ID of the user group information with mapping relationship is more convenient and faster.
  • Operation 506 adding a background process that matches the process identifier to the resource group corresponding to the resource restriction level.
  • the mobile terminal can be divided into different resource groups, and each resource group can respectively correspond to different resource restriction levels, and corresponding resource usage priorities are configured.
  • the mobile terminal queries the process identifier that has the mapping relationship with the user group information, the background process that matches the process identifier may be added to the resource group corresponding to the determined resource restriction level, so as to run on the background application according to the resource restriction level.
  • Each process carries out unified resource management.
  • the mobile terminal may divide different resource groups based on a kernel Cgroup (control group) mechanism, and set a resource usage priority of each resource group by using a file node write configuration manner, and use the processes in each resource group. The time or proportion of resources is managed.
  • Cgroup is a kind of physical resources (such as CPU, memory, I/O, etc.) that can be used to limit, record, and isolate process groups. mechanism.
  • the mobile terminal can load a Cgroup configuration file, and the configuration file can record the divided resource groups, the resource usage priorities of the resource groups, and the resource scheduling policies corresponding to the resource usage priorities.
  • the resource scheduling policy may include, but is not limited to, the time when the process uses the resource, the proportion of the occupied resource, the resource identifier used, and the like.
  • the process that can configure the resource group corresponding to the common restriction level can use 30 seconds of CPU resources in one minute.
  • the process of the resource group corresponding to the common restriction level can only use the CPU resource numbered X, but is not limited thereto.
  • the process identifier with the mapping relationship may be found according to the user group information of the background application, and the background process matching the process identifier is added to the resource group corresponding to the resource restriction level, and the resource restriction level may be Unified resource management is performed for each process running under the background application.
  • the resource group can also achieve different levels of resource limitation, optimize system performance, and save power consumption.
  • the foregoing resource management method further includes the following operations:
  • Operation 602 obtaining a foreground process running in the foreground.
  • the mobile terminal can obtain a foreground process running in the foreground.
  • the mobile terminal can obtain a list of all running processes through the activity manager's RunningAppProcessInfo class, and obtain a process running in the foreground from the process list to determine the process.
  • the running state is that the foreground running process is the foreground process.
  • Operation 604 when there is a background process having a dependency relationship with the foreground process, reducing the resource restriction level of the background process having the dependency.
  • the mobile terminal After the mobile terminal obtains the foreground process running in the foreground, it can detect whether there is a background process that has a dependency relationship with the foreground process.
  • the dependency relationship refers to a process that needs to wait for the message of another process to be executed normally, and then the two processes are executed. There is a dependency.
  • the mobile terminal may pre-record the process identifier with the dependency, obtain the process identifier of the foreground process, and obtain the process identifier that has a dependency relationship with the foreground process according to the process identifier of the foreground process.
  • the mobile terminal may detect each process running in the background according to the process identifier having a dependency relationship with the foreground process, and determine whether there is a background process having a dependency relationship with the foreground process.
  • the mobile terminal can reduce the resource restriction level of the background process that has a dependency relationship with the foreground process, and improve the resource usage priority of the background process with the dependency.
  • the mobile terminal may adjust the resource restriction level of the background process that has a dependency relationship with the foreground process to the same resource restriction level as the foreground process, and allocate the background process with the dependency to the same resource group as the foreground process. Medium, and configure the same resource usage priority as the foreground process.
  • Improve the resource usage priority of the background process that has dependencies on the processes running in the foreground which can speed up the task execution of the background process that has dependencies on the processes running in the foreground, thereby reducing the waiting time of the foreground running process and speeding up the running of the foreground process.
  • the mobile terminal may detect whether there is a background process that has interactive communication with the foreground process, and determine a background process that has interactive communication with the foreground process as a background process having a dependency relationship with the foreground process.
  • the inter-process interaction communication may include a synchronization mechanism and/or a communication mechanism, etc., wherein the synchronization mechanism may refer to two processes coordinating with each other to complete a task, and the communication mechanism refers to spreading between different processes. Or exchange information.
  • the mobile terminal may detect whether there is a background process having a communication mechanism with the foreground process, and may determine a background process having a communication mechanism with the foreground process as a background process having a dependency.
  • the communication mechanism may include a socket, a binder, a shared memory, etc., wherein two programs on the network exchange data through a two-way communication connection, and one end of the connection is called a socket; the binder is an inter-process communication mechanism, providing Remote procedure call function; shared memory is to allow two unrelated processes to access the same logical memory, shared memory is a very effective way to share and transfer data between two running processes, sharing between different processes
  • the memory is usually arranged in the same piece of physical memory.
  • the mobile terminal may detect whether there is a background process that has a socket and/or a binder communication with the process running in the foreground, and may determine, as a dependency, a background process that has a socket and/or a binder communication with the process running in the foreground. backstage process.
  • the mobile terminal can also detect whether there is a background process that performs memory sharing with the process running in the foreground, and can determine the background process that performs memory sharing with the process running in the foreground as a background process with dependencies.
  • the mobile terminal may add a detection mechanism to the binder driver, and detect whether there is a background process having a communication mechanism with the foreground process according to the detection mechanism added in the binder driver.
  • the mobile terminal may detect whether there is a background process having a synchronization mechanism with the foreground process, and may determine a background process having a synchronization mechanism with the foreground process as a background process having a dependency.
  • the synchronization mechanism may include a semaphore, a mutex, etc., wherein the semaphore data structure is a value and a pointer pointing to the next process waiting for the semaphore, and the mutex can be used to ensure the integrity of the shared data. Sex, only one process can access an object with a mutex lock at any time.
  • the mobile terminal can detect, by using a call of a futex (fast user space mutex) system, whether there is a background process that has a synchronization mechanism with the foreground process.
  • the call of the futex system can be used to implement the synchronization mechanism between processes, and the operation in the user space is a user mode and kernel mode hybrid mechanism, wherein the user state refers to a non-privileged state.
  • the mobile terminal when it detects that a foreground process has a lock wait behavior, it may determine a lock resource that the foreground process waits for.
  • the lock resource may include a thread lock, a file handle, a signal, etc., wherein the file handle refers to a sequence number retrieved by the operating system function when the data is read from the file, so that the file can be opened, and the file handle is unique to the opened file. Identification basis.
  • the mobile terminal can traverse all the processes running in the background, and detect whether there is a background process waiting for the same lock resource as the foreground process, and the background process waiting for the same lock resource as the foreground process can be determined as a background process having a dependency.
  • the mobile terminal can detect whether the background process having a dependency on the foreground process ends the dependency. For example, the mobile terminal can detect whether the background process ends the communication with the socket and/or the binder of the process running in the foreground, and if the communication ends, it can determine that the dependency is ended. The mobile terminal can also detect whether the background process waiting for the same lock resource as the process running in the foreground completes the task, and if the task is completed, it can judge the end of the dependency, but is not limited thereto. The mobile terminal can restore the background process that ends the dependency to the resource restriction level before the reduction, and re-limit the resource usage of the background process.
  • the resource restriction level of the background process having the dependency relationship with the foreground process can be reduced, and the foreground process can be timely responded to prevent the foreground process from entering the wait due to the limitation of the resource usage of the background process, and the power consumption is reduced. At the same time improve the speed of the front desk.
  • a resource management method including the following operations:
  • the operation (1) is performed to obtain the running feature of the background application, and the application scenario type of the background application is determined according to the running feature, and the application scenario type includes the perceptible application and the non-perceivable application.
  • Operation (2) determines a resource restriction level of the background application according to the type of the application scenario.
  • the non-aware application includes an unperceptible application that receives the process communication and an unperceivable application that has no process communication.
  • the method further includes: configuring, by the background application, a resource usage priority corresponding to the resource restriction level, the application
  • the scenario type is that the resource usage priority of the application is higher than that of the non-aware application
  • the application scenario type is that the resource usage priority of the non-aware application receiving the process communication is higher than that of the non-process communication.
  • Operation (3) resource management of the background application according to the resource restriction level.
  • the operation (3) includes: acquiring user group information of the background application; querying a process identifier that has a mapping relationship with the user group information; and adding a background process that matches the process identifier to the resource group corresponding to the resource restriction level. in.
  • the method further includes: acquiring a foreground process running in the foreground; and reducing a resource restriction level of the background process having the dependency when there is a background process having a dependency relationship with the foreground process.
  • the method further includes: determining, when the background process and the foreground process have a synchronization mechanism and/or a communication mechanism, the background process having the synchronization mechanism and/or the communication mechanism as having a dependency relationship Background process.
  • the method further includes: determining a waiting lock resource when detecting that the foreground process has a lock waiting behavior; if there is a background process waiting for the lock resource, waiting for the lock resource
  • the background process is determined to be a background process with dependencies.
  • the method further includes: when the current process ends the dependency relationship with the background process, the background process that restores the end dependency is lowering the previous resource restriction level.
  • the running feature of the background application is obtained, and the application scenario type of the background application is determined according to the running feature, the resource restriction level of the background application is determined according to the application scenario type, and resource management is performed on the background application according to the resource restriction level.
  • the application scenario type of the background application dynamically implements different levels of resource limits for the background application, optimizes system performance, and saves power consumption.
  • a resource management apparatus 700 including a scene determination module 710, a level determination module 720, and a management module 730.
  • the scenario determining module 710 is configured to obtain an running feature of the background application, and determine an application scenario type of the background application according to the running feature, where the application scenario type includes the perceptible application and the non-perceptible application.
  • the level determining module 720 is configured to determine a resource restriction level of the background application according to the application scenario type.
  • the non-aware application includes an imperceptible application that receives process communication and an imperceptible application that has no process communication.
  • the level determining module 720 is further configured to: configure, by the background application, a resource usage priority corresponding to the resource restriction level, where the application scenario type is a perceptible application, the resource usage priority is higher than the non-sensible application, and the application scenario type is a non-sensible application communication. The perceived resource usage of the application is higher than the non-aware application of the processless communication.
  • the management module 730 is configured to perform resource management on the background application according to the resource restriction level.
  • the running feature of the background application is obtained, and the application scenario type of the background application is determined according to the running feature, the resource restriction level of the background application is determined according to the application scenario type, and resource management is performed on the background application according to the resource restriction level.
  • the application scenario type of the background application dynamically implements different levels of resource limits for the background application, optimizes system performance, and saves power consumption.
  • the management module 730 includes an obtaining unit 732, a query unit 734, and an adding unit 736.
  • the obtaining unit 732 is configured to obtain user group information of the background application.
  • the query unit 734 is configured to query a process identifier that has a mapping relationship with the user group information.
  • the adding unit 736 is configured to add a background process that matches the process identifier to the resource group corresponding to the resource restriction level.
  • the process identifier with the mapping relationship may be found according to the user group information of the background application, and the background process matching the process identifier is added to the resource group corresponding to the resource restriction level, and the resource restriction level may be Unified resource management is performed for each process running under the background application.
  • the resource group can also achieve different levels of resource limitation, optimize system performance, and save power consumption.
  • the resource management apparatus 700 includes a process determination module 710 and a reduction module 750 in addition to the scenario determination module 710 , the level determination module 720 , and the management module 730 .
  • the process obtaining module 740 is configured to obtain a foreground process running in the foreground.
  • the lowering module 750 is configured to reduce the resource restriction level of the background process having the dependency when there is a background process having a dependency relationship with the foreground process.
  • the resource management apparatus 700 further includes a dependency determination module.
  • the dependency determining module is configured to determine, when the background process and the foreground process have a synchronization mechanism and/or a communication mechanism, a background process having a synchronization mechanism and/or a communication mechanism as a background process having a dependency relationship.
  • the dependency determining module is further configured to determine a waiting lock resource when detecting a lock waiting behavior of the foreground process; if there is a background process waiting for the lock resource, the background process in the lock resource is to be waited Determined as a background process with dependencies.
  • the lowering module 750 is further configured to restore the previous resource restriction level when the current process ends the dependency relationship with the background process.
  • the resource restriction level of the background process having the dependency relationship with the foreground process can be reduced, and the foreground process can be timely responded to prevent the foreground process from entering the wait due to the limitation of the resource usage of the background process, and the power consumption is reduced. At the same time improve the speed of the front desk.
  • the embodiment of the present application further provides a mobile terminal.
  • a mobile terminal As shown in FIG. 10, for the convenience of description, only the parts related to the embodiments of the present application are shown. For the specific technical details not disclosed, refer to the method part of the embodiment of the present application.
  • the mobile terminal can be any mobile device, a tablet computer, a personal digital assistant (PDA), a point of sale (POS), a car computer, a wearable device, and the like, and the mobile terminal is used as a mobile phone.
  • PDA personal digital assistant
  • POS point of sale
  • car computer a car computer
  • wearable device a wearable device
  • FIG. 10 is a block diagram showing a partial structure of a mobile phone related to a mobile terminal provided by an embodiment of the present application.
  • the mobile phone includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, and a processor 1080. And power supply 1090 and other components.
  • RF radio frequency
  • the RF circuit 1010 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 1080.
  • 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 circuit 1010 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 GSM, GPRS, Code Division Multiple Access (CDMA), W-CDMA, Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
  • the memory 1020 can be used to store software programs and modules, and the processor 1080 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 1020.
  • the memory 1020 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 1020 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 1030 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 1000.
  • the input unit 1030 may include a touch panel 1032 and other input devices 1034.
  • the touch panel 1032 which may also be referred to as a touch screen, can collect touch operations on or near the user (such as a user using a finger, a stylus, or the like on the touch panel 1032 or near the touch panel 1032. Operation) and drive the corresponding connection device according to a preset program.
  • the touch panel 1032 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 1080 is provided and can receive commands from the processor 1080 and execute them.
  • the touch panel 1032 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 1030 can also include other input devices 1034.
  • other input devices 1034 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 1040 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 1040 can include a display panel 1042.
  • the display panel 1042 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
  • the touch panel 1032 can cover the display panel 1042. When the touch panel 1032 detects a touch operation thereon or nearby, the touch panel 1032 transmits to the processor 1080 to determine the type of the touch event, and then the processor 1080 is The type of touch event provides a corresponding visual output on display panel 1042.
  • the touch panel 1032 and the display panel 1042 are used as two independent components to implement the input and input functions of the mobile phone, in some embodiments, the touch panel 1032 can be integrated with the display panel 1042. Realize the input and output functions of the phone.
  • the handset 1000 can also include at least one type of sensor 1050, 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 1042 according to the brightness of the ambient light, and the proximity sensor may close the display panel 1042 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 1060, speaker 1062, and microphone 1064 can provide an audio interface between the user and the handset.
  • the audio circuit 1060 can transmit the converted electrical data of the received audio data to the speaker 1062, and convert it into a sound signal output by the speaker 1062.
  • the microphone 1064 converts the collected sound signal into an electrical signal, and the audio circuit 1060. After receiving, it is converted into audio data, and then processed by the audio data output processor 1080, transmitted to another mobile phone via the RF circuit 1010, or outputted to the memory 1020 for subsequent processing.
  • WiFi is a short-range wireless transmission technology.
  • the mobile phone through the WiFi module 1070 can help users to send and receive e-mail, browse the web and access streaming media, etc. It provides users with wireless broadband Internet access.
  • FIG. 10 shows the WiFi module 1070, it can be understood that it does not belong to the essential configuration of the mobile phone 1000 and can be omitted as needed.
  • the processor 1080 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 1020, and invoking data stored in the memory 1020, The phone's various functions and processing data, so that the overall monitoring of the phone.
  • processor 1080 can include one or more processing units.
  • the processor 1080 can integrate an application processor and a modem, wherein the application processor primarily processes an operating system, a user interface, an application, etc.; the modem primarily processes wireless communications. It will be appreciated that the above described modem may also not be integrated into the processor 1080.
  • the processor 1080 can integrate an application processor and a baseband processor, and the baseband processor and other peripheral chips can form a modem.
  • the mobile phone 1000 also includes a power source 1090 (such as a battery) for powering various components.
  • the power source can be logically coupled to the processor 1080 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
  • the handset 1000 may also include a camera, a Bluetooth module, and the like.
  • the processor 880 included in the mobile terminal implements the foregoing resource management method when executing a computer program stored in a memory.
  • the mobile terminal can include a memory 1020 and a processor 1080.
  • the memory 1020 stores a computer program that, when executed by the processor 1080, causes the processor to perform the following operations:
  • a computer readable storage medium having stored thereon a computer program that, when executed by a processor, implements the resource management method described above.
  • a computer program product comprising a computer program, when executed on a computer device, causes the computer device to perform the resource management method described above when executed.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or the like.
  • 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
  • synchronization Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)
  • Stored Programmes (AREA)

Abstract

一种资源管理方法包括:获取后台应用的运行特征,并根据所述运行特征确定所述后台应用的应用场景类型,所述应用场景类型包括可感知应用及不可感知应用;根据所述应用场景类型确定所述后台应用的资源限制等级;根据所述资源限制等级对所述后台应用进行资源管理。

Description

资源管理方法、装置、移动终端及计算机可读存储介质
相关申请的交叉引用
本申请要求于2017年12月29日提交中国专利局、申请号为201711488953.7、发明名称为“资源管理方法、装置、移动终端及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,特别是涉及一种资源管理方法、装置、移动终端及计算机可读存储介质。
背景技术
随着互联网的飞速发展,智能移动终端已经成为许多用户最常用的电子设备,例如智能手机、平板电板等。用户可在智能移动终端上安装各式的应用程序进行使用,当应用程序在后台进行运行时,会与前台运行的应用程序抢占CPU(Central Processing Unit,中央处理器)、内存、带宽等系统资源,导致出现前台运行的应用卡顿、系统运行缓慢及移动终端发热等问题。
发明内容
本申请实施例提供一种资源管理方法、装置、移动终端及计算机可读存储介质。
一种资源管理方法,包括:
获取后台应用的运行特征,并根据所述运行特征确定所述后台应用的应用场景类型,所述应用场景类型包括可感知应用及不可感知应用;
根据所述应用场景类型确定所述后台应用的资源限制等级;
根据所述资源限制等级对所述后台应用进行资源管理。
一种资源管理装置,包括:
场景确定模块,用于获取后台应用的运行特征,并根据所述运行特征确定所述后台应用的应用场景类型,所述应用场景类型包括可感知应用及不可感知应用;
等级确定模块,用于根据所述应用场景类型确定所述后台应用的资源限制等级;
管理模块,用于根据所述资源限制等级对所述后台应用进行资源管理。
一种移动终端,包括存储器及处理器,所述存储器中存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器实现如上所述的方法。
一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上所述的方法。
上述资源管理方法、装置、移动终端及计算机可读存储介质,获取后台应用的运行特征,并根据运行特征确定后台应用的应用场景类型,根据应用场景类型确定后台应用的资源限制等级,根据资源限制等级对后台应用进行资源管理,可以根据后台应用的应用场景类型对后台应用动态实现不同等级的资源限制,优化系统性能,节省功耗。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根 据这些附图获得其他的附图。
图1为一个实施例中移动终端的框图。
图2为一个实施例中资源管理方法的系统架构图。
图3为一个实施例中资源管理方法的流程示意图。
图4为一个实施例中不同资源限制等级的示意图。
图5为一个实施例中对后台应用下运行的进程统一进行资源管理的流程示意图;
图6为一个实施例中降低与前台进程具备依赖关系的后台进程的资源限制等级的流程示意图。
图7为一个实施例中资源管理装置的框图。
图8为一个实施例中管理模块的框图。
图9为另一个实施例中资源管理装置的框图。
图10为另一个实施例中移动终端的框图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一客户端称为第二客户端,且类似地,可将第二客户端称为第一客户端。第一客户端和第二客户端两者都是客户端,但其不是同一客户端。
图1为一个实施例中移动终端的框图。如图1所示,该移动终端包括通过系统总线连接的处理器、存储器、显示屏和输入装置。其中,存储器可包括非易失性存储介质及处理器。移动终端的非易失性存储介质存储有操作系统及计算机程序,该计算机程序被处理器执行时以实现本申请实施例中提供的一种资源管理方法。该处理器用于提供计算和控制能力,支撑整个移动终端的运行。移动终端中的内存储器为非易失性存储介质中的计算机程序的运行提供环境。移动终端的显示屏可以是液晶显示屏或者电子墨水显示屏等,输入装置可以是显示屏上覆盖的触摸层,也可以是移动终端外壳上设置的按键、轨迹球或触控板,也可以是外接的键盘、触控板或鼠标等。该移动终端可以是手机、平板电脑或者个人数字助理或穿戴式设备等。本领域技术人员可以理解,图1中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的移动终端的限定,具体的移动终端可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
图2为一个实施例中资源管理方法的系统架构图。如图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资源之外,进一步对相关进程所占用的内存资源进行回收,回收的内存可供其它进程使用。可选地,本地框架层220还可包括接口模块,该接口模块包含开发给上层的binder接口,上层的框架或者应用通过提供的binder接口来发送资源限制或者冻结的指令给资源优先级和限制管理模块222和平台冻结管理模块224。
内核空间层230中可包括UID管理模块231、Cgroup模块233、Binder管控模块235、进程内存回收模块237以及冻结超时退出模块239。其中,UID管理模块231用于实现基于应用的用户身份标识(User Identifier,UID)来管理第三方应用的资源或进行冻结。相比较于基于进程身份标识(Process Identifier,PID)来进行进程管控,通过UID更便于统一管理一个用户的应用的资源。Cgroup模块233用于提供一套完善的CPU、CPUSET、内存(memory)、输入/输出(input/output,I/O)和Net相关的资源限制机制。Binder管控模块235用于实现后台binder通信的优先级的控制。进程内存回收模块237用于实现进程深度冻结模式,这样能当某个第三方应用长期处于冻结状态的时候,会主要释放掉进程的文件区,从而达到节省内存的模块,也加快该应用在下次启动时的速度。冻结超时退出模块239可用于解决出现冻结超时场景产生的异常。通过上述的系统架构,可实现本申请各个实施例中的资源管理方法。
如图3所示,在一个实施例中,提供一种资源管理方法,包括以下操作:
操作310,获取后台应用的运行特征,并根据运行特征确定后台应用的应用场景类型。
移动终端上可同时运行有一个或多个应用程序,可包括在前台运行的前台应用及在后台运行的后台应用。移动终端可获取后台应用的运行特征,并根据运行特征确定各个后台应用的应用场景类型。可选地,应用场景类型可包括可感知应用及不可感知应用等。可感知应用指的是可以被用户听到、看到等可被用户感知到正在运行的应用,例如正在播放音乐的音乐应用、正在下载文件的应用等,但不限于此,虽然应用已进入到后台运行,但依然可被用户感知到该应用正在运行。不可感知应用指的是不可被用户感知到正在运行的应用,例如进入后台运行的社交应用、支付应用等,但不限于此。在一个实施例中,不可感知应用可包括接收进程通信的不可感知应用及无进程通信的不可感知应用,其中,接收进程通信的不可感知应用指的是应用下运行的进程与其他进程存在通信等交互的不可感知应用,无进程通信的不可感知应用指的是应用下运行的进程与其他进程不存在通信的不可感知应用。
移动终端可获取当前在后台运行的各个后台应用的运行特征,运行特征可包括但不限于应用当前执行的任务、应用下各个进程的通信事件、应用当前占用的资源类型及比例等。移动终端可根据后台应用的运行特征判断该后台应用的应用场景类型,不同的应用场景类型可根据实际需求预先设定对应的场景条件,并根据运行特征满足的场景条件确定应用场景类型。例如,应用场景类型为可感知应用对应的场景条件可包括应用当前执行的任务为播放任务或下载任务等,应用场景类型为接收进程通信的不可感知应用可包括应用在预设时间段内存在进程通信事件等,但不限于此。
可选地,后台应用的应用场景类型可随着运行特征的变化而发生改变,比如,音乐应用在后台播放音乐时,该音乐应用的应用场景类型可为可感知应用,当该音乐应用停止播放音乐时,该音乐应用的应用场景类型可变为不可感知应用。在一个实施例中,移动终端可每隔一段时间获取各个后台应用的运行特征,并根据运行特征确定各个后台应用的应用场景类型。移动终端也可对各个后台应用执行的任务进行监听,当检测到后台应用开始执 行任务或任务完成时,获取后台应用的运行特征,再根据运行特征确定后台应用的应用场景类型等。
操作320,根据应用场景类型确定后台应用的资源限制等级。
移动终端可根据实际需求设定不同的资源限制等级,资源限制等级可用于表示应用使用资源被限制的程度,资源限制等级越高,受限制的程度可越大。受限制的资源可包括但不限于CPU资源、内存资源、I/O资源、网络资源等。后台应用的应用场景类型不同,可分别对应不同的资源限制等级,可选地,应用场景类型为可感知应用的后台应用对应的资源限制等级可低于不可感知应用,应用场景类型为接收进程通信的不可感知应用的后台应用对应的资源限制等级可低于无进程通信的不可感知应用。
在一个实施例中,移动终端设定的资源限制等级可包括无限制级别、普通限制级别、深度限制级别及冻结级别。无限制级别可指的是应用使用的资源不受限制,前台运行的应用可对应无限制级别,从而保证前台应用的正常运行。普通限制级别可指的是应用可使用较少的资源,比如应用最多仅可使用50%的资源等,但不限于此。应用场景类型为可感知应用的后台应用可对应普通限制级别,在保证后台应用的可感知任务可正常执行的情况下,减少后台应用对资源的抢占。深度限制级别可指的是应用可使用极少的资源,比如应用最多仅可使用20%的资源等,但不限于此。应用场景类型为接收进程通信的不可感知应用的后台应用可对应深度限制级别,使用的资源可满足进程间通信任务的处理要求。冻结级别指的是应用无法使用任何的资源,停止应用的一切行为。应用场景类型为无进程通信应用的不可感知应用的后台应用可对应冻结级别,节省功耗。可以理解地,资源限制等级也可按照其他方式进行划分,并不仅限于上述几种方式。
操作330,根据资源限制等级对后台应用进行资源管理。
不同的资源限制等级可分别对应不同的资源使用优先级,资源限制等级越高,对应的资源使用优先级可越低,应用可使用的资源越少,资源限制等级越低,对应的资源使用优先级可越高,应用可使用的资源越多。可选地,移动终端根据后台应用的应用场景类型确定资源限制等级后,可对该后台应用配置与资源限制等级对应的资源使用优先级。应用场景类型为可感知应用的后台应用配置的资源使用优先级可高于不可感知应用,应用场景类型为接收进程通信的不可感知应用配置的资源使用优先级可高于无进程通信的不可感知应用。
移动终端根据后台应用的资源限制等级配置资源使用优先级后,可按照配置的资源使用优先级对后台应用使用的资源进行管理。当后台应用的应用场景类型发生变化时,移动终端可重新根据变化后的应用场景类型确定资源使用等级。
图4为一个实施例中不同资源限制等级的示意图。如图4所示,移动终端中可设定有四个不同的资源限制等级,分别包括无限制级别、普通限制级别、深度限制级别及冻结级别。无限制级别不限制应用使用的CPU、内存、I/O及网络等资源。普通限制级别限制应用可使用较少的CPU、内存、I/O及网络等资源。深度限制级别限制应用可使用极少的CPU、内存、I/O及网络等资源。冻结级别限制应用不可使用CPU、内存、I/O及网络等资源。移动终端可根据后台应用的应用场景类型确定资源限制等级,对不同应用场景类型的后台应用实现不同等级的资源限制。
在本实施例中,获取后台应用的运行特征,并根据运行特征确定后台应用的应用场景类型,根据应用场景类型确定后台应用的资源限制等级,根据资源限制等级对后台应用进行资源管理,可以根据后台应用的应用场景类型对后台应用动态实现不同等级的资源限制,优化系统性能,节省功耗。
如图5所示,在一个实施例中,操作330根据资源限制等级对后台应用进行资源管理,包括以下操作:
操作502,获取后台应用的用户组信息。
进程是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位,是 操作系统结构的基础。移动终端上通常可运行有多个进程,不同的进程可用于分别执行不同的任务。一个应用程序下可运行有一个或多个进程,当移动终端根据后台应用的应用场景类型确定资源限制等级后,可根据资源限制等级对后台应用下运行的各个进程进行统一的资源管理。可选地,应用程序进行运行时,移动终端可为运行的应用程序分配不同的用户组,可通过用户组管理应用程序的权限等。移动终端可获取后台应用的用户组信息,并根据用户组信息获取后台应用下运行的各个进程,其中,用户组信息可包括用户组标识等,用户组标识可以由数字、字母及符号等中的一种或多种进行构成。
操作504,查询与用户组信息具备映射关系的进程标识。
移动终端可根据后台应用的用户组信息查询与用户组信息具备映射关系的进程标识,从而得到后台应用下运行的各个进程。移动终端的内核空间层可实时对进程所属的用户组信息进行收集,当进程创建或销毁时,内核可对进程所属的用户组信息进行分配及释放等,进程在运行的过程中,也可以发生用户组信息改变的情况。内核空间层实时对各个进程所属的用户组信息进行收集,并可建立进程标识、进程名称等进程信息与用户组信息的映射关系。当移动终端需要调整后台应用的资源限制等级时,可根据后台应用的用户组信息直接查询具备映射关系的进程标识,相比起遍历所有运行的进程从而找到后台应用下运行的进程,直接查找与用户组信息具备映射关系的进程标识更加方便快捷。
操作506,将与进程标识匹配的后台进程添加到与资源限制等级对应的资源组别中。
移动终端可划分不同的资源组别,每个资源组别可分别对应不同的资源限制等级,并配置有对应的资源使用优先级。移动终端查询与用户组信息具备映射关系的进程标识后,可将与进程标识匹配的后台进程添加到与确定的资源限制等级对应的资源组别中,从而按照资源限制等级对后台应用下运行的各个进程进行统一的资源管理。可选地,移动终端可基于内核Cgroup(control group)机制划分不同的资源组别,并可采用文件节点写配置的方式设置各个资源组别的资源使用优先级,对各个资源组中的进程使用资源的时间或比例等进行管理,其中,Cgroup是内核中提供的一种可以限制、记录、隔离进程组(process groups)所使用的物理资源(比如:CPU、内存、I/O等资源)的机制。移动终端可加载Cgroup的配置文件,配置文件中可记录有划分的资源组别、各个资源组的资源使用优先级及与资源使用优先级对应的资源调度策略。资源调度策略可包括但不限于进程使用资源的时间、占用资源比例、使用的资源标识等,例如,可配置普通限制级别对应的资源组别的进程在1分钟内可使用30秒的CPU资源,且普通限制级别对应的资源组别的进程仅能使用编号为X的CPU资源等,但不限于此。当需要添加新的资源组别,或是修改资源组别的资源使用优先级及资源调度策略,可通过修改Cgroup的配置文件。
在本实施例中,可根据后台应用的用户组信息查找到具有映射关系的进程标识,并将与进程标识匹配的后台进程添加到与资源限制等级对应的资源组别中,可按照资源限制等级对后台应用下运行的各个进程进行统一的资源管理,通过资源组别的设置还可实现不同等级的资源限制,优化系统性能,节省功耗。
如图6所示,在一个实施例中,上述资源管理方法,还包括以下操作:
操作602,获取在前台运行的前台进程。
移动终端可获取在前台运行的前台进程,可选地,移动终端可通过活动管理器的RunningAppProcessInfo类获取正在运行的所有进程列表,并从进程列表中获取运行状态为前台运行的进程,即可确定该运行状态为前台运行的进程为前台进程。
操作604,当存在与前台进程具备依赖关系的后台进程时,降低具备依赖关系的后台进程的资源限制等级。
移动终端获取在前台运行的前台进程后,可检测是否存在与前台进程具备依赖关系的后台进程,具备依赖关系指的是一个进程需要等待另一个进程的消息才可正常执行,则两 个进程间存在依赖关系。可选地,移动终端可预先记录具备有依赖关系的进程标识,可获取前台进程的进程标识,并根据该前台进程的进程标识获取与前台进程具备依赖关系的进程标识。移动终端可根据与前台进程具备依赖关系的进程标识逐一对后台运行的各个进程进行检测,确定是否存在与前台进程具备依赖关系的后台进程。
移动终端可降低与前台进程具备依赖关系的后台进程的资源限制等级,提高该具备依赖关系的后台进程的资源使用优先级。可选地,移动终端可将与前台进程具备依赖关系的后台进程的资源限制等级调整为与前台进程相同的资源限制等级,可将具备依赖关系的后台进程分配至与前台进程相同的资源组别中,并配置与前台进程相同的资源使用优先级。提高与前台运行的进程具备依赖关系的后台进程的资源使用优先级,可加快与前台运行的进程具备依赖关系的后台进程的任务执行,从而减少前台运行的进程的等待时间,加快前台进程的运行。
在一个实施例中,移动终端可检测是否存在与前台进程存在交互通信的后台进程,可将与前台进程存在交互通信的后台进程确定为与前台进程具备依赖关系的后台进程。可选地,进程间的交互通信可包括同步机制和/或通信机制等,其中,同步机制可指的是两个进程相互协调共同完成任务,通信机制指的是在不同的进程之间进行传播或交换信息。
在一个实施例中,移动终端可检测是否存在与前台进程具有通信机制的后台进程,并可将与前台进程具有通信机制的后台进程确定为具备依赖关系的后台进程。通信机制可包括socket、binder、共享内存等,其中,网络上的两个程序通过一个双向的通信连接实现数据的交换,这个连接的一端称为一个socket;binder是一种进程间通信机制,提供远程过程调用功能;共享内存就是允许两个不相关的进程访问同一个逻辑内存,共享内存是在两个正在运行的进程之间共享和传递数据的一种非常有效的方式,不同进程之间共享的内存通常安排为同一段物理内存。可选地,移动终端可检测是否存在与前台运行的进程具有socket和/或binder通信的后台进程,并可将与前台运行的进程具有socket和/或binder通信的后台进程确定为具备依赖关系的后台进程。移动终端也可以检测是否存在与前台运行的进程进行内存共享的后台进程,并可将与前台运行的进程进行内存共享的后台进程确定为具备依赖关系的后台进程。在一个实施例中,移动终端可在binder驱动中添加检测机制,并根据binder驱动中添加的检测机制检测是否存在与前台进程具有通信机制的后台进程。
在一个实施例中,移动终端可检测是否存在与前台进程具有同步机制的后台进程,并可将与前台进程具有同步机制的后台进程确定为具备依赖关系的后台进程。同步机制可包括信号量、互斥锁等,其中,信号量(semaphore)的数据结构为一个值和一个指针,指针指向等待该信号量的下一个进程,互斥锁可用于保证共享数据的完整性,任意时刻只有一个进程可访问上具备有互斥锁的对象。可选地,移动终端可通过futex(fast userspace mutex,快速用户空间互斥体)系统的调用检测是否存在与前台进程具有同步机制的后台进程。futex系统的调用可用于实现进程间的同步机制,在用户空间中进行操作,是一种用户态(user mode)和内核态混合机制,其中,用户态指的是非特权状态。
在一个实施例中,当移动终端检测到前台进程发生锁等待行为时,可确定前台进程等待的锁资源。锁资源可包括线程锁、文件句柄、信号等,其中,文件句柄指的是从文件读取数据时,操作系统函数取回的顺序号,从而能够打开文件,文件句柄对于打开的文件是唯一的识别依据。移动终端可遍历所有在后台运行的进程,并检测是否存在等待在与前台进程同一锁资源的后台进程,可将与前台进程等待在同一锁资源的后台进程确定为具有依赖关系的后台进程。
在一个实施例中,移动终端可检测与前台进程具备依赖关系的后台进程,是否结束该依赖关系。比如,移动终端可检测后台进程是否结束与前台运行的进程的socket和/或binder通信,若结束通信,则可判定结束依赖关系。移动终端也可以检测与前台运行的进程等待在同一锁资源的后台进程是否完成任务,若任务完成,则可判断结束依赖关系,但 不限于此。移动终端可将结束依赖关系的后台进程恢复到降低之前的资源限制等级,重新对后台进程的资源使用进行限制。
在本实施例中,可降低与前台进程具备依赖关系的后台进程的资源限制等级,保证前台进程能够及时得到响应,防止因后台进程的资源使用受到限制而使前台进程进入等待,在降低功耗的同时提高前台的运行速度。
在一个实施例中,提供一种资源管理方法,包括以下操作:
操作(1),获取后台应用的运行特征,并根据运行特征确定后台应用的应用场景类型,应用场景类型包括可感知应用及不可感知应用。
操作(2),根据应用场景类型确定后台应用的资源限制等级。
可选地,不可感知应用包括接收进程通信的不可感知应用及无进程通信的不可感知应用;在操作(2)之后,还包括:对后台应用配置与资源限制等级对应的资源使用优先级,应用场景类型为可感知应用的资源使用优先级高于不可感知应用,应用场景类型为接收进程通信的不可感知应用的资源使用优先级高于无进程通信的不可感知应用。
操作(3),根据资源限制等级对后台应用进行资源管理。
可选地,操作(3),包括:获取后台应用的用户组信息;查询与用户组信息具备映射关系的进程标识;将与进程标识匹配的后台进程添加到与资源限制等级对应的资源组别中。
可选地,在操作(3)之后,还包括:获取在前台运行的前台进程;当存在与前台进程具备依赖关系的后台进程时,降低具备依赖关系的后台进程的资源限制等级。
可选地,在获取在前台运行的前台进程之后,还包括:当后台进程与前台进程具备同步机制和/或通信机制时,将具备同步机制和/或通信机制的后台进程确定为具备依赖关系的后台进程。
可选地,在获取在前台运行的前台进程之后,还包括:当检测到前台进程发生锁等待行为时,确定等待的锁资源;若存在等待在锁资源的后台进程,则将等待在锁资源的后台进程确定为具备依赖关系的后台进程。
可选地,在降低具备依赖关系的后台进程的资源限制等级之后,还包括:当前台进程结束与后台进程的依赖关系时,恢复结束依赖关系的后台进程在降低之前的资源限制等级。
在本实施例中,获取后台应用的运行特征,并根据运行特征确定后台应用的应用场景类型,根据应用场景类型确定后台应用的资源限制等级,根据资源限制等级对后台应用进行资源管理,可以根据后台应用的应用场景类型对后台应用动态实现不同等级的资源限制,优化系统性能,节省功耗。
应该理解的是,上述的流程示意图中的各个操作按照箭头的指示依次显示,但是这些操作并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些操作的执行并没有严格的顺序限制,这些操作可以以其它的顺序执行。而且,上述的流程示意图中的至少一部分操作可以包括多个子操作或者多个阶段,这些子操作或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子操作或者阶段的执行顺序也不必然是依次进行,而是可以与其它操作或者其它操作的子操作或者阶段的至少一部分轮流或者交替地执行。
如图7所示,在一个实施例中,提供一种资源管理装置700,包括场景确定模块710、等级确定模块720及管理模块730。
场景确定模块710,用于获取后台应用的运行特征,并根据运行特征确定后台应用的应用场景类型,应用场景类型包括可感知应用及不可感知应用。
等级确定模块720,用于根据应用场景类型确定后台应用的资源限制等级。
可选地,不可感知应用包括接收进程通信的不可感知应用及无进程通信的不可感知应用。等级确定模块720,还用于对后台应用配置与资源限制等级对应的资源使用优先级,应用场景类型为可感知应用的资源使用优先级高于不可感知应用,应用场景类型为接收进程通信的不可感知应用的资源使用优先级高于无进程通信的不可感知应用。
管理模块730,用于根据资源限制等级对后台应用进行资源管理。
在本实施例中,获取后台应用的运行特征,并根据运行特征确定后台应用的应用场景类型,根据应用场景类型确定后台应用的资源限制等级,根据资源限制等级对后台应用进行资源管理,可以根据后台应用的应用场景类型对后台应用动态实现不同等级的资源限制,优化系统性能,节省功耗。
如图8所示,在一个实施例中,管理模块730,包括获取单元732、查询单元734及添加单元736。
获取单元732,用于获取后台应用的用户组信息。
查询单元734,用于查询与用户组信息具备映射关系的进程标识。
添加单元736,用于将与进程标识匹配的后台进程添加到与资源限制等级对应的资源组别中。
在本实施例中,可根据后台应用的用户组信息查找到具有映射关系的进程标识,并将与进程标识匹配的后台进程添加到与资源限制等级对应的资源组别中,可按照资源限制等级对后台应用下运行的各个进程进行统一的资源管理,通过资源组别的设置还可实现不同等级的资源限制,优化系统性能,节省功耗。
如图9所示,在一个实施例中,上述资源管理装置700,除了包括场景确定模块710、等级确定模块720及管理模块730,还包括进程获取模块740及降低模块750。
进程获取模块740,用于获取在前台运行的前台进程。
降低模块750,用于当存在与前台进程具备依赖关系的后台进程时,降低具备依赖关系的后台进程的资源限制等级。
在一个实施例中,上述资源管理装置700,还包括依赖关系确定模块。
依赖关系确定模块,用于当后台进程与前台进程具备同步机制和/或通信机制时,将具备同步机制和/或通信机制的后台进程确定为具备依赖关系的后台进程。
在一个实施例中,依赖关系确定模块,还用于当检测到前台进程发生锁等待行为时,确定等待的锁资源;若存在等待在锁资源的后台进程,则将等待在锁资源的后台进程确定为具备依赖关系的后台进程。
在一个实施例中,降低模块750,还用于当前台进程结束与后台进程的依赖关系时,恢复结束依赖关系的后台进程在降低之前的资源限制等级。
在本实施例中,可降低与前台进程具备依赖关系的后台进程的资源限制等级,保证前台进程能够及时得到响应,防止因后台进程的资源使用受到限制而使前台进程进入等待,在降低功耗的同时提高前台的运行速度。
本申请实施例还提供了一种移动终端。如图10所示,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该移动终端可以为包括手机、平板电脑、个人数字助理(Personal Digital Assistant,PDA)、销售终端(Point of Sales,POS)、车载电脑、穿戴式设备等任意终端设备,以移动终端为手机为例:
图10为与本申请实施例提供的移动终端相关的手机的部分结构的框图。参考图10,手机包括:射频(Radio Frequency,RF)电路1010、存储器1020、输入单元1030、显示单元1040、传感器1050、音频电路1060、无线保真(wireless fidelity,WiFi)模块1070、处理器1080、以及电源1090等部件。本领域技术人员可以理解,图10所 示的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
其中,RF电路1010可用于收发信息或通话过程中,信号的接收和发送,可将基站的下行信息接收后,给处理器1080处理;也可以将上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路1010还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于GSM、GPRS、码分多址(Code Division Multiple Access,CDMA)、W-CDMA、长期演进(Long Term Evolution,LTE)、电子邮件、短消息服务(Short Messaging Service,SMS)等。
存储器1020可用于存储软件程序以及模块,处理器1080通过运行存储在存储器1020的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器1020可主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据手机的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器1020可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
输入单元1030可用于接收输入的数字或字符信息,以及产生与手机1000的用户设置以及功能控制有关的键信号输入。具体地,输入单元1030可包括触控面板1032以及其他输入设备1034。触控面板1032,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板1032上或在触控面板1032附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板1032可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器1080,并能接收处理器1080发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板1032。除了触控面板1032,输入单元1030还可以包括其他输入设备1034。具体地,其他输入设备1034可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。
显示单元1040可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元1040可包括显示面板1042。在一个实施例中,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板1042。在一个实施例中,触控面板1032可覆盖显示面板1042,当触控面板1032检测到在其上或附近的触摸操作后,传送给处理器1080以确定触摸事件的类型,随后处理器1080根据触摸事件的类型在显示面板1042上提供相应的视觉输出。虽然在图10中,触控面板1032与显示面板1042是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板1032与显示面板1042集成而实现手机的输入和输出功能。
手机1000还可包括至少一种传感器1050,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板1042的亮度,接近传感器可在手机移动到耳边时,关闭显示面板1042和/或背光。运动传感器可包括加速度传感器,通过加速度传感器可检测各个方向上加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外,手机还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。
音频电路1060、扬声器1062和传声器1064可提供用户与手机之间的音频接口。音频电路1060可将接收到的音频数据转换后的电信号,传输到扬声器1062,由扬声器1062转换为声音信号输出;另一方面,传声器1064将收集的声音信号转换为电信号,由音频电路1060接收后转换为音频数据,再将音频数据输出处理器1080处理后,经RF电路1010可以发送给另一手机,或者将音频数据输出至存储器1020以便后续处理。
WiFi属于短距离无线传输技术,手机通过WiFi模块1070可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图10示出了WiFi模块1070,但是可以理解的是,其并不属于手机1000的必须构成,可以根据需要而省略。
处理器1080是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器1020内的软件程序和/或模块,以及调用存储在存储器1020内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。在一个实施例中,处理器1080可包括一个或多个处理单元。在一个实施例中,处理器1080可集成应用处理器和调制解调器,其中,应用处理器主要处理操作系统、用户界面和应用程序等;调制解调器主要处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器1080中。比如,该处理器1080可集成应用处理器和基带处理器,基带处理器与和其它外围芯片等可组成调制解调器。手机1000还包括给各个部件供电的电源1090(比如电池),优选的,电源可以通过电源管理系统与处理器1080逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。
在一个实施例中,手机1000还可以包括摄像头、蓝牙模块等。
在本申请实施例中,该移动终端所包括的处理器880执行存储在存储器上的计算机程序时实现上述的资源管理方法。
在一个实施例中,该移动终端可包括存储器1020及处理器1080,存储器1020中存储有计算机程序,该计算机程序被处理器1080执行时,使得处理器执行如下操作:
获取后台应用的运行特征,并根据运行特征确定后台应用的应用场景类型,应用场景类型包括可感知应用及不可感知应用;
根据应用场景类型确定后台应用的资源限制等级;
根据资源限制等级对后台应用进行资源管理。
在一个实施例中,提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述的资源管理方法。
在一个实施例中,提供一种包含计算机程序的计算机程序产品,当其在计算机设备上运行时,使得计算机设备执行时实现上述的资源管理方法。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等。
如此处所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。合适的非易失性存储器可包括只读存储器(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)。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (11)

  1. 一种资源管理方法,包括:
    获取后台应用的运行特征,并根据所述运行特征确定所述后台应用的应用场景类型,所述应用场景类型包括可感知应用及不可感知应用;
    根据所述应用场景类型确定所述后台应用的资源限制等级;及
    根据所述资源限制等级对所述后台应用进行资源管理。
  2. 根据权利要求1所述的方法,其特征在于,所述不可感知应用包括接收进程通信的不可感知应用及无进程通信的不可感知应用;
    在所述根据所述应用场景类型确定所述后台应用的资源限制等级之后,还包括:
    对所述后台应用配置与所述资源限制等级对应的资源使用优先级,应用场景类型为可感知应用的资源使用优先级高于不可感知应用,应用场景类型为接收进程通信的不可感知应用的资源使用优先级高于无进程通信的不可感知应用。
  3. 根据权利要求1所述的方法,其特征在于,所述根据所述资源限制等级对所述后台应用进行资源管理,包括:
    获取所述后台应用的用户组信息;
    查询与所述用户组信息具备映射关系的进程标识;及
    将与所述进程标识匹配的后台进程添加到与所述资源限制等级对应的资源组别中。
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    获取在前台运行的前台进程;
    当存在与所述前台进程具备依赖关系的后台进程时,降低所述具备依赖关系的后台进程的资源限制等级。
  5. 根据权利要求4所述的方法,其特征在于,在所述获取在前台运行的前台进程之后,所述方法还包括:
    当后台进程与所述前台进程具备同步机制和/或通信机制时,将具备同步机制和/或通信机制的后台进程确定为具备依赖关系的后台进程。
  6. 根据权利要求5所述的方法,其特征在于,所述通信机制包括socket、binder和共享内存中至少一种。
  7. 根据权利要求4所述的方法,其特征在于,在所述获取在前台运行的前台进程之后,所述方法还包括:
    当检测到所述前台进程发生锁等待行为时,确定等待的锁资源;
    当存在等待在所述锁资源的后台进程时,则将所述等待在所述锁资源的后台进程确定为具备依赖关系的后台进程。
  8. 根据权利要求4至7任一所述的方法,其特征在于,在所述降低所述具备依赖关系的后台进程的资源限制等级之后,所述方法还包括:
    当所述前台进程结束与所述后台进程的依赖关系时,恢复结束依赖关系的后台进程在降低之前的资源限制等级。
  9. 一种资源管理装置,其特征在于,包括:
    场景确定模块,用于获取后台应用的运行特征,并根据所述运行特征确定所述后台应用的应用场景类型,所述应用场景类型包括可感知应用及不可感知应用;
    等级确定模块,用于根据所述应用场景类型确定所述后台应用的资源限制等级;
    管理模块,用于根据所述资源限制等级对所述后台应用进行资源管理。
  10. 一种移动终端,包括存储器及处理器,所述存储器中存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器实现如权利要求1至8任一所述的方法。
  11. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至8任一所述的方法。
PCT/CN2018/116944 2017-12-29 2018-11-22 资源管理方法、装置、移动终端及计算机可读存储介质 WO2019128571A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711488953.7 2017-12-29
CN201711488953.7A CN109992399B (zh) 2017-12-29 2017-12-29 资源管理方法、装置、移动终端及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2019128571A1 true WO2019128571A1 (zh) 2019-07-04

Family

ID=67063038

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/116944 WO2019128571A1 (zh) 2017-12-29 2018-11-22 资源管理方法、装置、移动终端及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN109992399B (zh)
WO (1) WO2019128571A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112463350A (zh) * 2019-09-09 2021-03-09 珠海市魅族科技有限公司 后台应用优化方法及装置、存储介质及电子装置
US12050937B2 (en) 2021-09-21 2024-07-30 International Business Machines Corporation Preventing resource exploitation in mobile devices

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110806926A (zh) * 2019-09-05 2020-02-18 华为技术有限公司 一种资源管控方法及设备
CN110554922A (zh) * 2019-09-05 2019-12-10 北京安云世纪科技有限公司 一种系统资源分配方法及装置
CN117389711B (zh) * 2023-12-11 2024-04-09 腾讯科技(深圳)有限公司 终端资源的调度方法、装置、终端及计算机可读存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020184369A1 (en) * 2001-05-31 2002-12-05 Parkinson Steven William Appointment scheme for redistributing service access
CN102932935A (zh) * 2011-08-12 2013-02-13 中国移动通信集团公司 一种数据传输方法及移动终端
CN106293913A (zh) * 2016-08-01 2017-01-04 宇龙计算机通信科技(深圳)有限公司 应用程序的控制方法、控制装置和终端

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095592B (zh) * 2016-05-31 2021-08-24 Oppo广东移动通信有限公司 一种前景应用程序场景同步方法及装置、系统
CN107181700A (zh) * 2017-07-19 2017-09-19 努比亚技术有限公司 移动终端应用程序的控制方法、移动终端及存储介质

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020184369A1 (en) * 2001-05-31 2002-12-05 Parkinson Steven William Appointment scheme for redistributing service access
CN102932935A (zh) * 2011-08-12 2013-02-13 中国移动通信集团公司 一种数据传输方法及移动终端
CN106293913A (zh) * 2016-08-01 2017-01-04 宇龙计算机通信科技(深圳)有限公司 应用程序的控制方法、控制装置和终端

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112463350A (zh) * 2019-09-09 2021-03-09 珠海市魅族科技有限公司 后台应用优化方法及装置、存储介质及电子装置
US12050937B2 (en) 2021-09-21 2024-07-30 International Business Machines Corporation Preventing resource exploitation in mobile devices

Also Published As

Publication number Publication date
CN109992399A (zh) 2019-07-09
CN109992399B (zh) 2021-04-23

Similar Documents

Publication Publication Date Title
WO2019128540A1 (zh) 资源管理方法、移动终端及计算机可读存储介质
WO2019128571A1 (zh) 资源管理方法、装置、移动终端及计算机可读存储介质
KR102148948B1 (ko) 전자 장치의 멀티 태스킹 방법 및 그 전자 장치
WO2019137173A1 (zh) 资源管理方法、移动终端及计算机可读存储介质
CN110888821B (zh) 一种内存管理方法及装置
WO2019128546A1 (zh) 应用程序处理方法、电子设备、计算机可读存储介质
WO2019128588A1 (zh) 进程处理方法和装置、电子设备、计算机可读存储介质
WO2019137252A1 (zh) 内存处理方法、电子设备、计算机可读存储介质
CN110032267B (zh) 信息处理方法、装置、移动终端及计算机可读存储介质
US20140115021A1 (en) Method and Terminal for Accessing a File of a Terminal
WO2015085966A1 (zh) 界面显示方法、装置、终端、服务器和系统
WO2017206901A1 (zh) 进程控制方法及相关设备
WO2019128537A1 (zh) 应用冻结方法、计算机设备和计算机可读存储介质
WO2019184631A1 (zh) 信息处理方法和装置、计算机可读存储介质、终端
CN110032429B (zh) 信息处理方法、装置、移动终端及计算机可读存储介质
WO2019128574A1 (zh) 信息处理方法、装置、计算机设备和计算机可读存储介质
WO2019128542A1 (zh) 应用处理方法、电子设备、计算机可读存储介质
WO2019184617A1 (zh) 信息共享方法和装置、计算机可读存储介质、终端
WO2019128573A1 (zh) 信息处理方法、装置、计算机设备和计算机可读存储介质
WO2019128569A1 (zh) 应用程序冻结方法、装置、存储介质和终端
CN110046032A (zh) 应用程序处理方法和装置、电子设备、计算机可读存储介质
WO2019128586A1 (zh) 应用程序处理方法、电子设备、计算机可读存储介质
CN110677456A (zh) 一种资源配置的方法及设备
WO2019128553A1 (zh) 应用程序处理方法、电子设备、计算机可读存储介质
WO2019137187A1 (zh) 资源管理方法、装置、移动终端及计算机可读存储介质

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

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

Country of ref document: EP

Kind code of ref document: A1