WO2019128540A1 - Resource management method, mobile terminal and computer readable storage medium - Google Patents
Resource management method, mobile terminal and computer readable storage medium Download PDFInfo
- Publication number
- WO2019128540A1 WO2019128540A1 PCT/CN2018/116495 CN2018116495W WO2019128540A1 WO 2019128540 A1 WO2019128540 A1 WO 2019128540A1 CN 2018116495 W CN2018116495 W CN 2018116495W WO 2019128540 A1 WO2019128540 A1 WO 2019128540A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- target
- resource
- restriction level
- application
- resource restriction
- Prior art date
- Legal status (The legal status 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 status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy 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, a mobile terminal, and a computer readable storage medium.
- a resource management method a mobile terminal, and a computer readable storage medium are provided.
- a resource management method including:
- a target category for performing a resource restriction level change the target category including one of a thread, a process, and an application
- the target corresponding to the target identifier is configured as a resource usage priority corresponding to the changed resource restriction level according to a setting manner corresponding to the target type.
- a mobile terminal includes a memory and a processor, wherein the memory stores a computer program, when the computer program is executed by the processor, causing the processor to perform an operation of: acquiring a target identifier for performing resource restriction level change Determining, according to the target identifier, a target category for performing a resource restriction level change, the target category including one of a thread, a process, and an application; and corresponding to the target identifier according to a setting manner corresponding to the target category
- the target is configured as a resource usage priority corresponding to the changed resource restriction level.
- a computer readable storage medium having stored thereon a computer program, the computer program being executed by a processor, causing a processor to: acquire a target identifier for performing a resource restriction level change; and determine to perform a resource according to the target identifier Restricting the target type of the level change, the target category includes one of a thread, a process, and an application; configuring the target corresponding to the target identifier to be the changed resource limit according to a setting manner corresponding to the target category The resource usage priority corresponding to the level.
- 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.
- FIG. 4 is a schematic diagram of a resource group in an embodiment.
- FIG. 5 is a schematic diagram of a process of configuring resource usage priorities according to target types in an embodiment.
- FIG. 6 is a schematic flowchart of configuring resource usage priority for an application in an embodiment.
- FIG. 7 is a schematic diagram of resource limitation from multiple dimensions such as threads, processes, and applications in one embodiment.
- FIG. 8 is a schematic flowchart of determining a resource restriction level change target identifier and a changed resource restriction level in one embodiment.
- Figure 9 is a block diagram of a resource management device in one 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.
- 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:
- Operation 310 obtaining a target identifier for performing a resource restriction level change.
- a mobile terminal can run one or more applications at the same time.
- One application can run one or more processes, and one process can run one or more threads.
- 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.
- a thread can also be called a Lightweight Process (LWP), which is the smallest unit of a program execution flow.
- LWP Lightweight Process
- a thread is an entity in a process and is the basic unit that is independently scheduled and dispatched by the system.
- 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 resource usage 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.
- Different resource restriction levels may correspond to different resource usage priorities. The higher the resource restriction level, the smaller the corresponding resource usage priority, and the lower the resource restriction level, the greater the corresponding resource usage priority.
- 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 resources used by an application, a process, or a thread are not limited.
- an application or a process running in the foreground can correspond to an unrestricted level, thereby ensuring normal operation of a foreground application or a process.
- the normal restriction level may refer to applications, processes, threads, etc., which may use less resources, such as up to 50% of resources, but are not limited thereto.
- the depth limit level may refer to applications, processes, or threads that use very few resources, such as up to 20% of resources, but are not limited thereto.
- the freeze level refers to any behavior that cannot be used by an application, process, or thread to stop an application, process, or thread.
- the mobile terminal can monitor each application, each process, and each thread, collect the running characteristics of each application, each process, and each thread, and determine resource limits of each application, each process, and each thread according to the running characteristics. grade.
- the running characteristics may include, but are not limited to, an operating state, a currently executed task, a communication event, a currently occupied resource type and a proportion, etc., wherein the running state may include foreground running and background running, and the communication event refers to communication between processes Such as socket, binder communication, etc.
- the mobile terminal may collect running characteristics of each application, each process, and each thread at a certain time period, and determine, according to the running characteristics, whether the resource restriction level of the application, the process, or the thread needs to be changed, for example, when the application is from the foreground.
- the resource restriction level of the application may be increased, or when the process receives the communication message sent by other processes, the resource restriction level of the process may be lowered, but is not limited thereto.
- the mobile terminal can obtain a target identifier for making a resource restriction level change, and the target identifier can be used to identify a target for resource restriction level change, which can be an application, a process, a thread, and the like.
- the target identifier may be composed of one or more of numbers, letters, symbols, and the like.
- Operation 320 determining, according to the target identifier, a target type for performing a resource restriction level change, the target category including one of a thread, a process, and an application.
- the mobile terminal acquires the target identifier for performing the resource restriction level, and can parse the target identifier, determine the target for which the resource restriction level is changed, and the target type to which the target belongs.
- the target type can be one of a thread, a process, an application, and the like.
- the target identifiers of different target categories may correspond to different formats.
- the identifiers of threads, processes, and applications may respectively correspond to different numbers, for example, the thread identifier corresponds to 8 digits, the process identifier corresponds to 9 digits, and the application The identifier corresponds to 10 digits, etc., or the identifier of the process, process, and application carries the corresponding character.
- the letter of the thread identifier in the first digit is T
- the letter of the process identifier in the first digit is P
- the application identifier is in the first One letter is A, etc., but is not limited to this.
- the target corresponding to the target identifier is configured as a resource usage priority corresponding to the changed resource restriction level according to a setting manner corresponding to the target type.
- the mobile terminal may obtain a setting manner corresponding to the target type, and configure the target corresponding to the target identifier as the resource use priority corresponding to the changed resource restriction level.
- Applications, processes, and threads can be assigned to different resource usage priority settings.
- the target type is a thread
- the mobile terminal may first obtain each thread that runs, and query a target thread that needs to perform a resource restriction level change according to the target identifier, and then configure the target thread to use the resource priority corresponding to the changed resource restriction level. level.
- the target type is a process
- the mobile terminal optionally obtains each running process, and queries the target process that needs to perform the resource restriction level change according to the target identifier, and then acquires all threads running under the target process, and runs all threads under the target process.
- the resource usage priority corresponding to the changed resource restriction level is configured to implement the target process as the resource usage priority corresponding to the changed resource restriction level, but is not limited thereto. It can be understood that the application, the process, and the thread can also respectively correspond to other settings, for example, the target type is a process, and the mobile terminal can directly obtain the target process according to the target identifier, and configure the target process to correspond to the changed resource restriction level. Resource usage priority, etc.
- the mobile terminal may add a target corresponding to the target identifier to a resource group corresponding to the changed resource restriction level, and configure a resource usage priority corresponding to the resource group.
- 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 is allocated to each resource group.
- the application, process, or thread manages the time or proportion of resources, etc., where Cgroup is a physical resource that can be used to limit, record, and isolate applications, processes, or threads (such as CPU, The mechanism of memory, I / O and other resources).
- 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, an application, a process, a thread, or the like, which is allocated to the resource group, a time when the resource is used, a proportion of the occupied resource, a resource identifier used, and the like.
- the resource group corresponding to the common restriction level may be configured.
- An application, a process, a thread, or the like can use 30 seconds of CPU resources in one minute, and an application, a process, or a thread of a resource group corresponding to a common restriction level can use only CPU resources numbered X, but is not limited thereto.
- you need to add a new resource group, or modify the resource usage priority and resource scheduling policy of the resource group you can modify the Cgroup configuration file.
- FIG. 4 is a schematic diagram of a resource group in an embodiment.
- four different resource restriction levels can be set in the mobile terminal, and four resource groups are divided, wherein the first resource group corresponds to an unrestricted level, and the second resource group corresponds to an ordinary limit. Level, the third resource group corresponds to the depth limit level, and the fourth resource group corresponds to the freeze level.
- the four resource groups may respectively correspond to different resource usage priorities, the resource usage priority of the first resource group may be higher than the second resource group, and the resource usage priority of the second resource group may be higher than the third resource. In the group, the resource usage priority of the third resource group may be higher than the fourth resource group.
- the first resource group at an unrestricted level does not limit resources such as CPU, memory, I/O, and network used by applications, processes, or threads.
- the second resource group of the general restriction level limits applications such as CPU, memory, I/O, and network to applications, processes, or threads.
- the third resource group at the depth limit level limits the use of resources such as CPU, memory, I/O, and network to applications, processes, or threads.
- the fourth resource group at the freeze level restricts applications such as CPU, memory, I/O, and network from being used by applications, processes, or threads.
- the mobile terminal can change and adjust the resource restriction levels of applications, processes, and threads according to the running characteristics of each application, process, or thread, and allocate applications, processes, and threads to corresponding resource groups, configurations, and resources.
- the resource usage priority corresponding to the group manages the resources used by each running application, process, and thread.
- the target identifier for performing the resource restriction level change is obtained, and the target type for performing the resource restriction level change is determined according to the target identifier, and the target category may include one of a thread, a process, and an application, and then according to the target category.
- the setting method is configured to configure the target corresponding to the target identifier as the resource usage priority corresponding to the changed resource restriction level, and can perform resource limitation from multiple dimensions such as threads, processes, and applications, and implement resource management comprehensively and flexibly. Optimize system performance and save power.
- the operation 330 configures the target corresponding to the target identifier as the resource usage priority corresponding to the changed resource restriction level according to the setting manner corresponding to the target category, and includes the following operations:
- the thread corresponding to the target identifier is configured as a resource usage priority corresponding to the changed resource restriction level.
- the mobile terminal determines the target type according to the target identifier that performs the resource restriction level change.
- the target category is a thread
- the mobile terminal may acquire all the currently running threads, and query the target thread that needs to perform the resource restriction level change according to the target identifier, and The target thread is added to the resource group corresponding to the changed resource restriction level, and the resource usage priority corresponding to the resource group is configured.
- resources such as CPU, I/O, memory, and network may be used according to a preset resource scheduling policy corresponding to the resource group.
- each thread included in the process corresponding to the target identifier is configured as a resource usage priority corresponding to the changed resource restriction level.
- the mobile terminal determines the target type according to the target identifier that performs the resource restriction level change.
- the target category is a process
- the mobile terminal may acquire each currently running process, and query the target process that needs to perform the resource restriction level change according to the target identifier.
- the mobile terminal may add the target process to the resource group corresponding to the changed resource restriction level, and configure the resource usage priority corresponding to the resource group.
- the mobile terminal may acquire all threads running under the target process, and add all threads running under the target process to the resource group corresponding to the changed resource restriction level, and configure and The resource usage priority corresponding to the resource group. All the threads running under the target process are configured with the resource usage priority corresponding to the changed resource restriction level, so that the target process can be configured to be the resource usage priority corresponding to the changed resource restriction level.
- resources such as CPU, I/O, memory, and network may be used according to a preset resource scheduling policy corresponding to the resource group. Further, All threads included in the target process can use resources according to the corresponding resource scheduling policy.
- each process included in the application corresponding to the target identifier is configured as a resource usage priority corresponding to the changed resource restriction level.
- the mobile terminal determines the target category according to the target identifier that changes the resource restriction level.
- the target category is an application
- the mobile terminal may obtain each application that is currently running, and query the target application that needs to perform the resource restriction level change according to the target identifier.
- the mobile terminal may add the target application to the resource group corresponding to the changed resource restriction level, and configure the resource usage priority corresponding to the resource group.
- the mobile terminal may acquire all the processes running in the target application, and add all the processes running in the target application to the resource group corresponding to the changed resource restriction level, and configure and The resource usage priority corresponding to the resource group.
- the operation configures each process included in the application corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level, and includes the following operations:
- Operation 602 Acquire user group information of the application according to the target identifier.
- 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 After obtaining the target application for performing the resource level change according to the target identifier, the mobile terminal obtains the user group information of the target application, and obtains each process running under the target application according to the user group information.
- the user group information may include a user group identifier or the like, wherein the user group identifier may be composed of one or more of numbers, letters, symbols, and the like.
- Operation 604 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 target application, thereby obtaining each process running under the target 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 with the mapping relationship may be directly queried according to the user group information of the target application, and the process running under the target 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.
- the process matching the process identifier is configured as a resource usage priority corresponding to the changed resource restriction level.
- the mobile terminal After the mobile terminal queries the process identifier with the mapping relationship according to the user group information of the target application, all processes running under the target application can be obtained according to the process identifier.
- the mobile terminal may add all processes running under the target application to the resource group corresponding to the changed resource restriction level, and configure resource usage priorities corresponding to the changed resource restriction level for all processes running under the target application. , so that the purpose of configuring the target application as the resource usage priority corresponding to the changed resource restriction level can be achieved.
- the resource scheduling policy corresponding to the resource group may be used to use resources such as CPU, I/O, memory, and network. Further, All processes included in the target application can use resources according to the corresponding resource scheduling policy.
- FIG. 7 is a schematic diagram of resource limitation from multiple dimensions such as threads, processes, and applications in one embodiment.
- an application may include one or more processes, and one process may include one or more threads.
- the mobile terminal configures the resource usage priority of the application, and can implement the resource usage priority of each process included in the application.
- the mobile terminal configures the resource usage priority of the process, and can implement the resource usage priority of each thread included in the process.
- the mobile terminal can also separately configure the resource usage priority of a certain thread, and can configure resource usage priorities from multiple dimensions such as applications, processes, and threads, and limit resource usage.
- the mobile terminal can perform resource limitation from multiple dimensions such as threads, processes, and applications, comprehensively and flexibly implement resource management, optimize system performance, and save power consumption.
- the following operations are also included:
- Operation 802 collects event data of each application running, each process, and each thread through the kernel space, and packages the event data into a data packet and transmits the data to the user space.
- the virtual space of the mobile terminal may include kernel space and user space, the kernel space may be used to store the code and data of the kernel, and the user space may be used to store the code and data of the application.
- Kernel space has a high privilege level. Processes running in kernel space can have access to all hardware of the mobile terminal. User space has lower permissions. Processes running in user space can only use some resources of the system.
- the mobile terminal can collect event data of each application running, each process, and each thread through the kernel space, and the event data may include, but is not limited to, an event type, an event time, an event content, a target identifier to which the event belongs, and the like.
- Event types may include, but are not limited to, communication events, creation events, exit events, change identification events, task events, and the like.
- the communication event may include a binder communication event and a socket communication event, wherein the binder is an inter-process communication mechanism that provides a remote procedure call function; the two programs on the network exchange data through a two-way communication connection, the connection One end is called a socket.
- Creating an event can refer to an event created by a process or thread.
- An exit event refers to an event that is exited by an application, process, or thread.
- a change identification event can refer to a process or a thread that changes its own identity, and the like.
- a task event can refer to a task, such as an application, a process, or a thread.
- the mobile terminal collects objects for different applications, processes, threads, and the like, and collects event data of different event types.
- the mobile terminal may pre-determine the type of the collected event and the corresponding collection object identifier.
- the application or process of collecting the binder communication event may be pre-defined, or the application or process for collecting the socket communication event may be pre-defined.
- Different event types can respectively correspond to different collection object identifiers.
- the mobile terminal collects event data of each application running, each process, and each thread through the kernel space, and can package the event data into a data packet according to the agreed packet format, and transmit the data packet to the user space.
- the kernel space and the user space can communicate by means of an asynchronous netlink, which is a special inter-process communication that enables the user process to communicate with the kernel process.
- the kernel space transmits the event data to the user space by means of asynchronous communication, which is faster and more convenient than the active query mode of the user space, and can improve the transmission efficiency of the event data.
- Operation 804 parsing the data packet through the user space to obtain event data.
- Operation 806 analyzing the event data through the user space, determining the target identifier for performing the resource restriction level change, and the changed resource restriction level.
- the user space After receiving the data packet transmitted by the kernel space, the user space can parse the data packet to obtain event data.
- the mobile terminal can analyze the event data through the user space to determine the target identifier that needs to be changed by the resource restriction level.
- the user space may analyze the event type, the event content, and the like in the event data, so as to determine whether the target identifier to which the event belongs needs to be changed by the resource restriction level.
- the mobile terminal analyzes the event data through the user space, and when detecting that the application or the process does not have a communication event such as a binder or a socket within a preset time period, the application or process that does not have a communication event may be improved.
- the resource restriction level reduces the resource usage priority of the application or process.
- the mobile terminal may determine that the identifier of the application or process in which the communication event has not occurred within the preset time period is the target identifier, and determine the increased resource restriction level.
- the user may first acquire the current resource restriction level of the application or the process in which the communication event does not occur, when no communication event occurs.
- the current resource limit level of an application or process is a freeze level
- the resource limit level may not be changed.
- the resource restriction level of the application or process in which the communication event does not occur may be increased, and the resource restriction level of the application or process is changed to the freeze level.
- the resource restriction level of the application or process in which the communication event occurs may be reduced, and the resource usage priority of the application or process may be increased.
- the mobile terminal may determine the identity of the application or process in which the communication event occurred as the target identity and determine the reduced resource restriction level.
- the current resource restriction level of the application or the process in which the communication event occurs may be acquired.
- the user space can determine, by the event data, whether the application or process has a communication event with an application or process running in the foreground, when the application or process has a communication event with an application or process running in the foreground, and the current resource limit of the application or process is high.
- the resource limit level of the application or process can be reduced.
- the application or process in which the communication event occurs may be configured with the same resource usage priority as the application or process running in the foreground, so that the application or process running in the foreground can be timely responded and the running speed is improved.
- the mobile terminal analyzes the event data through the user space.
- the resource restriction level of the thread that is performing the rendering task may be lowered, and the resource usage priority of the thread is increased.
- the mobile terminal may determine, by the user space, the thread identifier that is performing the rendering task as the target identifier, and determine the reduced resource restriction level.
- the resource restriction level of the process running in the foreground may be obtained, and the thread that is performing the rendering task may be changed to the same resource restriction level as the process running in the foreground, and the guarantee is guaranteed.
- Render tasks are executed quickly, reducing the occurrence of stuck.
- the mobile terminal can collect event data of each application, each process, and each thread through the kernel space, and transmit the collected event data to the user space for analysis, which can provide a clue basis for more resource restriction level changes. It can make the resource restriction level adjustment of threads, processes and applications more accurate, improve resource management effect and system performance.
- a resource management method including the following operations:
- Operation (1) obtain the target identifier for the resource restriction level change.
- the method further includes: collecting, by using a kernel space, event data of each application, each process, and each thread, and packaging the event data into a data packet and transmitting the data to the user space; The data packet is obtained, and the event data is obtained; the event data is analyzed through the user space, and the target identifier for changing the resource restriction level is determined, and the changed resource restriction level is determined.
- the mobile terminal analyzes the event data by using a user space, determines a target identifier for performing a resource restriction level change, and the changed resource restriction level, including: analyzing event data through the user space, when detecting an application or a process.
- the resource restriction level of the application or process in which the communication event does not occur is increased; when the communication event occurs when the application or process is detected, the resource restriction level of the application or process in which the communication event occurs is reduced.
- the mobile terminal analyzes the event data by using a user space, determines a target identifier for performing resource restriction level change, and the changed resource restriction level, including: analyzing event data by using user space, when detecting that the thread is executing When rendering a task, lower the resource limit level of the thread that is executing the rendering task.
- Operation (2) determining a target type for performing a resource restriction level change according to the target identifier, the target category including one of a thread, a process, and an application.
- the target corresponding to the target identifier is configured as a resource usage priority corresponding to the changed resource restriction level according to a setting manner corresponding to the target type.
- the operation (3) includes: configuring, when the target category is a thread, a thread corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level; when the target category is a process, Each thread included in the process corresponding to the target identifier is configured as a resource usage priority corresponding to the changed resource restriction level; when the target type is an application, each process included in the application corresponding to the target identifier is configured as the changed resource.
- the resource usage priority corresponding to the restriction level when the target category is a thread, a thread corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level.
- the mobile terminal configures each process included in the application corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level, including: acquiring user group information of the application according to the target identifier; querying and user group information A process ID with a mapping relationship; a process that matches the process ID is configured as a resource usage priority corresponding to the changed resource restriction level.
- the operation (3) includes: adding a target corresponding to the target identifier to the resource group corresponding to the changed resource restriction level, and configuring a resource usage priority corresponding to the resource group.
- the mobile terminal acquires the target identifier for performing the resource restriction level change, and determines the target type for performing the resource restriction level change according to the target identifier, and the target category may include one of a thread, a process, and an application, and the mobile terminal further
- the setting method corresponding to the target type configures the target corresponding to the target identifier as the resource usage priority corresponding to the changed resource restriction level, and the mobile terminal can perform resource limitation from multiple dimensions such as threads, processes, and applications, comprehensively, Flexible resource management, optimized system performance, and reduced power consumption.
- a resource management apparatus 900 including an identifier obtaining module 910, a category determining module 920, and a configuration module 930.
- the identifier obtaining module 910 is configured to acquire a target identifier for performing a resource restriction level change.
- the category determining module 920 is configured to determine, according to the target identifier, a target category for performing a resource restriction level change, where the target category includes one of a thread, a process, and an application.
- the configuration module 930 is configured to configure, according to the setting manner corresponding to the target category, a target corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level.
- the configuration module 930 is further configured to add a target corresponding to the target identifier to the resource group corresponding to the changed resource restriction level, and configure a resource usage priority corresponding to the resource group.
- the target identifier for performing the resource restriction level change is obtained, and the target type for performing the resource restriction level change is determined according to the target identifier, and the target category may include one of a thread, a process, and an application, and then according to the target category.
- the setting method is configured to configure the target corresponding to the target identifier as the resource usage priority corresponding to the changed resource restriction level, and can perform resource limitation from multiple dimensions such as threads, processes, and applications, and implement resource management comprehensively and flexibly. Optimize system performance and save power.
- the configuration module 930 includes a thread configuration unit, a process configuration unit, and an application configuration unit.
- the thread configuration unit is configured to configure, when the target type is a thread, a thread corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level.
- the process configuration unit is configured to configure, when the target type is a process, each thread included in the process corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level.
- the application configuration unit is configured to configure, when the target type is an application, each process included in the application corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level.
- the application configuration unit includes a user group acquisition subunit, a query subunit, and a configuration subunit.
- the user group acquisition subunit is configured to obtain user group information of the application according to the target identifier.
- the query subunit is used to query the process identifier that has a mapping relationship with the user group information.
- a configuration sub-unit configured to configure a process that matches the process ID to a resource usage priority corresponding to the changed resource restriction level.
- resources can be restricted from multiple dimensions such as threads, processes, and applications, and resource management can be implemented comprehensively and flexibly, system performance is optimized, and power consumption is saved.
- the resource management device 900 includes an identifier acquisition module 910, a category determination module 920, and a configuration module 930, and an acquisition module, an analysis module, and an analysis module.
- the acquisition module is configured to collect event data of each application, each process, and each thread running through the kernel space, and package the event data into a data packet and transmit the data to the user space.
- the parsing module is configured to parse the data packet through the user space to obtain event data.
- the analysis module is configured to analyze the event data by using a user space, determine a target identifier for performing a resource restriction level change, and a changed resource restriction level.
- the analyzing module is further configured to analyze the event data by using a user space, and when detecting that the application or the process does not have a communication event within a preset time period, increasing a resource restriction level of the application or process that does not have a communication event occurs. .
- the analyzing module is further configured to reduce a resource restriction level of the application or process in which the communication event occurs when detecting that the application or process has a communication event.
- the analysis module is further configured to analyze the event data by using a user space, and when detecting that the thread is performing the rendering task, reduce a resource restriction level of the thread that is performing the rendering task.
- the event data of each application, each process, and each thread can be collected through the kernel space, and the collected event data is transmitted to the user space for analysis, which can provide more clue basis for resource limitation level change, and can be
- the resource restriction level adjustment of threads, processes, and applications is more accurate, improving resource management effects and system performance.
- 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:
- the target corresponding to the target identifier is configured as the resource usage priority corresponding to the changed resource restriction level according to the setting manner corresponding to the target type.
- 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)
- Mobile Radio Communication Systems (AREA)
- Telephone Function (AREA)
Abstract
Description
相关申请的交叉引用Cross-reference to related applications
本申请要求于2017年12月29日提交中国专利局、申请号为201711488929.3、发明名称为“资源管理方法、装置、移动终端及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application filed on Dec. 29, 2017, the Chinese Patent Application No. 201711488929.3, entitled "Resource Management Methods, Devices, Mobile Terminals, and Computer Readable Storage Media", the entire contents of which are incorporated herein by reference. This is incorporated herein by reference.
本申请涉及计算机技术领域,特别是涉及一种资源管理方法、移动终端及计算机可读存储介质。The present application relates to the field of computer technologies, and in particular, to a resource management method, a mobile terminal, and a computer readable storage medium.
随着互联网的飞速发展,智能移动终端已经成为许多用户最常用的电子设备,例如智能手机、平板电板等。用户可在智能移动终端上安装各式的应用程序进行使用,当应用程序在后台进行运行时,会与前台运行的应用程序抢占CPU(Central Processing Unit,中央处理器)、内存、带宽等系统资源,导致出现前台运行的应用卡顿、系统运行缓慢及移动终端发热等问题。With the rapid development of the Internet, smart mobile terminals have become the most commonly used electronic devices for many users, such as smart phones and tablet boards. Users can install various applications on the smart mobile terminal for use. When the application runs in the background, it will preempt the CPU (Central Processing Unit), memory, bandwidth and other system resources with the application running in the foreground. This leads to problems such as the application running in the foreground, the slow operation of the system, and the fever of the mobile terminal.
发明内容Summary of the invention
根据本申请的各种实施例,提供一种资源管理方法、移动终端及计算机可读存储介质。According to various embodiments of the present application, a resource management method, a mobile terminal, and a computer readable storage medium are provided.
一种资源管理方法,包括:A resource management method, including:
获取进行资源限制等级更改的目标标识;Obtain the target ID for the resource restriction level change;
根据所述目标标识确定进行资源限制等级更改的目标种类,所述目标种类包括线程、进程及应用中的一种;Determining, according to the target identifier, a target category for performing a resource restriction level change, the target category including one of a thread, a process, and an application;
根据与所述目标种类对应的设置方式,将与所述目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级。The target corresponding to the target identifier is configured as a resource usage priority corresponding to the changed resource restriction level according to a setting manner corresponding to the target type.
一种移动终端,包括存储器及处理器,所述存储器中存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行以下操作:获取进行资源限制等级更改的目标标识;根据所述目标标识确定进行资源限制等级更改的目标种类,所述目标种类包括线程、进程及应用中的一种;根据与所述目标种类对应的设置方式,将与所述目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级。A mobile terminal includes a memory and a processor, wherein the memory stores a computer program, when the computer program is executed by the processor, causing the processor to perform an operation of: acquiring a target identifier for performing resource restriction level change Determining, according to the target identifier, a target category for performing a resource restriction level change, the target category including one of a thread, a process, and an application; and corresponding to the target identifier according to a setting manner corresponding to the target category The target is configured as a resource usage priority corresponding to the changed resource restriction level.
一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时,使得处理器执行以下操作:获取进行资源限制等级更改的目标标识;根据所述目标标识确定进行资源限制等级更改的目标种类,所述目标种类包括线程、进程及应用中的一种;根据与所述目标种类对应的设置方式,将与所述目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级。A computer readable storage medium having stored thereon a computer program, the computer program being executed by a processor, causing a processor to: acquire a target identifier for performing a resource restriction level change; and determine to perform a resource according to the target identifier Restricting the target type of the level change, the target category includes one of a thread, a process, and an application; configuring the target corresponding to the target identifier to be the changed resource limit according to a setting manner corresponding to the target category The resource usage priority corresponding to the level.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。Details of one or more embodiments of the present application are set forth in the accompanying drawings and description below. Other features, objects, and advantages of the invention will be apparent from the description and appended claims.
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any creative work.
图1为一个实施例中移动终端的框图。1 is a block diagram of a mobile terminal in one embodiment.
图2为一个实施例中资源管理方法的系统架构图。2 is a system architecture diagram of a resource management method in an embodiment.
图3为一个实施例中资源管理方法的流程示意图。FIG. 3 is a schematic flow chart of a resource management method in an embodiment.
图4为一个实施例中资源组别的示意图。4 is a schematic diagram of a resource group in an embodiment.
图5为一个实施例中根据目标种类配置资源使用优先级的流程示意图。FIG. 5 is a schematic diagram of a process of configuring resource usage priorities according to target types in an embodiment.
图6为一个实施例中对应用配置资源使用优先级的流程示意图。FIG. 6 is a schematic flowchart of configuring resource usage priority for an application in an embodiment.
图7为一个实施例中从线程、进程及应用等多个维度进行资源限制的示意图。FIG. 7 is a schematic diagram of resource limitation from multiple dimensions such as threads, processes, and applications in one embodiment.
图8为一个实施例中确定进行资源限制等级更改目标标识及更改后的资源限制等级的流程示意图。FIG. 8 is a schematic flowchart of determining a resource restriction level change target identifier and a changed resource restriction level in one embodiment.
图9为一个实施例中资源管理装置的框图。Figure 9 is a block diagram of a resource management device in one embodiment.
图10为另一个实施例中移动终端的框图。Figure 10 is a block diagram of a mobile terminal in another embodiment.
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。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.
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一客户端称为第二客户端,且类似地,可将第二客户端称为第一客户端。第一客户端和第二客户端两者都是客户端,但其不是同一客户端。It will be understood that the terms "first", "second" and the like, as used herein, may be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, a first client may be referred to as a second client, and similarly, a 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.
图1为一个实施例中移动终端的框图。如图1所示,该移动终端包括通过系统总线连接的处理器、存储器、显示屏和输入装置。其中,存储器可包括非易失性存储介质及处理器。移动终端的非易失性存储介质存储有操作系统及计算机程序,该计算机程序被处理器执行时以实现本申请实施例中提供的一种资源管理方法。该处理器用于提供计算和控制能力,支撑整个移动终端的运行。移动终端中的内存储器为非易失性存储介质中的计算机程序的运行提供环境。移动终端的显示屏可以是液晶显示屏或者电子墨水显示屏等,输入装置可以是显示屏上覆盖的触摸层,也可以是移动终端外壳上设置的按键、轨迹球或触控板,也可以是外接的键盘、触控板或鼠标等。该移动终端可以是手机、平板电脑或者个人数字助理或穿戴式设备等。本领域技术人员可以理解,图1中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的移动终端的限定,具体的移动终端可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。1 is a block diagram of a mobile terminal in one embodiment. As shown in FIG. 1, 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. 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 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.
图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。2 is a system architecture diagram of a resource management method in an embodiment. As shown in FIG. 2, the system architecture includes a JAVA
内核空间层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可用于解决出现冻结超时场景产生的异常。通过上述的系统架构,可实现本申请各个实施例中的资源管理方法。The
如图3所示,在一个实施例中,提供一种资源管理方法,包括以下操作:As shown in FIG. 3, in an embodiment, a resource management method is provided, including the following operations:
操作310,获取进行资源限制等级更改的目标标识。
移动终端可同时运行有一个或多个应用程序,一个应用程序下可运行有一个或多个进程,一个进程下又可运行有一个或多个线程。进程是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位,是操作系统结构的基础。线程也可被称为轻量级进程(Lightweight Process,LWP),是程序执行流的最小单元,线程是进程中的一个实体,是被系统独立调度和分派的基本单位。A mobile terminal can run one or more applications at the same time. One application can run one or more processes, and one process can run one or more threads. 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. A thread can also be called a Lightweight Process (LWP), which is the smallest unit of a program execution flow. A thread is an entity in a process and is the basic unit that is independently scheduled and dispatched by the system.
移动终端可根据实际需求设定不同的资源限制等级,资源限制等级可用于表示使用资源被限制的程度,资源限制等级越高,受限制的程度可越大。受限制的资源可包括但不限于CPU资源、内存资源、I/O资源、网络资源等。不同的资源限制等级可对应不同的资源使用优先级,资源限制等级越高,对应的资源使用优先级可越小,资源限制等级越低,对应的资源使用优先级可越大。在一个实施例中,移动终端设定的资源限制等级可包括无限制级别、普通限制级别、深度限制级别及冻结级别。无限制级别可指的是应用、进程或线程等使用的资源不受限制,比如前台运行的应用或进程等可对应无限制级别,从而保证前台应用或进程等的正常运行。普通限制级别可指的是应用、进程或线程等可使用较少的资源,比如最多仅可使用50%的资源等,但不限于此。深度限制级别可指的是应用、进程或线程等可使用极少的资源,比如最多仅可使用20%的资源等,但不限于此。冻结级别指的是应用、进程或线程等无法使用任何的资源,停止应用、进程或线程等的一切行为。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 resource usage 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. Different resource restriction levels may correspond to different resource usage priorities. The higher the resource restriction level, the smaller the corresponding resource usage priority, and the lower the resource restriction level, the greater the corresponding resource usage priority. In an embodiment, 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 resources used by an application, a process, or a thread are not limited. For example, an application or a process running in the foreground can correspond to an unrestricted level, thereby ensuring normal operation of a foreground application or a process. The normal restriction level may refer to applications, processes, threads, etc., which may use less resources, such as up to 50% of resources, but are not limited thereto. The depth limit level may refer to applications, processes, or threads that use very few resources, such as up to 20% of resources, but are not limited thereto. The freeze level refers to any behavior that cannot be used by an application, process, or thread to stop an application, process, or thread.
可选地,移动终端可对运行的各个应用、各个进程及各个线程进行监控,采集各个应用、各个进程及各个线程的运行特征,并根据运行特征确定各个应用、各个进程及各个线程的资源限制等级。运行特征可包括但不限于运行状态、当前执行的任务、通信事件、当前占用的资源类型及比例等,其中,运行状态可包括前台运行及后台运行,通信事件指的是进程之间进行的通信,比如socket、binder通信等。Optionally, the mobile terminal can monitor each application, each process, and each thread, collect the running characteristics of each application, each process, and each thread, and determine resource limits of each application, each process, and each thread according to the running characteristics. grade. The running characteristics may include, but are not limited to, an operating state, a currently executed task, a communication event, a currently occupied resource type and a proportion, etc., wherein the running state may include foreground running and background running, and the communication event refers to communication between processes Such as socket, binder communication, etc.
可选地,移动终端可每隔一定时间段采集各个应用、各个进程及各个线程的运行特征,并根据运行特征判断是否需要对应用、进程或线程的资源限制等级进行更改,比如当应用从前台运行切换为后台运行时,可提高该应用的资源限制等级,或是当进程接收到其他进程发送的通信消息时,可降低该进程的资源限制等级等,但不限于此。当需要进行资源限制等级更改时,移动终端可获取进行资源限制等级更改的目标标识,该目标标识可用于标 识进行资源限制等级更改的目标,该目标可以是应用、进程或线程等。目标标识可以由数字、字母及符号等中的一种或多种组成。Optionally, the mobile terminal may collect running characteristics of each application, each process, and each thread at a certain time period, and determine, according to the running characteristics, whether the resource restriction level of the application, the process, or the thread needs to be changed, for example, when the application is from the foreground. When the operation is switched to run in the background, the resource restriction level of the application may be increased, or when the process receives the communication message sent by other processes, the resource restriction level of the process may be lowered, but is not limited thereto. When a resource restriction level change is required, the mobile terminal can obtain a target identifier for making a resource restriction level change, and the target identifier can be used to identify a target for resource restriction level change, which can be an application, a process, a thread, and the like. The target identifier may be composed of one or more of numbers, letters, symbols, and the like.
操作320,根据目标标识确定进行资源限制等级更改的目标种类,目标种类包括线程、进程及应用中的一种。
移动终端获取进行资源限制等级的目标标识,可对目标标识进行解析,确定进行资源限制等级更改的目标及该目标所属的目标种类。目标种类可以是线程、进程及应用等中的一种。可选地,不同目标种类的目标标识可对应不同的格式,例如,线程、进程及应用的标识可分别对应不同个数的数字,比如线程标识对应8位数、进程标识对应9位数、应用标识对应10位数等,或是进程、进程及应用的标识中携带有对应的字符,比如线程标识在第一位的字母为T,进程标识在第一位的字母为P,应用标识在第一位的字母为A等,但不限于此。The mobile terminal acquires the target identifier for performing the resource restriction level, and can parse the target identifier, determine the target for which the resource restriction level is changed, and the target type to which the target belongs. The target type can be one of a thread, a process, an application, and the like. Optionally, the target identifiers of different target categories may correspond to different formats. For example, the identifiers of threads, processes, and applications may respectively correspond to different numbers, for example, the thread identifier corresponds to 8 digits, the process identifier corresponds to 9 digits, and the application The identifier corresponds to 10 digits, etc., or the identifier of the process, process, and application carries the corresponding character. For example, the letter of the thread identifier in the first digit is T, the letter of the process identifier in the first digit is P, and the application identifier is in the first One letter is A, etc., but is not limited to this.
操作330,根据与目标种类对应的设置方式,将与目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级。In
移动终端确定进行资源限制等级更改的目标种类后,可获取与目标种类对应的设置方式,将与目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级。应用、进程及线程可分别对应不同的资源使用优先级设置方式。例如,目标种类为线程,移动终端可先获取运行的各个线程,并根据目标标识查询需要进行资源限制等级更改的目标线程,再将目标线程配置为与更改后的资源限制等级对应的资源使用优先级。目标种类为进程,移动终端可选获取运行的各个进程,并根据目标标识查询需要进行资源限制等级更改的目标进程,可再获取该目标进程下运行的所有线程,将该目标进程下运行所有线程配置为与更改后的资源限制等级对应的资源使用优先级,从而实现将该目标进程配置为与更改后的资源限制等级对应的资源使用优先级等,但不限于此。可以理解地,应用、进程及线程也可分别对应其他的设置,比如目标种类为进程,移动终端也可直接根据目标标识获取目标进程,并将该目标进程配置为与更改后的资源限制等级对应的资源使用优先级等。After determining the target type of the resource restriction level change, the mobile terminal may obtain a setting manner corresponding to the target type, and configure the target corresponding to the target identifier as the resource use priority corresponding to the changed resource restriction level. Applications, processes, and threads can be assigned to different resource usage priority settings. For example, the target type is a thread, and the mobile terminal may first obtain each thread that runs, and query a target thread that needs to perform a resource restriction level change according to the target identifier, and then configure the target thread to use the resource priority corresponding to the changed resource restriction level. level. The target type is a process, and the mobile terminal optionally obtains each running process, and queries the target process that needs to perform the resource restriction level change according to the target identifier, and then acquires all threads running under the target process, and runs all threads under the target process. The resource usage priority corresponding to the changed resource restriction level is configured to implement the target process as the resource usage priority corresponding to the changed resource restriction level, but is not limited thereto. It can be understood that the application, the process, and the thread can also respectively correspond to other settings, for example, the target type is a process, and the mobile terminal can directly obtain the target process according to the target identifier, and configure the target process to correspond to the changed resource restriction level. Resource usage priority, etc.
在一个实施例中,移动终端可将与目标标识对应的目标添加到与更改后的资源限制等级对应的资源组别中,并配置与资源组别对应的资源使用优先级。可选地,移动终端可基于内核Cgroup(control group)机制划分不同的资源组别,并可采用文件节点写配置的方式设置各个资源组别的资源使用优先级,对被分配到各个资源组别中的应用、进程或线程等使用资源的时间或比例等进行管理,其中,Cgroup是内核中提供的一种可以限制、记录、隔离应用、进程或线程等所使用的物理资源(比如:CPU、内存、I/O等资源)的机制。移动终端可加载Cgroup的配置文件,配置文件中可记录有划分的资源组别、各个资源组的资源使用优先级及与资源使用优先级对应的资源调度策略。资源调度策略可包括但不限于被分配到资源组别中的应用、进程或线程等使用资源的时间、占用资源比例、使用的资源标识等,例如,可配置普通限制级别对应的资源组别的应用、进程或线程等在1分钟内可使用30秒的CPU资源,且普通限制级别对应的资源组别的应用、进程或线程等仅能使用编号为X的CPU资源等,但不限于此。当需要添加新的资源组别,或是修改资源组别的资源使用优先级及资源调度策略,可通过修改Cgroup的配置文件。In an embodiment, the mobile terminal may add a target corresponding to the target identifier to a resource group corresponding to the changed resource restriction level, and configure a resource usage priority corresponding to the resource group. Optionally, 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 is allocated to each resource group. The application, process, or thread manages the time or proportion of resources, etc., where Cgroup is a physical resource that can be used to limit, record, and isolate applications, processes, or threads (such as CPU, The mechanism of memory, I / O and other resources). 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, an application, a process, a thread, or the like, which is allocated to the resource group, a time when the resource is used, a proportion of the occupied resource, a resource identifier used, and the like. For example, the resource group corresponding to the common restriction level may be configured. An application, a process, a thread, or the like can use 30 seconds of CPU resources in one minute, and an application, a process, or a thread of a resource group corresponding to a common restriction level can use only CPU resources numbered X, but is not limited thereto. When you need to add a new resource group, or modify the resource usage priority and resource scheduling policy of the resource group, you can modify the Cgroup configuration file.
图4为一个实施例中资源组别的示意图。如图4所示,移动终端中可设定有四个不同的资源限制等级,并划分有四个资源组别,其中,第一资源组别对应无限制级别,第二资源组别对应普通限制级别,第三资源组别对应深度限制级别,第四资源组别对应冻结级别。四个资源组别可分别对应不同的资源使用优先级,第一资源组别的资源使用优先级可高于第二资源组别,第二资源组别的资源使用优先级可高于第三资源组别,第三资源组别的资源使用优先级可高于第四资源组别。无限制级别的第一资源组别不限制应用、进程或线程等使用的CPU、内存、I/O及网络等资源。普通限制级别的第二资源组别限制应用、进程或线程等可使用较少的CPU、内存、I/O及网络等资源。深度限制级别的第三资源组别限 制应用、进程或线程等可使用极少的CPU、内存、I/O及网络等资源。冻结级别的第四资源组别限制应用、进程或线程等不可使用CPU、内存、I/O及网络等资源。移动终端可根据各个应用、进程或线程等的运行特征,对应用、进程及线程等的资源限制级别进行更改调整,并将应用、进程及线程等分配到相应的资源组别中,配置与资源组别对应的资源使用优先级,对各个运行的应用、进程及线程等使用的资源进行管理。4 is a schematic diagram of a resource group in an embodiment. As shown in FIG. 4, four different resource restriction levels can be set in the mobile terminal, and four resource groups are divided, wherein the first resource group corresponds to an unrestricted level, and the second resource group corresponds to an ordinary limit. Level, the third resource group corresponds to the depth limit level, and the fourth resource group corresponds to the freeze level. The four resource groups may respectively correspond to different resource usage priorities, the resource usage priority of the first resource group may be higher than the second resource group, and the resource usage priority of the second resource group may be higher than the third resource. In the group, the resource usage priority of the third resource group may be higher than the fourth resource group. The first resource group at an unrestricted level does not limit resources such as CPU, memory, I/O, and network used by applications, processes, or threads. The second resource group of the general restriction level limits applications such as CPU, memory, I/O, and network to applications, processes, or threads. The third resource group at the depth limit level limits the use of resources such as CPU, memory, I/O, and network to applications, processes, or threads. The fourth resource group at the freeze level restricts applications such as CPU, memory, I/O, and network from being used by applications, processes, or threads. The mobile terminal can change and adjust the resource restriction levels of applications, processes, and threads according to the running characteristics of each application, process, or thread, and allocate applications, processes, and threads to corresponding resource groups, configurations, and resources. The resource usage priority corresponding to the group manages the resources used by each running application, process, and thread.
在本实施例中,获取进行资源限制等级更改的目标标识,根据目标标识确定进行资源限制等级更改的目标种类,目标种类可包括线程、进程及应用等中的一种,再根据与目标种类对应的设置方式,将与目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级,可以从线程、进程及应用等多个维度进行资源限制,全面、灵活地实现资源管理,优化系统性能,节省功耗。In this embodiment, the target identifier for performing the resource restriction level change is obtained, and the target type for performing the resource restriction level change is determined according to the target identifier, and the target category may include one of a thread, a process, and an application, and then according to the target category. The setting method is configured to configure the target corresponding to the target identifier as the resource usage priority corresponding to the changed resource restriction level, and can perform resource limitation from multiple dimensions such as threads, processes, and applications, and implement resource management comprehensively and flexibly. Optimize system performance and save power.
如图5所示,在一个实施例中,操作330根据与目标种类对应的设置方式,将与目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级,包括以下操作:As shown in FIG. 5, in an embodiment, the
操作502,当目标种类为线程时,将与目标标识对应的线程配置为与更改后的资源限制等级对应的资源使用优先级。In
移动终端根据进行资源限制等级更改的目标标识确定目标种类,当该目标种类为线程时,移动终端可获取当前运行的所有线程,并根据目标标识查询需要进行资源限制等级更改的目标线程,并将该目标线程添加到与更改后的资源限制等级对应的资源组别中,配置与该资源组别对应的资源使用优先级。目标线程被分配到与更改后的资源限制等级对应的资源组别后,可按照预设的与该资源组别对应的资源调度策略使用CPU、I/O、内存及网络等资源。The mobile terminal determines the target type according to the target identifier that performs the resource restriction level change. When the target category is a thread, the mobile terminal may acquire all the currently running threads, and query the target thread that needs to perform the resource restriction level change according to the target identifier, and The target thread is added to the resource group corresponding to the changed resource restriction level, and the resource usage priority corresponding to the resource group is configured. After the target thread is assigned to the resource group corresponding to the changed resource restriction level, resources such as CPU, I/O, memory, and network may be used according to a preset resource scheduling policy corresponding to the resource group.
操作504,当目标种类为进程时,将与目标标识对应的进程包含的各个线程配置为与更改后的资源限制等级对应的资源使用优先级。In
移动终端根据进行资源限制等级更改的目标标识确定目标种类,当该目标种类为进程时,移动终端可获取当前运行的各个进程,并根据目标标识查询需要进行资源限制等级更改的目标进程。移动终端可将目标进程添加到与更改后的资源限制等级对应的资源组别中,并配置与该资源组别对应的资源使用优先级。The mobile terminal determines the target type according to the target identifier that performs the resource restriction level change. When the target category is a process, the mobile terminal may acquire each currently running process, and query the target process that needs to perform the resource restriction level change according to the target identifier. The mobile terminal may add the target process to the resource group corresponding to the changed resource restriction level, and configure the resource usage priority corresponding to the resource group.
可选地,移动终端获取目标进程后,可获取该目标进程下运行的所有线程,并将该目标进程下运行的所有线程添加到与更改后的资源限制等级对应的资源组别中,配置与该资源组别对应的资源使用优先级。对目标进程下运行的所有线程配置与更改后的资源限制等级对应的资源使用优先级,从而可实现配置该目标进程为与更改后的资源限制等级对应的资源使用优先级的目的。目标进程被分配到与更改后的资源限制等级对应的资源组别后,可按照预设的与该资源组别对应的资源调度策略使用CPU、I/O、内存及网络等资源,进一步地,该目标进程包含的所有线程均可按照该对应的资源调度策略使用资源。Optionally, after acquiring the target process, the mobile terminal may acquire all threads running under the target process, and add all threads running under the target process to the resource group corresponding to the changed resource restriction level, and configure and The resource usage priority corresponding to the resource group. All the threads running under the target process are configured with the resource usage priority corresponding to the changed resource restriction level, so that the target process can be configured to be the resource usage priority corresponding to the changed resource restriction level. After the target process is assigned to the resource group corresponding to the changed resource restriction level, resources such as CPU, I/O, memory, and network may be used according to a preset resource scheduling policy corresponding to the resource group. Further, All threads included in the target process can use resources according to the corresponding resource scheduling policy.
操作506,当目标种类为应用时,将与目标标识对应的应用包含的各个进程配置为与更改后的资源限制等级对应的资源使用优先级。In
移动终端根据进行资源限制等级更改的目标标识确定目标种类,当该目标种类为应用时,移动终端可获取当前运行的各个应用,并根据目标标识查询需要进行资源限制等级更改的目标应用。移动终端可将目标应用添加到与更改后的资源限制等级对应的资源组别中,并配置与该资源组别对应的资源使用优先级。可选地,移动终端获取目标应用后,可获取该目标应用下运行的所有进程,并将该目标应用下运行的所有进程添加到与更改后的资源限制等级对应的资源组别中,配置与该资源组别对应的资源使用优先级。The mobile terminal determines the target category according to the target identifier that changes the resource restriction level. When the target category is an application, the mobile terminal may obtain each application that is currently running, and query the target application that needs to perform the resource restriction level change according to the target identifier. The mobile terminal may add the target application to the resource group corresponding to the changed resource restriction level, and configure the resource usage priority corresponding to the resource group. Optionally, after acquiring the target application, the mobile terminal may acquire all the processes running in the target application, and add all the processes running in the target application to the resource group corresponding to the changed resource restriction level, and configure and The resource usage priority corresponding to the resource group.
如图6所示,在一个实施例中,操作将与目标标识对应的应用包含的各个进程配置为与更改后的资源限制等级对应的资源使用优先级,包括以下操作:As shown in FIG. 6, in one embodiment, the operation configures each process included in the application corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level, and includes the following operations:
操作602,根据目标标识获取应用的用户组信息。Operation 602: Acquire user group information of the application according to the target identifier.
应用程序进行运行时,移动终端可为运行的应用程序分配不同的用户组,可通过用户 组管理应用程序的权限等。移动终端根据目标标识获取进行资源等级更改的目标应用后,可获取该目标应用的用户组信息,并根据用户组信息获取该目标应用下运行的各个进程。用户组信息可包括用户组标识等,其中,用户组标识可以由数字、字母及符号等中的一种或多种进行构成。When the application is running, 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. After obtaining the target application for performing the resource level change according to the target identifier, the mobile terminal obtains the user group information of the target application, and obtains each process running under the target application according to the user group information. The user group information may include a user group identifier or the like, wherein the user group identifier may be composed of one or more of numbers, letters, symbols, and the like.
操作604,查询与用户组信息具备映射关系的进程标识。
移动终端可根据目标应用的用户组信息查询与用户组信息具备映射关系的进程标识,从而得到目标应用下运行的各个进程。移动终端的内核空间层可实时对进程所属的用户组信息进行收集,当进程创建或销毁时,内核可对进程所属的用户组信息进行分配及释放等,进程在运行的过程中,也可以发生用户组信息改变的情况。内核空间层实时对各个进程所属的用户组信息进行收集,并可建立进程标识、进程名称等进程信息与用户组信息的映射关系。当移动终端需要更改目标应用的资源限制等级时,可根据目标应用的用户组信息直接查询具备映射关系的进程标识,相比起遍历所有运行的进程从而找到目标应用下运行的进程,直接查找与用户组信息具备映射关系的进程标识更加方便快捷。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 target application, thereby obtaining each process running under the target 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. When the mobile terminal needs to change the resource restriction level of the target application, the process identifier with the mapping relationship may be directly queried according to the user group information of the target application, and the process running under the target 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.
操作606,将与进程标识匹配的进程配置为与更改后的资源限制等级对应的资源使用优先级。Operation 606, the process matching the process identifier is configured as a resource usage priority corresponding to the changed resource restriction level.
移动终端根据目标应用的用户组信息查询到具备映射关系的进程标识后,可根据进程标识获取目标应用下运行的所有进程。移动终端可将目标应用下运行的所有进程添加到与更改后的资源限制等级对应的资源组别中,并对目标应用下运行的所有进程配置与更改后的资源限制等级对应的资源使用优先级,从而可实现配置该目标应用为与更改后的资源限制等级对应的资源使用优先级的目的。目标应用被分配到与更改后的资源限制等级对应的资源组别后,可按照预设的与该资源组别对应的资源调度策略使用CPU、I/O、内存及网络等资源,进一步地,该目标应用包含的所有进程均可按照该对应的资源调度策略使用资源。After the mobile terminal queries the process identifier with the mapping relationship according to the user group information of the target application, all processes running under the target application can be obtained according to the process identifier. The mobile terminal may add all processes running under the target application to the resource group corresponding to the changed resource restriction level, and configure resource usage priorities corresponding to the changed resource restriction level for all processes running under the target application. , so that the purpose of configuring the target application as the resource usage priority corresponding to the changed resource restriction level can be achieved. After the target application is assigned to the resource group corresponding to the changed resource restriction level, the resource scheduling policy corresponding to the resource group may be used to use resources such as CPU, I/O, memory, and network. Further, All processes included in the target application can use resources according to the corresponding resource scheduling policy.
图7为一个实施例中从线程、进程及应用等多个维度进行资源限制的示意图。如图7所示,一个应用下可包括有一个或多个进程,一个进程下可包括有一个或多个线程。移动终端对应用的资源使用优先级进行配置,可通过配置该应用下包含的各个进程的资源使用优先级进行实现。移动终端对进程的资源使用优先级进行配置,可通过配置该进程下包含的各个线程的资源使用优先级进行实现。移动终端也可单独对某一个线程的资源使用优先级进行配置,可以从应用、进程及线程等多个维度配置资源使用优先级,对资源使用进行限制。FIG. 7 is a schematic diagram of resource limitation from multiple dimensions such as threads, processes, and applications in one embodiment. As shown in FIG. 7, an application may include one or more processes, and one process may include one or more threads. The mobile terminal configures the resource usage priority of the application, and can implement the resource usage priority of each process included in the application. The mobile terminal configures the resource usage priority of the process, and can implement the resource usage priority of each thread included in the process. The mobile terminal can also separately configure the resource usage priority of a certain thread, and can configure resource usage priorities from multiple dimensions such as applications, processes, and threads, and limit resource usage.
在本实施例中,移动终端可以从线程、进程及应用等多个维度进行资源限制,全面、灵活地实现资源管理,优化系统性能,节省功耗。In this embodiment, the mobile terminal can perform resource limitation from multiple dimensions such as threads, processes, and applications, comprehensively and flexibly implement resource management, optimize system performance, and save power consumption.
如图8所示,在一个实施例中,在操作310获取进行资源限制等级更改的目标标识之前,还包括以下操作:As shown in FIG. 8, in one embodiment, before the
操作802,通过内核空间采集运行的各个应用、各个进程及各个线程的事件数据,并将事件数据打包成数据包传送给用户空间。
移动终端的虚拟空间中可包括有内核空间及用户空间,内核空间可用于存放内核的代码和数据,用户空间可用于存放应用程序的代码和数据。内核空间拥有较高的特权级别,在内核空间中运行的进程可拥有访问移动终端的所有硬件的权限,用户空间的权限则较低,在用户空间中运行的进程仅可使用系统的部分资源。The virtual space of the mobile terminal may include kernel space and user space, the kernel space may be used to store the code and data of the kernel, and the user space may be used to store the code and data of the application. Kernel space has a high privilege level. Processes running in kernel space can have access to all hardware of the mobile terminal. User space has lower permissions. Processes running in user space can only use some resources of the system.
移动终端可通过内核空间采集运行的各个应用、各个进程及各个线程的事件数据,事件数据可包括但不限于事件类型、事件时间、事件内容、事件所属的目标标识等。事件类型可包括但不限于通信事件、创建事件、退出事件、更改标识事件、任务事件等。通信事件可包括binder通信事件及socket通信事件等,其中,binder是一种进程间通信机制,可提供远程过程调用功能;网络上的两个程序通过一个双向的通信连接实现数据的交换, 这个连接的一端称为一个socket。创建事件可指的是进程或线程等被创建的事件。退出事件指的是应用、进程或线程等退出的事件。更改标识事件可指的是进程或线程等更改自身的标识等。任务事件可指的是应用、进程或线程等执行的任务等。The mobile terminal can collect event data of each application running, each process, and each thread through the kernel space, and the event data may include, but is not limited to, an event type, an event time, an event content, a target identifier to which the event belongs, and the like. Event types may include, but are not limited to, communication events, creation events, exit events, change identification events, task events, and the like. The communication event may include a binder communication event and a socket communication event, wherein the binder is an inter-process communication mechanism that provides a remote procedure call function; the two programs on the network exchange data through a two-way communication connection, the connection One end is called a socket. Creating an event can refer to an event created by a process or thread. An exit event refers to an event that is exited by an application, process, or thread. A change identification event can refer to a process or a thread that changes its own identity, and the like. A task event can refer to a task, such as an application, a process, or a thread.
可选地,移动终端针对不同的应用、进程或线程等采集对象,可采集不同事件类型的事件数据。移动终端可预先制定采集的事件类型及对应的采集对象标识,例如,可预先制定采集binder通信事件应用或进程等,也可预先制定采集socket通信事件的应用或进程等。不同事件类型可分别对应不同的采集对象标识。Optionally, the mobile terminal collects objects for different applications, processes, threads, and the like, and collects event data of different event types. The mobile terminal may pre-determine the type of the collected event and the corresponding collection object identifier. For example, the application or process of collecting the binder communication event may be pre-defined, or the application or process for collecting the socket communication event may be pre-defined. Different event types can respectively correspond to different collection object identifiers.
移动终端通过内核空间采集运行的各个应用、各个进程及各个线程的事件数据,可按照约定的包格式将事件数据打包成数据包,并将数据包传送给用户空间。可选地,内核空间与用户空间可采用异步的netlink的方式进行通信,netlink是一种可以实现用户进程与内核进程通信的一种特殊的进程间通信。内核空间通过异步通信的方式将事件数据传输给用户空间,相比起用户空间主动查询的方式,更加快捷方便,可提高事件数据的传输效率。The mobile terminal collects event data of each application running, each process, and each thread through the kernel space, and can package the event data into a data packet according to the agreed packet format, and transmit the data packet to the user space. Optionally, the kernel space and the user space can communicate by means of an asynchronous netlink, which is a special inter-process communication that enables the user process to communicate with the kernel process. The kernel space transmits the event data to the user space by means of asynchronous communication, which is faster and more convenient than the active query mode of the user space, and can improve the transmission efficiency of the event data.
操作804,通过用户空间解析数据包,得到事件数据。
操作806,通过用户空间对事件数据进行分析,确定进行资源限制等级更改的目标标识,以及更改后的资源限制等级。
用户空间接收到内核空间传输的数据包后,可对数据包进行解析,得到事件数据。移动终端可通过用户空间对事件数据进行分析,确定需要进行资源限制等级更改的目标标识。可选地,用户空间可对事件数据中的事件类型、事件内容等进行分析,从而判断事件所属的目标标识是否需要进行资源限制等级更改。After receiving the data packet transmitted by the kernel space, the user space can parse the data packet to obtain event data. The mobile terminal can analyze the event data through the user space to determine the target identifier that needs to be changed by the resource restriction level. Optionally, the user space may analyze the event type, the event content, and the like in the event data, so as to determine whether the target identifier to which the event belongs needs to be changed by the resource restriction level.
在一个实施例中,移动终端通过用户空间对事件数据进行分析,当检测到应用或进程在预设时间段内没有发生binder及socket等通信事件时,可提高没有发生通信事件的应用或进程的资源限制等级,降低该应用或进程的资源使用优先级。移动终端可确定预设时间段内没有发生通信事件的应用或进程的标识为目标标识,并确定提高后的资源限制等级。可选地,当用户空间检测到应用或进程在预设时间段内没有发生binder及socket等通信事件时,可先获取没有发生通信事件的应用或进程当前的资源限制等级,当没有发生通信事件的应用或进程当前的资源限制等级为冻结级别时,可不更改资源限制等级。当没有发生通信事件的应用或进程当前的资源限制等级不是冻结级别时,可提高没有发生通信事件的应用或进程的资源限制等级,将该应用或进程的资源限制级别更改为冻结级别。In an embodiment, the mobile terminal analyzes the event data through the user space, and when detecting that the application or the process does not have a communication event such as a binder or a socket within a preset time period, the application or process that does not have a communication event may be improved. The resource restriction level reduces the resource usage priority of the application or process. The mobile terminal may determine that the identifier of the application or process in which the communication event has not occurred within the preset time period is the target identifier, and determine the increased resource restriction level. Optionally, when the user space detects that the application or the process does not have a communication event such as a binder or a socket within a preset time period, the user may first acquire the current resource restriction level of the application or the process in which the communication event does not occur, when no communication event occurs. When the current resource limit level of an application or process is a freeze level, the resource limit level may not be changed. When the current resource restriction level of the application or process that does not have a communication event is not a freeze level, the resource restriction level of the application or process in which the communication event does not occur may be increased, and the resource restriction level of the application or process is changed to the freeze level.
在一个实施例中,当用户空间检测到应用或进程发生binder及socket等通信事件时,可降低发生通信事件的应用或进程的资源限制等级,提高该应用或进程的资源使用优先级。移动终端可确定发生通信事件的应用或进程的标识为目标标识,并确定降低后的资源限制等级。可选地,当用户空间检测到应用或进程发生binder及socket等通信事件时,可获取发生通信事件的应用或进程当前的资源限制等级。用户空间可通过事件数据判断该应用或进程是否与前台运行的应用或进程发生通信事件,当该应用或进程与前台运行的应用或进程发生通信事件,且该应用或进程当前的资源限制等级高于前台运行的应用或进程时,可降低该应用或进程的资源限制等级。进一步地,可对发生通信事件的应用或进程配置与前台运行的应用或进程相同的资源使用优先级,可保证前台运行的应用或进程得到及时响应,提高运行速度。In one embodiment, when the user space detects that a communication event such as a binder or a socket occurs in an application or process, the resource restriction level of the application or process in which the communication event occurs may be reduced, and the resource usage priority of the application or process may be increased. The mobile terminal may determine the identity of the application or process in which the communication event occurred as the target identity and determine the reduced resource restriction level. Optionally, when the user space detects that a communication event such as a binder or a socket occurs in the application or the process, the current resource restriction level of the application or the process in which the communication event occurs may be acquired. The user space can determine, by the event data, whether the application or process has a communication event with an application or process running in the foreground, when the application or process has a communication event with an application or process running in the foreground, and the current resource limit of the application or process is high. When an application or process runs in the foreground, the resource limit level of the application or process can be reduced. Further, the application or process in which the communication event occurs may be configured with the same resource usage priority as the application or process running in the foreground, so that the application or process running in the foreground can be timely responded and the running speed is improved.
在一个实施例中,移动终端通过用户空间分析事件数据,当检测到线程正在执行渲染任务时,可降低正在执行渲染任务的线程的资源限制等级,提高该线程的资源使用优先级。移动终端可通过用户空间确定该正在执行渲染任务的线程标识为目标标识,并确定降低后的资源限制等级。可选地,当用户空间检测到线程正在执行渲染任务时,可获取前台运行的进程的资源限制等级,并可将正在执行渲染任务的线程更改为与前台运行的进程相同的资源限制等级,保证渲染任务快速执行,减少出现卡顿的情况。In one embodiment, the mobile terminal analyzes the event data through the user space. When detecting that the thread is performing the rendering task, the resource restriction level of the thread that is performing the rendering task may be lowered, and the resource usage priority of the thread is increased. The mobile terminal may determine, by the user space, the thread identifier that is performing the rendering task as the target identifier, and determine the reduced resource restriction level. Optionally, when the user space detects that the thread is performing the rendering task, the resource restriction level of the process running in the foreground may be obtained, and the thread that is performing the rendering task may be changed to the same resource restriction level as the process running in the foreground, and the guarantee is guaranteed. Render tasks are executed quickly, reducing the occurrence of stuck.
在本实施例中,移动终端可通过内核空间采集各个应用、各个进程及各个线程的事件数据,并将采集的事件数据传输至用户空间进行分析,可提供更多资源限制等级更改的线索依据,可使线程、进程及应用等的资源限制等级调整更加准确,提高资源管理效果及系统性能。In this embodiment, the mobile terminal can collect event data of each application, each process, and each thread through the kernel space, and transmit the collected event data to the user space for analysis, which can provide a clue basis for more resource restriction level changes. It can make the resource restriction level adjustment of threads, processes and applications more accurate, improve resource management effect and system performance.
在一个实施例中,提供一种资源管理方法,包括以下操作:In one embodiment, a resource management method is provided, including the following operations:
操作(1),获取进行资源限制等级更改的目标标识。Operation (1), obtain the target identifier for the resource restriction level change.
可选地,在操作(1)之前,还包括:通过内核空间采集运行的各个应用、各个进程及各个线程的事件数据,并将事件数据打包成数据包传送给用户空间;通过用户空间解析所述数据包,得到事件数据;通过用户空间对事件数据进行分析,确定进行资源限制等级更改的目标标识,以及更改后的资源限制等级。Optionally, before the operation (1), the method further includes: collecting, by using a kernel space, event data of each application, each process, and each thread, and packaging the event data into a data packet and transmitting the data to the user space; The data packet is obtained, and the event data is obtained; the event data is analyzed through the user space, and the target identifier for changing the resource restriction level is determined, and the changed resource restriction level is determined.
可选地,移动终端通过用户空间对所述事件数据进行分析,确定进行资源限制等级更改的目标标识,以及更改后的资源限制等级,包括:通过用户空间分析事件数据,当检测到应用或进程在预设时间段内没有发生通信事件时,提高没有发生通信事件的应用或进程的资源限制等级;当检测到应用或进程发生通信事件时,降低发生通信事件的应用或进程的资源限制等级。Optionally, the mobile terminal analyzes the event data by using a user space, determines a target identifier for performing a resource restriction level change, and the changed resource restriction level, including: analyzing event data through the user space, when detecting an application or a process. When the communication event does not occur within the preset time period, the resource restriction level of the application or process in which the communication event does not occur is increased; when the communication event occurs when the application or process is detected, the resource restriction level of the application or process in which the communication event occurs is reduced.
可选地,移动终端通过用户空间对所述事件数据进行分析,确定进行资源限制等级更改的目标标识,以及更改后的资源限制等级,包括:通过用户空间分析事件数据,当检测到线程正在执行渲染任务时,降低正在执行渲染任务的线程的资源限制等级。Optionally, the mobile terminal analyzes the event data by using a user space, determines a target identifier for performing resource restriction level change, and the changed resource restriction level, including: analyzing event data by using user space, when detecting that the thread is executing When rendering a task, lower the resource limit level of the thread that is executing the rendering task.
操作(2),根据目标标识确定进行资源限制等级更改的目标种类,目标种类包括线程、进程及应用中的一种。Operation (2), determining a target type for performing a resource restriction level change according to the target identifier, the target category including one of a thread, a process, and an application.
操作(3),根据与目标种类对应的设置方式,将与目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级。In operation (3), the target corresponding to the target identifier is configured as a resource usage priority corresponding to the changed resource restriction level according to a setting manner corresponding to the target type.
可选地,操作(3),包括:当目标种类为线程时,将与目标标识对应的线程配置为与更改后的资源限制等级对应的资源使用优先级;当目标种类为进程时,将与目标标识对应的进程包含的各个线程配置为与更改后的资源限制等级对应的资源使用优先级;当目标种类为应用时,将与目标标识对应的应用包含的各个进程配置为与更改后的资源限制等级对应的资源使用优先级。Optionally, the operation (3) includes: configuring, when the target category is a thread, a thread corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level; when the target category is a process, Each thread included in the process corresponding to the target identifier is configured as a resource usage priority corresponding to the changed resource restriction level; when the target type is an application, each process included in the application corresponding to the target identifier is configured as the changed resource. The resource usage priority corresponding to the restriction level.
可选地,移动终端将与目标标识对应的应用包含的各个进程配置为与更改后的资源限制等级对应的资源使用优先级,包括:根据目标标识获取应用的用户组信息;查询与用户组信息具备映射关系的进程标识;将与进程标识匹配的进程配置为与更改后的资源限制等级对应的资源使用优先级。Optionally, the mobile terminal configures each process included in the application corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level, including: acquiring user group information of the application according to the target identifier; querying and user group information A process ID with a mapping relationship; a process that matches the process ID is configured as a resource usage priority corresponding to the changed resource restriction level.
可选地,操作(3),包括:将与目标标识对应的目标添加到与更改后的资源限制等级对应的资源组别中,并配置与资源组别对应的资源使用优先级。Optionally, the operation (3) includes: adding a target corresponding to the target identifier to the resource group corresponding to the changed resource restriction level, and configuring a resource usage priority corresponding to the resource group.
在本实施例中,移动终端获取进行资源限制等级更改的目标标识,根据目标标识确定进行资源限制等级更改的目标种类,目标种类可包括线程、进程及应用等中的一种,移动终端再根据与目标种类对应的设置方式,将与目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级,移动终端可以从线程、进程及应用等多个维度进行资源限制,全面、灵活地实现资源管理,优化系统性能,节省功耗。In this embodiment, the mobile terminal acquires the target identifier for performing the resource restriction level change, and determines the target type for performing the resource restriction level change according to the target identifier, and the target category may include one of a thread, a process, and an application, and the mobile terminal further The setting method corresponding to the target type configures the target corresponding to the target identifier as the resource usage priority corresponding to the changed resource restriction level, and the mobile terminal can perform resource limitation from multiple dimensions such as threads, processes, and applications, comprehensively, Flexible resource management, optimized system performance, and reduced power consumption.
应该理解的是,上述的流程示意图中的各个操作按照箭头的指示依次显示,但是这些操作并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些操作的执行并没有严格的顺序限制,这些操作可以以其它的顺序执行。而且,上述的流程示意图中的至少一部分操作可以包括多个子操作或者多个阶段,这些子操作或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子操作或者阶段的执行顺序也不必然是依次进行,而是可以与其它操作或者其它操作的子操作或者阶段的至少一部分轮流或者交替地执行。It should be understood that the operations in the above-described flowcharts are sequentially displayed in accordance with the indication of the arrows, but the 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 a part of the operations in the above flow diagram may include multiple sub-operations or multiple stages, which are not necessarily performed at the same time, but may be executed at different times, and these sub-operations or stages The order of execution 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.
如图9所示,在一个实施例中,提供一种资源管理装置900,包括标识获取模块910、种类确定模块920及配置模块930。As shown in FIG. 9 , in one embodiment, a
标识获取模块910,用于获取进行资源限制等级更改的目标标识。The
种类确定模块920,用于根据目标标识确定进行资源限制等级更改的目标种类,目标种类包括线程、进程及应用中的一种。The
配置模块930,用于根据与目标种类对应的设置方式,将与目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级。The
可选地,配置模块930,还用于将与目标标识对应的目标添加到与更改后的资源限制等级对应的资源组别中,并配置与资源组别对应的资源使用优先级。Optionally, the
在本实施例中,获取进行资源限制等级更改的目标标识,根据目标标识确定进行资源限制等级更改的目标种类,目标种类可包括线程、进程及应用等中的一种,再根据与目标种类对应的设置方式,将与目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级,可以从线程、进程及应用等多个维度进行资源限制,全面、灵活地实现资源管理,优化系统性能,节省功耗。In this embodiment, the target identifier for performing the resource restriction level change is obtained, and the target type for performing the resource restriction level change is determined according to the target identifier, and the target category may include one of a thread, a process, and an application, and then according to the target category. The setting method is configured to configure the target corresponding to the target identifier as the resource usage priority corresponding to the changed resource restriction level, and can perform resource limitation from multiple dimensions such as threads, processes, and applications, and implement resource management comprehensively and flexibly. Optimize system performance and save power.
在一个实施例中,配置模块930,包括线程配置单元、进程配置单元及应用配置单元。In one embodiment, the
线程配置单元,用于当目标种类为线程时,将与目标标识对应的线程配置为与更改后的资源限制等级对应的资源使用优先级。The thread configuration unit is configured to configure, when the target type is a thread, a thread corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level.
进程配置单元,用于当目标种类为进程时,将与目标标识对应的进程包含的各个线程配置为与更改后的资源限制等级对应的资源使用优先级。The process configuration unit is configured to configure, when the target type is a process, each thread included in the process corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level.
应用配置单元,用于当目标种类为应用时,将与目标标识对应的应用包含的各个进程配置为与更改后的资源限制等级对应的资源使用优先级。The application configuration unit is configured to configure, when the target type is an application, each process included in the application corresponding to the target identifier as a resource usage priority corresponding to the changed resource restriction level.
可选地,应用配置单元,包括用户组获取子单元、查询子单元及配置子单元。Optionally, the application configuration unit includes a user group acquisition subunit, a query subunit, and a configuration subunit.
用户组获取子单元,用于根据目标标识获取应用的用户组信息。The user group acquisition subunit is configured to obtain user group information of the application according to the target identifier.
查询子单元,用于查询与用户组信息具备映射关系的进程标识。The query subunit is used to query the process identifier that has a mapping relationship with the user group information.
配置子单元,用于将与进程标识匹配的进程配置为与更改后的资源限制等级对应的资源使用优先级。A configuration sub-unit configured to configure a process that matches the process ID to a resource usage priority corresponding to the changed resource restriction level.
在本实施例中,可以从线程、进程及应用等多个维度进行资源限制,全面、灵活地实现资源管理,优化系统性能,节省功耗。In this embodiment, resources can be restricted from multiple dimensions such as threads, processes, and applications, and resource management can be implemented comprehensively and flexibly, system performance is optimized, and power consumption is saved.
在一个实施例中,上述资源管理装置900,除了包括标识获取模块910、种类确定模块920及配置模块930,还包括采集模块、解析模块及分析模块。In one embodiment, the
采集模块,用于通过内核空间采集运行的各个应用、各个进程及各个线程的事件数据,并将事件数据打包成数据包传送给用户空间。The acquisition module is configured to collect event data of each application, each process, and each thread running through the kernel space, and package the event data into a data packet and transmit the data to the user space.
解析模块,用于通过用户空间解析数据包,得到事件数据。The parsing module is configured to parse the data packet through the user space to obtain event data.
分析模块,用于通过用户空间对所述事件数据进行分析,确定进行资源限制等级更改的目标标识,以及更改后的资源限制等级。The analysis module is configured to analyze the event data by using a user space, determine a target identifier for performing a resource restriction level change, and a changed resource restriction level.
可选地,分析模块,还用于通过用户空间分析所述事件数据,当检测到应用或进程在预设时间段内没有发生通信事件时,提高没有发生通信事件的应用或进程的资源限制等级。Optionally, the analyzing module is further configured to analyze the event data by using a user space, and when detecting that the application or the process does not have a communication event within a preset time period, increasing a resource restriction level of the application or process that does not have a communication event occurs. .
可选地,分析模块,还用于当检测到应用或进程发生通信事件时,降低发生通信事件的应用或进程的资源限制等级。Optionally, the analyzing module is further configured to reduce a resource restriction level of the application or process in which the communication event occurs when detecting that the application or process has a communication event.
可选地,分析模块,还用于通过用户空间分析所述事件数据,当检测到线程正在执行渲染任务时,降低正在执行渲染任务的线程的资源限制等级。Optionally, the analysis module is further configured to analyze the event data by using a user space, and when detecting that the thread is performing the rendering task, reduce a resource restriction level of the thread that is performing the rendering task.
在本实施例中,可通过内核空间采集各个应用、各个进程及各个线程的事件数据,并将采集的事件数据传输至用户空间进行分析,可提供更多资源限制等级更改的线索依据, 可使线程、进程及应用等的资源限制等级调整更加准确,提高资源管理效果及系统性能。In this embodiment, the event data of each application, each process, and each thread can be collected through the kernel space, and the collected event data is transmitted to the user space for analysis, which can provide more clue basis for resource limitation level change, and can be The resource restriction level adjustment of threads, processes, and applications is more accurate, improving resource management effects and system performance.
本申请实施例还提供了一种移动终端。如图10所示,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该移动终端可以为包括手机、平板电脑、个人数字助理(Personal Digital Assistant,PDA)、销售终端(Point of Sales,POS)、车载电脑、穿戴式设备等任意终端设备,以移动终端为手机为例:The embodiment of the present application further provides 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. :
图10为与本申请实施例提供的移动终端相关的手机的部分结构的框图。参考图10,手机包括:射频(Radio Frequency,RF)电路1010、存储器1020、输入单元1030、显示单元1040、传感器1050、音频电路1060、无线保真(wireless fidelity,WiFi)模块1070、处理器1080、以及电源1090等部件。本领域技术人员可以理解,图10所示的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。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. Referring to FIG. 10, the mobile phone includes: a radio frequency (RF)
其中,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)等。The
存储器1020可用于存储软件程序以及模块,处理器1080通过运行存储在存储器1020的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器1020可主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据手机的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器1020可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The
输入单元1030可用于接收输入的数字或字符信息,以及产生与手机1000的用户设置以及功能控制有关的键信号输入。具体地,输入单元1030可包括触控面板1032以及其他输入设备1034。触控面板1032,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板1032上或在触控面板1032附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板1032可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器1080,并能接收处理器1080发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板1032。除了触控面板1032,输入单元1030还可以包括其他输入设备1034。具体地,其他输入设备1034可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。The
显示单元1040可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元1040可包括显示面板1042。在一个实施例中,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板1042。在一个实施例中,触控面板1032可覆盖显示面板1042,当触控面板1032检测到在其上或附近的触摸操作后,传送给处理器1080以 确定触摸事件的类型,随后处理器1080根据触摸事件的类型在显示面板1042上提供相应的视觉输出。虽然在图10中,触控面板1032与显示面板1042是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板1032与显示面板1042集成而实现手机的输入和输出功能。The
手机1000还可包括至少一种传感器1050,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板1042的亮度,接近传感器可在手机移动到耳边时,关闭显示面板1042和/或背光。运动传感器可包括加速度传感器,通过加速度传感器可检测各个方向上加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外,手机还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。The
音频电路1060、扬声器1062和传声器1064可提供用户与手机之间的音频接口。音频电路1060可将接收到的音频数据转换后的电信号,传输到扬声器1062,由扬声器1062转换为声音信号输出;另一方面,传声器1064将收集的声音信号转换为电信号,由音频电路1060接收后转换为音频数据,再将音频数据输出处理器1080处理后,经RF电路1010可以发送给另一手机,或者将音频数据输出至存储器1020以便后续处理。
WiFi属于短距离无线传输技术,手机通过WiFi模块1070可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图10示出了WiFi模块1070,但是可以理解的是,其并不属于手机1000的必须构成,可以根据需要而省略。WiFi is a short-range wireless transmission technology. The mobile phone through the
处理器1080是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器1020内的软件程序和/或模块,以及调用存储在存储器1020内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。在一个实施例中,处理器1080可包括一个或多个处理单元。在一个实施例中,处理器1080可集成应用处理器和调制解调器,其中,应用处理器主要处理操作系统、用户界面和应用程序等;调制解调器主要处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器1080中。比如,该处理器1080可集成应用处理器和基带处理器,基带处理器与和其它外围芯片等可组成调制解调器。手机1000还包括给各个部件供电的电源1090(比如电池),优选的,电源可以通过电源管理系统与处理器1080逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The
在一个实施例中,手机1000还可以包括摄像头、蓝牙模块等。In one embodiment, the
在本申请实施例中,该移动终端所包括的处理器880执行存储在存储器上的计算机程序时实现上述的资源管理方法。In the embodiment of the present application, the processor 880 included in the mobile terminal implements the foregoing resource management method when executing a computer program stored in a memory.
在一个实施例中,该移动终端可包括存储器1020及处理器1080,存储器1020中存储有计算机程序,该计算机程序被处理器1080执行时,使得处理器执行如下操作:In one embodiment, the mobile terminal can include a
获取进行资源限制等级更改的目标标识;Obtain the target ID for the resource restriction level change;
根据目标标识确定进行资源限制等级更改的目标种类,目标种类包括线程、进程及应用中的一种;Determining a target type for performing a resource restriction level change according to the target identifier, and the target category includes one of a thread, a process, and an application;
根据与目标种类对应的设置方式,将与目标标识对应的目标配置为与更改后的资源限制等级对应的资源使用优先级。The target corresponding to the target identifier is configured as the resource usage priority corresponding to the changed resource restriction level according to the setting manner corresponding to the target type.
在一个实施例中,提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述的资源管理方法。In one embodiment, a computer readable storage medium is provided having stored thereon a computer program that, when executed by a processor, implements the resource management method described above.
在一个实施例中,提供一种包含计算机程序的计算机程序产品,当其在计算机设备上 运行时,使得计算机设备执行时实现上述的资源管理方法。In one embodiment, 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.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等。One of ordinary skill in the art can understand that all or part of the process of implementing the above embodiments can be completed by a computer program to instruct related hardware, and the program can be stored in a non-volatile computer readable storage medium. Wherein, the program, when executed, may include the flow of an embodiment of the methods as described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or the like.
如此处所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。合适的非易失性存储器可包括只读存储器(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 as 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 technical features of the above-described embodiments may be arbitrarily combined. For the sake of brevity of description, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction between the combinations of these technical features, All should be considered as the scope of this manual.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned 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 invention. 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 (21)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201711488929.3A CN109992398B (en) | 2017-12-29 | 2017-12-29 | Resource management method, device, mobile terminal, and computer-readable storage medium |
| CN201711488929.3 | 2017-12-29 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2019128540A1 true WO2019128540A1 (en) | 2019-07-04 |
Family
ID=67063007
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2018/116495 Ceased WO2019128540A1 (en) | 2017-12-29 | 2018-11-20 | Resource management method, mobile terminal and computer readable storage medium |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN109992398B (en) |
| WO (1) | WO2019128540A1 (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20230012021A1 (en) * | 2021-07-08 | 2023-01-12 | EMC IP Holding Company LLC | Feature Resource Self-Tuning and Rebalancing |
Families Citing this family (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110806926A (en) * | 2019-09-05 | 2020-02-18 | 华为技术有限公司 | A resource management and control method and device |
| CN110908779A (en) * | 2019-10-11 | 2020-03-24 | 深圳市优必选科技股份有限公司 | Application management method, application management device and smart device |
| CN112732434A (en) * | 2019-10-28 | 2021-04-30 | 华为终端有限公司 | Application management method and device |
| CN110795323A (en) * | 2019-10-29 | 2020-02-14 | Oppo广东移动通信有限公司 | Load statistical method, device, storage medium and electronic equipment |
| CN111831433A (en) * | 2020-07-01 | 2020-10-27 | Oppo广东移动通信有限公司 | Resource allocation method, device, storage medium and electronic device |
| CN111813520B (en) * | 2020-07-01 | 2024-11-19 | Oppo广东移动通信有限公司 | Thread scheduling method, device, storage medium and electronic device |
| CN112988286A (en) * | 2021-03-12 | 2021-06-18 | 武汉蔚来能源有限公司 | Resource maintenance method and device and computer storage medium |
| CN113220368B (en) * | 2021-05-27 | 2023-02-28 | 济南浪潮数据技术有限公司 | Storage client resource isolation method, system, terminal and storage medium |
| CN113986558A (en) * | 2021-11-24 | 2022-01-28 | 珠海市魅族科技有限公司 | Application processing method and device |
| CN115016706B (en) * | 2021-12-31 | 2023-05-30 | 荣耀终端有限公司 | Thread scheduling method and electronic equipment |
| CN116166508B (en) * | 2023-04-18 | 2023-07-07 | 天津市天河计算机技术有限公司 | IO data analysis method, device, equipment, storage medium and system |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20100262973A1 (en) * | 2009-04-09 | 2010-10-14 | Rolf Ernst | Method For Operating a Multiprocessor Computer System |
| CN102685729A (en) * | 2011-02-14 | 2012-09-19 | 微软公司 | Background transfer service for applications on mobile devices |
| CN106095547A (en) * | 2016-06-03 | 2016-11-09 | 北京小米移动软件有限公司 | Application program networking control method and device |
Family Cites Families (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101923382B (en) * | 2009-06-16 | 2013-01-16 | 联想(北京)有限公司 | Computer system energy-saving method and computer system |
| CN105808324A (en) * | 2014-12-30 | 2016-07-27 | 展讯通信(天津)有限公司 | Method for improving fluency of system and mobile terminal |
| CN105677460B (en) * | 2015-12-28 | 2019-07-23 | 小米科技有限责任公司 | Applied program processing method and device |
| CN106648849A (en) * | 2016-10-18 | 2017-05-10 | 上海传英信息技术有限公司 | Process freezing method and mobile terminal |
| CN106681822A (en) * | 2017-01-19 | 2017-05-17 | 努比亚技术有限公司 | Signal-based progress freezing and unfreezing device and signal-based progress freezing and unfreezing method |
| CN106951314B (en) * | 2017-03-10 | 2020-06-09 | 清华大学 | Cut-off method for automatic wake-up of Android system background services |
| CN107436801A (en) * | 2017-06-23 | 2017-12-05 | 努比亚技术有限公司 | I/O resource regulating methods, terminal and computer-readable recording medium |
-
2017
- 2017-12-29 CN CN201711488929.3A patent/CN109992398B/en active Active
-
2018
- 2018-11-20 WO PCT/CN2018/116495 patent/WO2019128540A1/en not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20100262973A1 (en) * | 2009-04-09 | 2010-10-14 | Rolf Ernst | Method For Operating a Multiprocessor Computer System |
| CN102685729A (en) * | 2011-02-14 | 2012-09-19 | 微软公司 | Background transfer service for applications on mobile devices |
| CN106095547A (en) * | 2016-06-03 | 2016-11-09 | 北京小米移动软件有限公司 | Application program networking control method and device |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20230012021A1 (en) * | 2021-07-08 | 2023-01-12 | EMC IP Holding Company LLC | Feature Resource Self-Tuning and Rebalancing |
| US11928517B2 (en) * | 2021-07-08 | 2024-03-12 | EMC IP Holding Company LLC | Feature resource self-tuning and rebalancing |
Also Published As
| Publication number | Publication date |
|---|---|
| CN109992398B (en) | 2021-06-25 |
| CN109992398A (en) | 2019-07-09 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2019128540A1 (en) | Resource management method, mobile terminal and computer readable storage medium | |
| CN109992400A (en) | Resource allocation method, device, mobile terminal, and computer-readable storage medium | |
| WO2019137173A1 (en) | Resource management method, mobile terminal and computer-readable storage medium | |
| CN110032267B (en) | Information processing method and device, mobile terminal and computer readable storage medium | |
| CN107391259A (en) | Method for processing resource and device, computer-readable recording medium, mobile terminal | |
| CN109992399B (en) | Resource management method, device, mobile terminal, and computer-readable storage medium | |
| CN107368400A (en) | CPU monitoring method, device, computer readable storage medium and mobile terminal | |
| WO2019128546A1 (en) | Application program processing method, electronic device, and computer readable storage medium | |
| CN107391198B (en) | Task scheduling method and device, computer readable storage medium and mobile terminal | |
| CN110032321B (en) | Application processing method and device, electronic equipment, computer-readable storage medium | |
| WO2019137252A1 (en) | Memory processing method, electronic device, and computer-readable storage medium | |
| CN110032429B (en) | Information processing method and device, mobile terminal and computer readable storage medium | |
| WO2019128537A1 (en) | Application freezing method, and computer device and computer-readable storage medium | |
| CN109992376B (en) | Application freezing method, device, terminal and computer-readable storage medium | |
| CN109992369B (en) | Application processing method and apparatus, electronic device, and computer-readable storage medium | |
| WO2019128588A1 (en) | Process processing method and apparatus, electronic device, computer readable storage medium | |
| WO2019128569A1 (en) | Method and apparatus for freezing application, and storage medium and terminal | |
| CN110032439A (en) | Resource management method, resource management device, mobile terminal and computer-readable storage medium | |
| WO2019128586A1 (en) | Application processing method, electronic device, and computer readable storage medium | |
| WO2019128573A1 (en) | Information processing method, apparatus, computer device and computer-readable storage medium | |
| WO2019137187A1 (en) | Resource management method and apparatus, mobile terminal and computer-readable storage medium | |
| WO2019128570A1 (en) | Method and apparatus for freezing application, and storage medium and terminal | |
| WO2019128553A1 (en) | Application processing method, electronic device, and computer-readable storage medium | |
| CN109992360A (en) | Process processing method and apparatus, electronic device, and computer-readable storage medium | |
| CN109375995B (en) | Application freezing method and device, storage medium, electronic device |
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: 18897654 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: 18897654 Country of ref document: EP Kind code of ref document: A1 |