A CPU operation management method, device and storage medium
By monitoring the message processing delay data of the program process with input focus in the smart terminal, and adjusting the CPU resource allocation, the problem of high CPU resource management interference and low accuracy in the existing technology is solved, and the terminal's operation fluency and system stability are improved. .
Patent Information
- Application Number
- CN201810811123.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-07-23
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2039-01-26
AI Technical Summary
When the existing technology identifies application scenarios and manages CPU resources, the system interferes greatly, the recognition accuracy is low, and the smooth operation of the smart terminal cannot be effectively guaranteed.
By monitoring the message processing delay data of the program process that currently has the input focus, the CPU resources are managed according to the delay data, including sending the delay data to the CPU manager during the delay to adjust the CPU resource allocation and ensure the reasonableness of the CPU resources. use.
It improves the running fluency of smart terminals, realizes simple CPU resource management, and reduces interference to the system.
Smart Images

Figure CN110750352B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of communication technology, and in particular to a CPU operation management method, device and storage medium. Background Art
[0002] Smart terminals (such as mobile phones) are multi-tasking systems (such as Linux and Android), and the central processing unit (CPU) is the core resource of the mobile phone system. When multiple applications on a mobile phone use CPU resources at the same time, the reasonable management of CPU resources is the key to improving the operation efficiency of the mobile phone.
[0003] In the prior art, the main technical means for CPU operation management is to use the upper-level software system to manage CPU resources according to the requirements of the usage scenario, such as giving more CPU running time to important applications, and increasing the CPU running frequency for time-sensitive operations, etc. This technology takes into account the requirements of special application scenarios for CPU resources and adjusts them to improve the fluency of mobile phones in various scenarios. One implementation method is to use machine learning or artificial intelligence to learn, intelligently identify the requirements of the current application scenario for CPU resources, and thus achieve CPU resource management. However, the learning process of this method has a relatively large interference with the system, and the recognition accuracy is not high enough. If the recognition error is also negatively affected by the system, it cannot well guarantee the smoothness of the operation of the smart terminal.
[0004] Therefore, it is necessary to provide a CPU operation management method, device and storage medium to overcome the problem that the existing technology manages CPU resources by identifying application scenarios, which causes great interference to the system and has low recognition accuracy. Summary of the invention
[0005] In view of this, an object of the embodiments of the present invention is to provide a CPU operation management method, device and storage medium to solve the problem that the prior art cannot well guarantee the smoothness of the operation of the smart terminal.
[0006] The technical solution adopted by the embodiment of the present invention to solve the above technical problems is as follows:
[0007] According to a first aspect of an embodiment of the present invention, a CPU operation management method is provided, the method comprising:
[0008] Select the program process that currently has input focus as the monitoring object;
[0009] Monitor the delay data of message processing of the program process;
[0010] Manage CPU resources based on the monitored delay data.
[0011] According to a second aspect of an embodiment of the present invention, a CPU operation management device is provided, the device comprising a CPU operation management unit, the CPU operation management unit being configured to execute the steps of the method described in the first aspect.
[0012] According to a third aspect of an embodiment of the present invention, a storage medium is provided, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps described in the first aspect or the second aspect.
[0013] The CPU operation management method, device and storage medium of the embodiments of the present invention monitor the delay data of the message processing of the program process that currently has the input focus, and then send the delay data to the CPU manager when a delay occurs, so that the CPU manager manages the CPU resources according to the delay data. It is only necessary to manage the CPU resources of the smart terminal according to the delay data of the message processing of the program process that currently has the input focus, thereby improving the operation fluency. It is not only simple to implement, but also has less interference with the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 A flowchart of a CPU operation management method provided in Embodiment 1 of the present invention;
[0015] Figure 2 A flow chart of a method for managing CPU resources according to a delay time value in Embodiment 1 of the present invention;
[0016] Figure 3 A flow chart of another method for a message monitoring unit to monitor a message processing delay time provided in Embodiment 1 of the present invention;
[0017] Figure 4 A flowchart of setting a monitoring flag for a message monitoring unit in Embodiment 1 of the present invention;
[0018] Figure 5 A flowchart of monitoring the processing of messages in a message queue after the message monitoring unit sets a monitoring flag in Embodiment 1 of the present invention;
[0019] Figure 6 A schematic diagram of the structure of a CPU operation management device provided in Embodiment 2 of the present invention.
[0020] The realization of the purpose, functional features and advantages of the embodiments of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0021] In order to make the technical problems, technical solutions and beneficial effects to be solved by the embodiments of the present invention clearer and more understandable, the embodiments of the present invention are further described in detail in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the embodiments of the present invention and are not used to limit the embodiments of the present invention.
[0022] Embodiment 1 of the present invention provides a CPU operation management method, which is applied to a terminal, such as a smart terminal. Figure 1 , the method comprising:
[0023] Step S101, selecting the program process that currently has input focus as the monitoring object;
[0024] Step S102, monitoring the delay data of the message processing of the program process;
[0025] Step S103: managing CPU resources according to the monitored delay data.
[0026] In actual applications, the software system of smart terminals is message-driven, so the unsmooth operation of smart terminals must be caused by the delay in the corresponding message queue when processing messages. Therefore, by using this feature of the smart terminal software system, by monitoring whether a specific message queue has a delay when processing messages and the length of the delay, it is possible to identify the current application scenario's demand for CPU resources and whether there is any abnormal use of CPU resources.
[0027] On the other hand, considering that the user's experience of the smoothness of the operation of the smart terminal is mainly reflected through specific programs (such as focus applications), it is possible to monitor only the message queue belonging to the specific program and monitor fewer objects. Therefore, monitoring only specific message queues is simple to implement and has little interference to the system.
[0028] In one embodiment, step S101, selecting a program process that currently has input focus as a monitoring object, includes:
[0029] Monitor the running status of all program processes in the system;
[0030] A program process of an application program having an input focus is selected according to the running state.
[0031] In actual applications, the running status of a program process includes starting, ending, showing, hiding, or obtaining input focus, etc. The application with input focus (referred to as focus application) is the application that interacts with the user and is the program process that has the greatest impact on the user experience.
[0032] In one embodiment, the delay data includes a delay time value, and managing CPU resources according to the delay data includes:
[0033] When the delay time value is greater than the preset monitoring threshold, the program process whose CPU occupancy rate exceeds the threshold is checked, and the CPU resource occupancy rate of the checked program process is controlled below the preset occupancy rate threshold;
[0034] When the delay time value is less than or equal to the monitoring threshold, the supply of CPU resources for the program process is increased.
[0035] In actual applications, when the message processing queue is monitored to have a delay when processing messages, if the delay time is reasonable (relatively small, such as within 100ms), and the user can hardly detect the sluggishness with the naked eye or the sluggishness is very slight, it can be handled by improving the CPU resource capacity (such as making the CPU more actively increase the frequency and run at a higher frequency or opening more CPU cores to run); if the delay time is unreasonable, then the possibility of abnormal CPU resource usage in the system is very high, and the applications with abnormal CPU resource usage are checked and found, and these program processes are isolated into a restricted group to limit their excessive use of CPU resources, so as not to affect the smooth operation of the system.
[0036] The specific process can be implemented as follows, please refer to Figure 2 The method flow for managing CPU resources according to the delay time value includes:
[0037] Step S201, obtaining a delay time value.
[0038] In practical applications, the delay time value is the difference between the expected processing time of the message in the message queue and the current system time, which can be calculated by the message monitoring unit of the monitored application.
[0039] Step S202, determine whether the delay time value is greater than a preset monitoring threshold, if so, execute step S204, otherwise execute step S203.
[0040] In actual applications, the monitoring threshold is the monitoring threshold of the message processing delay when the application abnormally uses the CPU. If the delay time value is greater than the monitoring threshold, it means that the system may have a program process abnormally occupying the CPU.
[0041] Step S203: Send a resource management command to the terminal to increase the supply of CPU resources.
[0042] In actual applications, resource management commands may be sent to the CPU controller of the terminal, including commands for limiting process resource consumption, commands for suspending a process (eg, running in the background), and the like.
[0043] In practical applications, improving the supply of CPU resources includes: more aggressive frequency modulation strategies, opening more available CPU cores for operation, etc.
[0044] S204: Check for program processes whose CPU usage exceeds a preset threshold.
[0045] S205: Move the checked program processes to a specified CPU group, and the CPU occupancy rates of all program processes in the CPU group cannot exceed a preset occupancy rate threshold.
[0046] Through this step, the impact of abnormal program processes on the entire system can be isolated.
[0047] In one embodiment, monitoring the delay data of the message processing of the program process includes:
[0048] Take the message from the message queue of the program process;
[0049] Calculate the delay time value for message processing.
[0050] In one embodiment, the method further comprises:
[0051] It is determined whether the delay time value is greater than a preset value, and when the delay time value is greater than the preset value, a step of managing CPU resources according to the monitored delay data is executed.
[0052] In one embodiment, the method further comprises:
[0053] Set the monitoring flag of the program process to true;
[0054] After taking the message from the message queue of the program process, the method further comprises:
[0055] Determine whether the monitoring flag is true, and if the determination result is yes, execute the step of calculating the delay time value of the message processing.
[0056] In one embodiment, the selection, monitoring and management of CPU resources of the monitoring object can be performed by the CPU operation management device (such as Figure 6 ) is implemented by the CPU operation management unit 601, and the acquisition of the delay data can be implemented by the message monitoring unit 602 of the selected program process. At this time, step S102, monitoring the delay data of the message processing of the selected program process, includes:
[0057] The message monitoring unit 602 of the program process is notified to start monitoring whether the message processing in the message queue of the selected program process is delayed, so that the message monitoring unit 602 reports the delay data when the message processing is delayed.
[0058] In actual applications, the focus application at different times may be different. Therefore, when executing step S102, the message monitoring unit 602 running in the process to which the old focus application belongs may also be notified to stop monitoring the message queue of the old focus application.
[0059] After the CPU resource manager notifies the message monitoring unit 602 of the focus program process to start monitoring whether the message processing in the message queue of the selected program process is delayed, refer to Figure 3 The method flow also includes:
[0060] S401, the message monitoring unit 602 takes out a message from the message queue of the program process to which it belongs;
[0061] S402, the message monitoring unit 602 calculates the delay time value of the message processing;
[0062] S403: When the delay time value is greater than a preset value, the message monitoring unit 602 sends delay data including the delay time value to the CPU operation management unit 601, so that the CPU operation management unit 601 manages CPU resources according to the delay data.
[0063] In one embodiment, see Figure 4 Before executing step S402, the method further includes:
[0064] S501 . The message monitoring unit 602 receives a notification message sent by the CPU operation management unit 601 .
[0065] S502. Set a monitoring flag according to the content of the notification message: if the content of the message is to start monitoring the message queue of the program process to which it belongs, the monitoring flag is set to true; if the content of the message is to stop monitoring the message queue of the program process to which it belongs, the monitoring flag is set to false.
[0066] In actual application, after the message monitoring unit 602 sets the monitoring flag, the monitoring process of the message processing in the message queue is as follows: Figure 5 ,include:
[0067] S601. Take a message from the message queue.
[0068] S602, determine whether the monitoring flag is true, if so, execute step S603, otherwise, execute step S606.
[0069] S603: Calculate the difference between the expected processing time of the message and the current system time.
[0070] This difference is the delay time value.
[0071] S604, determine whether the difference is less than a preset value VT, if so, execute step S606, otherwise, execute step S605.
[0072] S605 . Send a notification to the CPU manager. The delay data carried in the notification includes the difference, so that the CPU operation management unit 601 manages the CPU resources according to the delay data.
[0073] S606: dispatch the retrieved message and continue to execute step S601.
[0074] The CPU operation management method of this embodiment monitors the delay data of the message processing of the program process that currently has the input focus, and then manages the CPU resources according to the delay data when a delay occurs. It is only necessary to manage the CPU resources of the smart terminal according to the delay data of the message processing of the program process that currently has the input focus, thereby improving the operation smoothness. It is not only simple to implement, but also has less interference to the system.
[0075] Based on the above-mentioned embodiment, the second embodiment of the present invention provides a CPU operation management device, see Figure 6 The device includes a CPU operation management unit 601, and the CPU operation management unit 601 is used to perform the following steps of the method:
[0076] Select the program process that currently has input focus as the monitoring object;
[0077] Monitor the delay data of message processing of the program process;
[0078] Manage CPU resources based on the monitored delay data.
[0079] In one embodiment, the delay data includes a delay time value. When managing CPU resources according to the delay data, the CPU operation management unit 601 is further configured to perform the following steps:
[0080] When the delay time value is less than or equal to the preset monitoring threshold, the supply of CPU resources for the program process is increased;
[0081] When the delay time value is greater than the monitoring threshold, the program process whose CPU occupancy rate exceeds the preset threshold is checked, and the occupancy rate of the CPU resource of the checked program process is controlled below the preset occupancy rate threshold.
[0082] In one embodiment, when the program process currently having the input focus is selected as the monitoring object, the CPU operation management unit 601 is further used to perform the following steps:
[0083] Monitor the running status of all program processes in the system;
[0084] A program process of an application program having an input focus is selected according to the running state.
[0085] In one embodiment, the CPU operation management device further includes: a message monitoring unit 602, which is used to perform the following steps when the CPU operation management unit 601 monitors the delayed data of the message processing of the selected program process:
[0086] Take the message from the message queue of the program process;
[0087] Calculate the delay time value for message processing.
[0088] The CPU operation management unit 601 is also used to execute the following steps: determine whether the delay time value is greater than a preset value, and when the delay time value is greater than the preset value, execute the step of managing CPU resources according to the monitored delay data.
[0089] In one embodiment, the message monitoring unit 602 is further configured to perform the following steps:
[0090] Set the monitoring flag of the program process to true;
[0091] After taking the message from the message queue of the program process, the method further comprises:
[0092] Determine whether the monitoring flag is true, and if the determination result is yes, execute the step of calculating the delay time value of the message processing.
[0093] The CPU operation management device of this embodiment monitors the delay data of the message processing of the program process that currently has the input focus, and then manages the CPU resources according to the delay data when a delay occurs. It is only necessary to manage the CPU resources of the intelligent terminal according to the delay data of the message processing of the program process that currently has the input focus, thereby improving the running smoothness. It is not only simple to implement, but also has less interference to the system.
[0094] Based on the above-mentioned embodiments, a third embodiment of the present invention provides a storage medium, which includes a stored program. When the program is executed, the device where the storage medium is located is controlled to perform the operations described in the first embodiment.
[0095] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional devices / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional devices / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, programers, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, programmers, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0096] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the embodiments of the present invention is not limited thereby. Any modification, equivalent substitution and improvement made by those skilled in the art without departing from the scope and essence of the embodiments of the present invention shall be within the scope of the rights of the embodiments of the present invention.
Claims
1. A CPU operation management method, It is characterized in that The method comprises: Select the program process that currently has input focus as the monitoring object; Monitoring the delay data of the message processing of the program process, wherein the delay data includes a delay time value; Manage CPU resources based on monitored delay data; The managing of CPU resources according to the monitored delay data includes: When the delay time value is less than or equal to a preset monitoring threshold, increasing the supply of CPU resources for the program process; When the delay time value is greater than the monitoring threshold, the program process whose CPU occupancy rate exceeds the preset threshold is checked, and the occupancy rate of the CPU resources of the checked program process is controlled below the preset occupancy rate threshold.
2. The CPU operation management method according to claim 1, It is characterized in that The step of selecting the program process that currently has the input focus as the monitoring object includes: Monitor the running status of all program processes in the system; A program process of an application program having an input focus is selected according to the running state.
3. The method according to claim 1, wherein the monitoring of the delay data of the message processing of the program process, include: Retrieving a message from a message queue of the program process; Calculate the delay time value of the message processing.
4. The CPU operation management method according to claim 3, It is characterized in that The method further comprises: Determine whether the delay time value is greater than a preset value, and when the delay time value is greater than the preset value, execute the step of managing the CPU resources according to the monitored delay data.
5. The CPU operation management method according to claim 3, It is characterized in that The method further comprises: receiving a notification message, and setting a monitoring flag of the program process according to the content of the notification message; After taking out the message from the message queue of the program process, the method further comprises: Determine whether the monitoring flag is true, and when the determination result is yes, execute the step of calculating the delay time value of the message processing.
6. A CPU operation management device, It is characterized in that The device comprises: The CPU operation management unit is used to execute the steps of the method according to any one of claims 1 to 3 and claim 4.
7. The device according to claim 6, It is characterized in that The device further comprises: A message monitoring unit, configured to execute the steps of the method as claimed in claim 3 or 5.
8. A storage medium, It is characterized in that The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps as described in any one of claims 1-5.
