Processor resource management and control method and system, vehicle-mounted terminal and storage medium
By obtaining and analyzing the processor usage rate of the application process, dynamically adjusting its position in the multi-level control list, the problem of poor control effect of abnormal CPU usage problems in the prior art is solved, and the system's operating performance and fluency are improved.
Patent Information
- Application Number
- CN202411760350.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-11
AI Technical Summary
The lack of an effective CPU resource management mechanism in the existing technology makes it difficult to control the abnormal CPU usage problem of applications in a multi-task operating system environment, affecting the operating performance of the system.
By obtaining multiple instantaneous usage rates of processors of each application process, we judge whether the processor usage rate of the application process is normal, and move it step by step into or out of the multi-level control list based on the judgment results for dynamic control.
It improves the reliability of judging abnormal CPU usage rates of application processes. Through the setting of the multi-level control list, it ensures that the processor usage rates of each application process in the system are within a reasonable range, thereby improving the smoothness and performance of the system.
Smart Images

Figure CN119597482A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of processor resource management, and in particular to a processor resource management method, system, vehicle-mounted terminal and storage medium. Background Art
[0002] In modern smart devices, efficient use of CPU (Central Processing Unit) resources is one of the key factors to ensure smooth system operation. Especially in devices with high requirements for high-performance computing and multi-tasking capabilities, the reasonable allocation and management of CPU resources is particularly important. In order to achieve efficient resource sharing, advanced resource management technologies are usually used to optimize system performance. Therefore, the effective management and optimization of processor resources has become an important research direction.
[0003] In a multi-tasking operating system environment, various applications and services are running in the system, and these applications will occupy a certain amount of CPU resources during operation. If there is a lack of effective CPU resource management mechanism, as the number of applications increases and the complexity increases, the CPU load may be too high, which in turn affects the response speed and stability of the system. When the CPU usage of certain applications is very high, if there is no appropriate mechanism to monitor and handle it, it may cause the performance of the entire system to decline, causing the system to freeze, black screen, or even restart. However, the industry currently lacks a control mechanism for abnormal CPU usage of various applications in the system, which seriously affects the system's operating performance. Summary of the invention
[0004] In view of the shortcomings of the prior art described above, the present application discloses a processor resource management method, system, vehicle-mounted terminal and storage medium, which are used to solve the technical problem of poor management effect of abnormal usage rate of processors of various applications in the system in the prior art.
[0005] In a first aspect, the present application provides a processor resource management method, the method comprising: obtaining multiple instantaneous usage rates of the processor for each application process; for any application process, judging whether the processor usage rate of any application process is normal based on the multiple instantaneous usage rates; if normal, moving any application process out of a multi-level management list step by step, the multi-level management list being used to hierarchically manage application processes with abnormal processor usage rates; if abnormal, moving any application process into the multi-level management list step by step, and dynamically managing any application process.
[0006] In one embodiment of the present application, the configuration method of the multi-level control list includes: dividing multiple control levels according to the number of consecutive abnormal usage rates from low to high; configuring multiple control sub-tables from low to high according to the multiple control levels to generate the multi-level control list.
[0007] In one embodiment of the present application, the step-by-step moving of any of the application processes into the multi-level control list includes: if any of the application processes is not in the multi-level control list, moving any of the application processes into the lowest-level control subtable; if any of the application processes is in the multi-level control list, and any of the application processes is not in the highest-level control subtable, moving any of the application processes from the current control subtable into a higher-level control subtable, until any of the application processes is terminated from the highest-level control subtable.
[0008] In one embodiment of the present application, the step-by-step moving of any of the application processes out of the multi-level control list includes: if any of the application processes is not in the lowest-level control subtable, moving any of the application processes from the current control subtable to a lower-level control subtable; if any of the application processes is in the lowest-level control subtable, moving any of the application processes out of the multi-level control list.
[0009] In one embodiment of the present application, judging whether the processor usage rate of any of the application processes is normal based on the multiple instantaneous usage rates includes: counting the number of the multiple instantaneous usage rates, and calculating the average of the multiple instantaneous usage rates; calculating the average score based on the average and a preset average scoring standard, and calculating the instantaneous value score based on the number and a preset instantaneous value scoring standard; judging whether the processor usage rate of any of the application processes is normal based on the average score and the instantaneous value score.
[0010] In one embodiment of the present application, judging whether the processor usage of any of the application processes is normal based on the average value score and the instantaneous value score includes: performing weighted calculation on the average value score and the instantaneous value score to obtain a target score; comparing the target score with a preset score threshold; if the target score is less than or equal to the score threshold, judging that the processor usage of any of the application processes is normal; if the target score is greater than the score threshold, judging that the processor usage of any of the application processes is abnormal.
[0011] In one embodiment of the present application, before determining whether the processor usage rate of any of the application processes is normal based on the multiple instantaneous usage rates, it also includes: setting an application process whitelist, and the application processes in the application process whitelist are not subject to hierarchical control of processor resources; if any of the application processes is in the application process whitelist, no hierarchical control is performed on any of the application processes; if any of the application processes is not in the application process whitelist, a determination operation is performed to determine whether the processor usage rate is normal.
[0012] In the second aspect, the present application provides a processor resource management and control system, the system comprising: an acquisition module, used to obtain multiple instantaneous usage rates of each application process regarding the processor; a judgment module, used to judge whether the processor usage rate of any application process is normal based on the multiple instantaneous usage rates; a management and control module, used to move any application process out of a multi-level management and control list step by step if it is normal, the multi-level management and control list is used to store and manage application processes with abnormal processor usage rates under hierarchical management; the management and control module is also used to move any application process into the multi-level management and control list step by step if it is abnormal, so as to dynamically manage any application process.
[0013] In a third aspect, the present application provides a vehicle-mounted terminal, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the vehicle-mounted terminal implements the processor resource management method described in the first aspect.
[0014] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor of a computer, the computer executes the processor resource management method described in the first aspect.
[0015] As described above, the processor resource control method, system, vehicle terminal and storage medium provided by the embodiments of the present application have the following beneficial effects:
[0016] First, multiple instantaneous usage rates of the processor for each application process are obtained. Then, for any application process, whether the processor usage rate of any application process is normal is judged according to the multiple instantaneous usage rates. If the processor usage rate is normal, any application process is gradually moved out of the multi-level control list, wherein the multi-level control list is used to hierarchically control application processes with abnormal processor usage rates. If the processor usage rate is abnormal, any application process is gradually moved into the multi-level control list, and any application process is dynamically controlled. By judging whether the processor usage rate of any application process is normal or abnormal through multiple instantaneous usage rates, the reliability of the judgment result is improved. By setting a multi-level control list and combining the accurate results of whether the processor usage rate of each application process is normal or abnormal, the application process with abnormal processor usage rate is subjected to multi-level control processing, so that the processor resource occupancy of each application process runs under this mechanism, which can ensure that the processor usage rate of each application process in the system is within a reasonable range, thereby improving the system operation smoothness and improving the system operation performance.
[0017] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0019] Figure 1 is a schematic diagram of an implementation environment of a processor resource control system shown in an exemplary embodiment of the present application;
[0020] Figure 2 is a flowchart of a processor resource control method shown in an exemplary embodiment of the present application;
[0021] Figure 3 is a schematic diagram of a vehicle system shown in an exemplary embodiment of the present application;
[0022] Figure 4 This is a flow chart of a vehicle system presetting whitelist process configuration file shown in an exemplary embodiment of the present application;
[0023] Figure 5 is a flowchart of a three-level processor resource control method shown in an exemplary embodiment of the present application;
[0024] Figure 6is a flowchart of a specific processor resource control method shown in an exemplary embodiment of the present application;
[0025] Figure 7 is a block diagram of a processor resource management and control system shown in an exemplary embodiment of the present application;
[0026] Figure 8 It is a structural schematic diagram of a vehicle-mounted terminal provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0027] The following will describe the implementation methods of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, not for limiting the scope of protection of the present application.
[0028] It should be noted that the illustrations provided in the following embodiments are only used to illustrate the basic concept of the present application in a schematic manner, and therefore the illustrations only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the form, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0029] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.
[0030] First of all, it should be noted that efficient use of CPU resources is one of the key factors to ensure the smooth operation of the system, especially in devices with high requirements for high-performance computing capabilities and multi-tasking capabilities. The reasonable allocation and management of CPU resources is particularly important. If there is a lack of an effective CPU resource management mechanism, as the number of applications increases and the complexity increases, the CPU load may be too high, which in turn affects the response speed and stability of the system. When the CPU usage of certain applications is very high, if there is no appropriate mechanism to monitor and process it, the performance of the entire system may decline, causing the system to freeze, black screen, or even restart. Abnormal phenomena. However, the inventor of this application has found that the industry currently lacks a control mechanism for abnormal CPU usage problems of various applications in the system, which seriously affects the operating performance of the system.
[0031] Therefore, see Figure 1 , Figure 1 FIG. 1 is a schematic diagram of an implementation environment of a processor resource control system shown in an exemplary embodiment of the present application. Figure 1 As shown, the implementation environment includes a vehicle 110 and a processor resource management and control system 120, wherein the processor resource management and control system 120 is embedded in the vehicle 110 and is used to implement processor resource management of the system in the vehicle 110. The processor resource management and control system 120 includes but is not limited to a vehicle system, an on-board computer, etc., and improves the reliability of the judgment result by judging whether the processor usage of any application process is normal or abnormal through multiple instantaneous usage rates. By setting a multi-level management and control list and combining the precise results of whether the processor usage of each application process is normal or abnormal, a multi-level management and control process is performed on the application process with abnormal processor usage, so that the processor resource occupancy of each application process runs under this mechanism, which can ensure that the processor usage of each application process in the system is within a reasonable range, thereby improving the system operation smoothness and improving the system operation performance.
[0032] See also Figure 2 , Figure 2 is a flowchart of a processor resource control method shown in an exemplary embodiment of the present application. The method can be applied to Figure 1 The implementation environment shown is a schematic diagram. It should be understood that the method may also be applicable to other exemplary implementation environments, and this embodiment does not limit the implementation environment to which the method is applicable.
[0033] In addition, in an embodiment of the present application, the processor resource management method can be applicable to the Android system, that is, it can be applied to mobile devices of the Android system, such as mobile phones, car computers, etc. For example, it is suitable for processor resource management in the car computer system, and performs multi-level management and processing on the processor usage of each Android application.
[0034] See also Figure 3 , Figure 3 is a schematic diagram of a vehicle system shown in an exemplary embodiment of the present application. The vehicle system may be a Qualcomm 8155 vehicle system. It should be understood that in the embodiment of the present application, the processor resource management method may be applicable to various vehicle systems. Figure 3As shown, the car system is a virtualized dual-system architecture, including the QNX operating system and the Android operating system. Through HyperVision (virtualization architecture), processor virtualization and memory virtualization are realized, so as to share hardware resources (memory resources and processor resources, etc.). The CPU resources of the car system are an important hardware resource. The CPU load often determines the smoothness of the car system. The CPU resources of the car system are shared by the QNX operating system and the Android operating system. For example, the total computing power of the 8155 car system is 105KDMIPS, with a total of 8 cores, of which cores 0 and 1 are allocated to the QNX operating system, and cores 2-7 are allocated to the Android operating system using VCPU (Virtual Central Processing Unit, virtual central processing unit), with a total computing power percentage of 600%. As the main system, the QNX operating system is mainly responsible for instrument applications, and as the slave system, the Android operating system is mainly responsible for central control entertainment information applications. In the Android operating system, there are various in-vehicle applications, such as vehicle settings, Bluetooth phones, multimedia, driving recorders, 360-degree surround view, air conditioning settings, voice, virtual images, etc. Each application will occupy CPU resources when running, and each application will compete for CPU resources. If the CPU resource load is too high, it will cause abnormal phenomena such as freezing of the entire vehicle system, black screen, and even restart. Through the processor resource management method provided by this application, multiple instantaneous usage rates are used to judge whether the processor usage rate of any application process is normal or abnormal, which improves the reliability of the judgment result, and by setting a multi-level management list, combined with the accurate results of normal or abnormal processor usage of each application process, multi-level management and processing are performed on the application process with abnormal processor usage, so that the processor resource occupancy of each application process runs under this mechanism, which can ensure that the processor usage rate of each application process in the system is within a reasonable range, avoid the occurrence of abnormal phenomena such as freezing of the vehicle system, black screen, and even restart, thereby improving the smoothness of system operation and improving the system's operating performance.
[0035] like Figure 2 As shown, in an exemplary embodiment, the processor resource control method includes at least steps S210 to S240, which are described in detail as follows:
[0036] Step S210, obtaining multiple instantaneous usage rates of each application process with respect to the processor.
[0037] It should be noted that the embodiment of the present application does not limit the number of instantaneous usage rates. In addition, the collection interval between each instantaneous usage rate can be specifically set according to the needs.
[0038] Step S220 , for any application process, judging whether the processor usage rate of any application process is normal according to a plurality of instantaneous usage rates.
[0039] In this embodiment, the reliability of the judgment result is improved by using multiple instantaneous usage rates to judge whether the processor usage rate of any application process is normal or abnormal.
[0040] Specifically, judging whether the processor usage of any application process is normal based on multiple instantaneous usage rates includes: counting the number of multiple instantaneous usage rates, and calculating the average of multiple instantaneous usage rates; calculating the average score based on the average and a preset average scoring standard, and calculating the instantaneous value score based on the number and a preset instantaneous value scoring standard; judging whether the processor usage of any application process is normal based on the average score and the instantaneous value score.
[0041] In this embodiment, the average value of multiple instantaneous usage rates is combined with data from two dimensions, namely, the instantaneous usage rate and the average usage rate, to determine whether the CPU usage rate of the application process is normal. By determining whether the CPU usage rate of the application process is normal through multi-dimensional usage rates, the reliability of the judgment result is further improved.
[0042] In this embodiment, the average value scoring standard can be set to several intervals according to the size of the usage rate, and different scoring standards are set for each interval; the instantaneous value scoring standard can be set to different scoring standards according to the number of instantaneous values exceeding a certain threshold. It should be understood that this embodiment does not limit the average value scoring standard and the instantaneous value scoring standard.
[0043] For example, 120 instantaneous usage rates are obtained continuously, recorded as CPU1, CPU2, CPU3...CPU120, and CPU_AVG is taken as the average value of the 120 instantaneous usage rates, then CPU_AVG=(CPU1+CPU2+CPU3+...+CPU120) / 120.
[0044] As a possible embodiment, the average scoring standard is:
[0045]
[0046] Among them, 80% and 280% can be set to other values according to requirements.
[0047] As a possible embodiment, the instantaneous value scoring standard is:
[0048]
[0049] Among them, X represents the number of instantaneous values exceeding a certain threshold, and 100 can be set according to specific needs. For example, for 120 instantaneous utilization rates, the turning point of the scoring standard is set to 100.
[0050] According to the above average value scoring standard and instantaneous value scoring standard, the average value score and instantaneous value score are obtained respectively. Finally, the processor usage of any application process is judged whether it is normal according to the average value score and the instantaneous value score. In this way, whether the CPU usage of the application process is normal is judged through multi-dimensional usage, which ensures the reliability of the judgment result.
[0051] Furthermore, based on the average value score and the instantaneous value score, whether the processor usage of any application process is normal is judged, including: performing weighted calculation on the average value score and the instantaneous value score to obtain a target score; comparing the target score with a preset score threshold; if the target score is less than or equal to the score threshold, then the processor usage of any application process is judged to be normal; if the target score is greater than the score threshold, then the processor usage of any application process is judged to be abnormal.
[0052] In this embodiment, a target score for usage is obtained by weighted calculation of the average score and the instantaneous score, and by comparing the target score with a preset score threshold, it is efficiently determined whether the processor usage of any application process is normal. This makes it easier to perform multi-level control on application processes with abnormal processor usage to ensure optimal operating performance.
[0053] The target score is calculated as:
[0054] Score=Score_avg*α+Score_inst*β
[0055] Among them, Score represents the target score; Score_avg represents the average score; α represents the weight of the average score; Score_inst represents the instantaneous value score; β represents the weight of the instantaneous value score.
[0056] It should be noted that the values of the weights α and β of the average value score and the instantaneous value score can be set according to specific requirements. Preferably, both α and β are set to 0.5.
[0057] Finally, the target score is compared with the preset score threshold. If the target score is less than or equal to the score threshold, the processor usage of any application process is judged to be normal. If the target score is greater than the score threshold, the processor usage of any application process is judged to be abnormal. For example, if the score threshold is set to 40 points, if the target score of any application process is less than or equal to 40 points, the processor usage of any application process is normal. If the target score of any application process is greater than 40 points, the processor usage of any application process is abnormal.
[0058] It should also be noted that each application process in the system is set with a score threshold, which is used to determine whether the processor usage of the application process is normal. Among them, the score threshold of each application process can be set according to its own business logic, so that the application process completes the business logic within a certain usage rate. The setting of the score threshold needs to consider factors such as its own business logic and the total system processor resources, and formulate a relatively accurate value within a certain range.
[0059] In a possible embodiment, for any application process, the target score is compared with a preset score threshold, including: obtaining the running mode of any application process, the running mode includes a foreground running mode and a background running mode; if any application process is in the foreground running mode, the target score is compared with the preset foreground process score threshold; if any application process is in the background running mode, the target score is compared with the preset background process score threshold.
[0060] As a possible implementation example, an application process in the system may be in a foreground running state or in a background running state. Considering that the same application process occupies different processor resources in the foreground running state and the background running state, in this implementation example, the score threshold of each application process includes a foreground process score threshold and a background process score threshold, thereby achieving utilization rate control of each application process in different running states. In this way, different processor resources are allocated according to the actual running state of the application process, which can further ensure the control effect of the system processor resources.
[0061] As a possible embodiment, when an application process is in the foreground running mode, it usually has a higher priority because the user is interacting with it, so a higher score threshold is set to ensure that the application obtains sufficient processor resources to maintain a good user experience. On the contrary, when the application process is in the background running mode, since it is not the focus of the user's current attention, a lower score threshold can be set to limit the CPU usage of these processes, thereby freeing up more processor resources for other more important tasks. In this way, it can ensure that the foreground application has sufficient resource support, and prevent the background application from excessively occupying processor resources, thereby avoiding the risk of overall system performance degradation.
[0062] In one embodiment, before determining whether the processor usage rate of any application process is normal based on multiple instantaneous usage rates, it also includes: setting an application process whitelist, and the application processes in the application process whitelist are not subject to hierarchical control of processor resources; if any application process is in the application process whitelist, no hierarchical control is performed on any application process; if any application process is not in the application process whitelist, a determination operation is performed to determine whether the processor usage rate is normal.
[0063] It should be noted that, taking into account the various requirements of system operation, such as the special safety requirements of the car system, some application processes cannot be terminated even if the CPU usage score exceeds the score threshold, such as 360-degree surround view, navigation and other application processes.
[0064] Therefore, in this embodiment, considering the life cycle of important application processes in the system, it is not appropriate to forcibly terminate them due to abnormal processor usage, so a whitelist of application processes is set. The application processes in the list are not subject to processor resource control. In this way, the life cycle of important application processes is guaranteed through the whitelist mechanism. For whitelist processes, processor resource control is not performed, which avoids these important application processes from being forcibly terminated due to abnormal processor usage, thereby ensuring customer experience.
[0065] It should also be noted that whether each application process is a whitelist process can be set according to specific needs.
[0066] See also Figure 4 , Figure 4 This is a flowchart of a vehicle system presetting whitelist process configuration file shown in an exemplary embodiment of the present application. Figure 4 As shown in the figure, the steps of compiling and packaging the whitelist process configuration file for the processor resource control of the vehicle system based on the continuous integration tool (such as Jenkins) are described in detail as follows: first, the compilation and packaging task is initiated through the continuous integration tool; then the system source code stage is entered, where the system source code is such as the source code of the whitelist process configuration file and the source code of the product configuration file, etc. The whitelist process configuration file is a configuration file used to define whether the vehicle application is subject to processor resource control, and the product configuration file is used to customize the compilation options and build parameters; then the continuous integration tool executes the compilation task, and packages the system source code and its configuration file together into an installable system flashing package; finally, the generated system flashing package is written into the vehicle system. After the writing is successful, the vehicle system contains the whitelist process configuration file. After the vehicle system is running, this file will be read and parsed to filter out the whitelist process so that it is not subject to processor resource control.
[0067] Step S230, if normal, any application process is removed from the multi-level control list step by step, and the multi-level control list is used to hierarchically control application processes with abnormal processor usage.
[0068] It should be noted that the multi-level control list includes multiple control sub-tables, each control sub-table is a different control level, and is used to control application processes with different consecutive abnormal processor usage times. Therefore, the method of removing any application process from the multi-level control list is to remove it level by level.
[0069] In one embodiment, the configuration method of the multi-level control list includes: dividing multiple control levels according to the number of consecutive abnormal usage rates from low to high; configuring multiple control sub-tables from low to high according to the multiple control levels to generate a multi-level control list.
[0070] In this embodiment, the more times the usage rate is abnormal continuously, the more the application process is in the abnormal usage state, and the higher the degree of control. Therefore, the number of continuous abnormal usage in the multi-level control list is divided into multiple control levels from low to high, and then multiple control sub-tables are configured from low to high according to the multiple control levels. The application processes with different continuous abnormal usage times are hierarchically controlled through multiple control sub-tables. If the usage rate of any application process is abnormal, the application process is controlled to different degrees according to the number of continuous abnormal usage times. In this way, multi-level control of processor resources is achieved, which is conducive to ensuring the smoothness of system operation and improving the system's operating performance.
[0071] In addition, this embodiment does not limit the number of control sub-tables divided from low to high according to the number of consecutive abnormal usage rates. For example, it can be divided into three control sub-tables to form a three-level control of processor resources, and it can be divided into four control sub-tables to form a four-level control of internal processor resources, etc.
[0072] In one embodiment, any application process is gradually moved out of the multi-level control list, including: if any application process is not in the lowest-level control sub-table, then any application process is moved from the current control sub-table to a lower-level control sub-table; if any application process is in the lowest-level control sub-table, then any application process is moved out of the multi-level control list.
[0073] In this embodiment, for application processes that are in the multi-level control column but currently have normal usage, the application processes with normal usage are controlled by gradually moving them out of the multi-level control column according to the number of consecutive times of normal usage. In this way, a step-by-step fallback mechanism is used when the CPU usage score of the application drops below the score threshold, which further guarantees the life cycle of the application process under reasonable CPU usage.
[0074] Step S240: If there is an abnormality, any application process is moved into the multi-level control list level by level, and any application process is dynamically controlled.
[0075] It should be noted that the multi-level control list includes multiple control sub-tables, each control sub-table is a different control level, and is used to control application processes with different consecutive abnormal processor usage times. Therefore, the method of moving any application process into the multi-level control list is also to move it in step by step.
[0076] In addition, in the multi-level control list, because the controlled application processes may be in different control sub-tables, the application processes may be moved out or moved in according to the normal or abnormal usage results. According to the specific location information of the application process in the multi-level control list, each controlled application process is dynamically moved step by step in the different control sub-tables of the multi-level control list, thereby realizing dynamic control of each application process and hierarchical control of processor resources, that is, including multi-level control and fallback mechanism for abnormal CPU usage of each application process, so that the CPU usage of each application process is controlled under this mechanism, thus ensuring the smoothness of system operation.
[0077] In one embodiment, any application process is moved into the multi-level control list step by step, including: if any application process is not in the multi-level control list, then any application process is moved into the lowest-level control sub-table; if any application process is in the multi-level control list, and any application process is not in the highest-level control sub-table, then any application process is moved from the current control sub-table to a higher-level control sub-table, until any application process is terminated from the highest-level control sub-table.
[0078] In this embodiment, when it is determined that the usage rate of any application process is abnormal, the processor resource control of any application process is performed according to its position information in the multi-level control list. If any application process is not in the multi-level control list, any application process is moved into the lowest-level control sub-table for control. If any application process is not in the highest-level control sub-table, any application process is moved from the current control sub-table to a higher-level control sub-table for control. If any application process is in the highest-level control sub-table, any application process is terminated, that is, the usage rate in the highest-level control sub-table is abnormal, indicating that the arbitrary application process has reached the preset continuous abnormal number threshold, its control level is the highest level, and its usage rate is abnormal. The situation is serious, so any application process is terminated. Through the multi-level control mechanism with abnormal usage, the life cycle of the application process with abnormal usage is limited, thereby improving the smoothness of system operation.
[0079] In this way, by moving the application process step by step into the highest-level control subtable according to the number of consecutive abnormal usage rates, the degree of processor resource control over the application process can be gradually improved until any application process is terminated, thereby achieving multi-level control of processor resources.
[0080] In a possible embodiment, when an application process is terminated from the highest-level control sub-table of the multi-level control list, all application processes in the highest-level control sub-table that still have abnormal usage rates are terminated, or, based on the system processor usage (such as total resource consumption not exceeding a certain threshold), at least one of these application processes is terminated according to a preset termination policy, wherein the termination policy is based on the importance level of the application process (application processes with higher levels are terminated later), the running status (background application processes are terminated first), or the CPU usage of the application process (application processes with higher CPU usage are terminated first), etc.
[0081] In this way, the life cycle of each application process can be effectively protected while ensuring the system operation performance.
[0082] See also Figure 5 , Figure 5 FIG. 1 is a flowchart of a three-level processor resource control method shown in an exemplary embodiment of the present application. Figure 5 As shown, the multi-level control list includes three control sub-tables, which are the process marking list, the abnormal process list and the process list to be terminated according to the number of consecutive abnormal usage rates from low to high. This three-level control method for processor resources is suitable for vehicle-mounted systems.
[0083] First, preset the application process whitelist to the car system. After the car system is started, the car system starts to run. At this time, start monitoring the processor usage of each application process. Monitor once every period of time, and each monitoring enters the same process. First filter the whitelist processes, and then judge the normal and abnormal processor usage of each application process based on the processor usage of each application process. Move the application process with abnormal usage into the corresponding control list until the application process is killed, and move the application process with normal usage into the lower-level control list until it is completely removed from the control list. Among them, the three-level control of abnormal CPU usage of application processes includes: when the CPU usage of an application process is detected to be abnormal, the application process will enter the process marking list in turn. If the CPU usage of the application process is still abnormal next time, the application process will be moved to the abnormal process list, and so on, it will be moved to the list of processes to be terminated, until the next detection, there is still an abnormal CPU usage of the application process in the list of processes to be terminated, and the application process will be forcibly terminated; the fallback mechanism for normal CPU usage of the application process includes: when the CPU usage of the application process is normal, the fallback mechanism will roll back the application process in the previous list of the corresponding process list, the application process in the process list to be terminated will be rolled back to the abnormal process list, the application process in the abnormal process list will be rolled back to the marked process list, and the application process in the marked process list will be removed from the monitoring, and the judgment of normal and abnormal processor usage of each application process will continue.
[0084] See also Figure 6 , Figure 6 FIG. 1 is a flowchart of a specific processor resource control method shown in an exemplary embodiment of the present application. Figure 6 As shown, Figure 6 As shown, the specific processor resource control method is applicable to the vehicle system, and the steps are detailed as follows:
[0085] 1. After the car system is started, start the ActivityManagerService service (that is, the system service responsible for system application life cycle management, process management and user interaction functions);
[0086] 2. Start PerfMonitor (i.e., performance monitor) and enable the processor usage monitoring and processing function of the application process. Among them, PerfMonitor is a newly added core module for monitoring and processing abnormal CPU usage of vehicle-mounted applications. This module is divided into two parts: one is the multi-dimensional CPU usage scoring module, and the other is the multi-level control processing module;
[0087] 3. PerfMonitor reads the whitelist process configuration file, parses the application package name, and determines the whitelist process;
[0088] 4. PerfMonitor obtains multiple instantaneous usage rates of the processor for each application process every preset time period (such as 1 second);
[0089] 5. Filter whitelist processes based on application package name;
[0090] 6. Determine whether the utilization rate of the processor is normal according to multiple instantaneous utilization rates of each application process;
[0091] 7. If the application process is determined to be an abnormal usage process in this usage detection, first check whether the list of processes to be terminated contains the application process. If so, terminate the application process; if the list of processes to be terminated does not contain the application process, continue to search the abnormal process list; if the abnormal process list contains the application process, move the application process to the list of processes to be terminated; if the abnormal process list does not contain the application process, continue to search the marked process list; if the marked process list contains the application process, move the application process to the abnormal process list; if the marked process list does not contain the application process, move the application process to the marked process list;
[0092] 8. If the usage rate of the application process is normal in this usage rate detection, first check whether the list of processes to be terminated contains the application process. If so, roll back the application process to the abnormal process list; if the list of processes to be terminated does not contain the application process, continue to query the abnormal process list; if the abnormal process list contains the application process, roll back the application process to the marked process list; if the abnormal process list does not contain the application process, continue to search the marked process list; if the marked process list contains the application process, remove the application process from the marked process list.
[0093] The above-mentioned processor resource control method first obtains multiple instantaneous usage rates of the processor for each application process, and then for any application process, determines whether the processor usage rate of any application process is normal based on the multiple instantaneous usage rates. If the processor usage rate is normal, any application process is gradually moved out of the multi-level control list, wherein the multi-level control list is used to hierarchically control application processes with abnormal processor usage rates. If the processor usage rate is abnormal, any application process is gradually moved into the multi-level control list, and any application process is dynamically controlled. By judging whether the processor usage rate of any application process is normal or abnormal through multiple instantaneous usage rates, the reliability of the judgment result is improved, and by setting a multi-level control list, combined with the accurate results of whether the processor usage rate of each application process is normal or abnormal, the application process with abnormal processor usage rate is subjected to multi-level control processing, so that the processor resource occupancy of each application process runs under this mechanism, which can ensure that the processor usage rate of each application process in the system is within a reasonable range, thereby improving the system operation smoothness and improving the system operation performance.
[0094] See also Figure 7 , Figure 7 is a block diagram of a processor resource management system shown in an exemplary embodiment of the present application. The system can be applied to Figure 1 The implementation environment shown is a schematic diagram. It should be understood that the system may also be applicable to other exemplary implementation environments, and this embodiment does not limit the implementation environment to which the system is applicable.
[0095] like Figure 7 As shown, in an exemplary embodiment, the processor resource management and control system 700 includes at least an acquisition module 710, a determination module 720 and a management and control module 730, which are described in detail as follows:
[0096] An acquisition module 710 is used to acquire multiple instantaneous usage rates of each application process on the processor;
[0097] A determination module 720 is used to determine whether the processor usage rate of any application process is normal according to a plurality of instantaneous usage rates.
[0098] The control module 730 is used to remove any application process from the multi-level control list step by step if it is normal. The multi-level control list is used to store and manage application processes with abnormal processor usage rate under hierarchical control;
[0099] The control module 730 is also used to move any application process into a multi-level control list level by level if there is an abnormality, so as to dynamically control any application process.
[0100] It should be noted that the processor resource management system provided in the above embodiment and the processor resource management method provided in the above embodiment belong to the same concept, wherein the contents of the operations performed by each module have been described in detail in the method embodiment and will not be repeated here.
[0101] See also Figure 8 , Figure 8 It is a structural schematic diagram of a vehicle-mounted terminal provided by an exemplary embodiment of the present application. Figure 8 The structure diagram of the computer system of the vehicle terminal suitable for implementing the embodiment of the present application is shown. It should be noted that: Figure 8 The computer system 800 of the vehicle-mounted terminal shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0102] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 802 or the program loaded from the storage part 808 to the random access memory (RAM) 803, such as executing the method in the above embodiment. In RAM 803, various programs and data required for system operation are also stored. CPU 801, ROM 802 and RAM 803 are connected to each other through bus 804. Input / output (I / O) interface 805 is also connected to bus 804.
[0103] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read therefrom is installed into the storage section 808 as needed.
[0104] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 809, and / or installed from a removable medium 811. When the computer program is executed by a central processing unit (CPU) 801, various functions defined in the system of the present application are executed.
[0105] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer executes the processor resource management method as described above. The computer-readable storage medium may be included in the vehicle-mounted terminal described in the above embodiment, or may exist independently without being assembled into the vehicle-mounted terminal.
[0106] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0107] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0108] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0109] The above embodiments are merely illustrative of the principles and effects of the present application, and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A processor resource management method, characterized in that: The method comprises: Obtain multiple instantaneous utilization rates of each application process on the processor; For any application process, judging whether the processor usage rate of any application process is normal according to the multiple instantaneous usage rates; If normal, any of the application processes are removed from the multi-level control list step by step, and the multi-level control list is used to hierarchically control application processes with abnormal processor usage; If there is an abnormality, any of the application processes will be moved into the multi-level control list level by level, and any of the application processes will be dynamically controlled.
2. The processor resource management method according to claim 1, characterized in that: The configuration method of the multi-level control list includes: Divide into multiple control levels according to the number of consecutive abnormal usage rates from low to high; According to the plurality of control levels, a plurality of control sub-tables are configured from low to high to generate the multi-level control list.
3. The processor resource management method according to claim 2, characterized in that: The step of moving any of the application processes into the multi-level control list step by step includes: If any of the application processes is not in the multi-level control list, any of the application processes is moved into the lowest-level control sub-list; If any of the application processes is in the multi-level control list and is not in the highest-level control sub-list, then any of the application processes will be moved from the current control sub-list to a higher-level control sub-list until any of the application processes is terminated from the highest-level control sub-list.
4. The processor resource management method according to claim 2, characterized in that: The step of gradually removing any of the application processes from the multi-level control list includes: If any of the application processes is not in the lowest-level control subtable, any of the application processes is moved from the current control subtable to a lower-level control subtable; If any of the application processes is in the lowest-level control sub-list, any of the application processes will be removed from the multi-level control list.
5. The processor resource management method according to claim 1, characterized in that: The determining whether the processor usage rate of any of the application processes is normal according to the multiple instantaneous usage rates includes: Counting the number of the multiple instantaneous usage rates, and calculating the average value of the multiple instantaneous usage rates; Calculating an average value score according to the average value and a preset average value scoring standard, and calculating an instantaneous value score according to the quantity and a preset instantaneous value scoring standard; Whether the processor usage rate of any of the application processes is normal is determined according to the average value score and the instantaneous value score.
6. The processor resource management method according to claim 5, characterized in that: The determining whether the processor usage rate of any of the application processes is normal according to the average value score and the instantaneous value score includes: Performing weighted calculation on the average value score and the instantaneous value score to obtain a target score; Comparing the target score with a preset score threshold; If the target score is less than or equal to the score threshold, determining that the processor usage rate of any of the application processes is normal; If the target score is greater than the score threshold, it is determined that the processor usage rate of any of the application processes is abnormal.
7. The processor resource management method according to claim 1, characterized in that: Before judging whether the processor usage rate of any of the application processes is normal according to the multiple instantaneous usage rates, the method further includes: Setting an application process whitelist, wherein the application processes in the application process whitelist are not subject to hierarchical control of processor resources; If any of the application processes is in the application process whitelist, no hierarchical control will be performed on any of the application processes; If any of the application processes is not in the application process whitelist, a determination operation is performed as to whether the processor usage rate is normal.
8. A processor resource management and control system, characterized in that: The system comprises: An acquisition module, used for acquiring multiple instantaneous utilization rates of each application process on the processor; A judgment module, used for judging whether the processor usage rate of any application process is normal according to the multiple instantaneous usage rates; A control module, used for, if normal, removing any of the application processes step by step from a multi-level control list, wherein the multi-level control list is used for storing and managing application processes with abnormal processor usage rates under hierarchical control; The control module is also used to move any of the application processes into the multi-level control list level by level if there is an abnormality, so as to dynamically control any of the application processes.
9. A vehicle-mounted terminal, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the vehicle terminal to implement the processor resource management method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the processor resource management and control method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Electronic equipment power consumption reduction method and device and electronic equipment with display screen
CN105528052A
Information processing method and terminal
CN106685752A
Method and device for adjusting CPU utilization rate based on PID controller, terminal and medium
CN110647437A
Resource management method, device, equipment, medium and product
CN114116230A
Application running method, apparatus, electronic device and storage medium
WO2024052744A1