Central processing unit resource scheduling method, device and storage medium

By obtaining the running information of the thread and the instruction throughput of the CPU core, and allocating CPU resources in order of operation priorities, the problem of inability to schedule CPU resources in multi-core processors is solved, and the stability and high quality of audio and video playback are achieved.

CN118860676BActive Publication Date: 2025-03-11SHENZHEN TENDZONE INTELLIGENT TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411365527.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-03-11
Estimated Expiration
2044-09-29

AI Technical Summary

Technical Problem

The central processing unit resources cannot be scheduled in real time in a multi-core processor, resulting in abnormal situations such as delay in audio and video playback, lag, and image screen loss.

Method used

By obtaining the thread's running information, including the node's running priority and instruction consumption, if the node does not have a specified running core, the total instruction consumption of the thread is determined based on the instruction consumption, and the total instruction throughput of the CPU core is determined based on the instruction throughput of the CPU core. If the total instruction consumption is greater than the total instruction throughput, the nodes will be allocated in order of operation priority to realize real-time scheduling.

Benefits of technology

It realizes automatic real-time scheduling of central processing unit resources, avoids CPU core overload, and improves the stability and quality of audio and video playback.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860676B_ABST
    Figure CN118860676B_ABST
Patent Text Reader

Abstract

The present application discloses a central processing unit resource scheduling method, device and storage medium, relates to the field of data processing technology, and discloses a central processing unit resource scheduling method, comprising: obtaining the running information of the thread that issues the resource application, the running information including the running priority of the node in the thread and the instruction consumption of the node when running; if the node does not have a designated running core, determining the total instruction consumption of the thread according to the instruction consumption; determining the total instruction throughput of the central processing unit according to the instruction throughput of multiple cores of the central processing unit; if the total instruction consumption is greater than the total instruction throughput, allocating the central processing unit resources to the nodes in the order of the running priority, so as to realize automatic real-time scheduling of the central processing unit resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a central processing unit resource scheduling method, device and storage medium. Background Art

[0002] Audio and video processing systems usually need to process a large amount of data and have extremely high requirements for real-time performance. In such systems, the central processing unit (CPU) is the core processing unit, and its full performance is crucial to ensure the quality of audio and video playback.

[0003] At present, audio and video processing systems generally use multi-core CPUs to improve data processing capabilities. However, these systems often rely on static allocation by R&D personnel in resource management, or simply specify threads to be bound to CPU cores for operation. However, in actual operation, when a specified thread is bound to a CPU core for operation, the occupancy rate of a certain CPU core may reach 100%, resulting in the task running on the core not being able to obtain timely resource scheduling, causing abnormalities such as delays, freezes, and image distortion in audio and video playback.

[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of the present application is to provide a central processing unit resource scheduling method, device and storage medium, aiming to solve the technical problem that the central processing unit resources cannot be scheduled in real time in a multi-core processor.

[0006] To achieve the above objectives, the present application proposes a central processing unit resource scheduling method, the method comprising:

[0007] Acquire the running information of the thread that issues the resource request, wherein the running information includes the running priority of the node in the thread and the instruction consumption of the node when running;

[0008] If the node does not have a designated running core, determining the total instruction consumption of the thread according to the instruction consumption;

[0009] Determining a total instruction throughput of the central processing unit according to instruction throughputs of multiple cores of the central processing unit;

[0010] If the total instruction consumption is greater than the total instruction throughput, the central processing unit resources are allocated to the nodes in the order of the execution priority.

[0011] In one embodiment, after the step of determining the total instruction throughput of the central processing unit according to the instruction throughputs of the multiple cores of the central processing unit, the step further includes:

[0012] If the total instruction consumption is less than or equal to the total instruction throughput, the central processing unit resources are evenly allocated to each of the nodes, wherein the nodes with large instruction consumption are preferentially allocated to the core with large instruction throughput for operation.

[0013] In one embodiment, after the step of obtaining the running information of the thread that issues the resource request, the method further includes:

[0014] If the designated running core exists for the node, the node is allocated to run in the designated running core.

[0015] In one embodiment, the node includes an independent node and a dependent node, the dependent node represents a node in the thread that has a dependent relationship with other nodes, and the step of allocating the central processing unit resources to the nodes in the order of the running priority includes:

[0016] Traversing the independent nodes according to the running priority order of the independent nodes, and allocating the central processing unit resources to the current independent node being traversed, wherein the current independent node is preferentially allocated to the core with a large instruction throughput for running;

[0017] Obtaining remaining instruction throughputs of the plurality of cores after executing the current independent node resource allocation;

[0018] If the remaining instruction throughputs of the multiple cores are all less than or equal to a preset throughput threshold, stopping allocating resources to the independent node;

[0019] If the remaining instruction throughput of the plurality of cores is greater than the preset throughput threshold, allocating the central processing unit resources to the next independent node of the current independent node;

[0020] If all the independent nodes are allocated, the central processing unit resources are allocated to the dependent nodes.

[0021] In one embodiment, if all the independent nodes are allocated, the step of allocating the central processing unit resources to the dependent nodes includes:

[0022] Determine a target core having a maximum remaining instruction throughput;

[0023] Determine target instruction consumption of the dependent node and other nodes having the dependent relationship;

[0024] When the remaining instruction throughput of the target core is greater than or equal to the target instruction consumption, allocating the dependent node and other nodes having the dependent relationship with the dependent node to the target core for execution;

[0025] When the remaining instruction throughput of the target core is less than the target instruction consumption, the independent nodes in the target core are released according to the execution priority order until the remaining instruction throughput of the target core is greater than or equal to the target instruction consumption.

[0026] In one embodiment, before the step of obtaining the running information of the thread that issues the resource request, the method further includes:

[0027] Based on a preset number of thread running tests, the number of instructions consumed by the nodes in the thread running within a preset time is obtained through command instructions of the operating system;

[0028] An average value of the number of instructions is obtained, and the average value is used as the instruction consumption of the node.

[0029] In one embodiment, the method further comprises:

[0030] Detecting the occupancy rate of the core where the node in the thread is located;

[0031] If the occupancy rate exceeds a preset occupancy threshold, the central processing unit resources are reallocated to the node.

[0032] In one embodiment, the step of reallocating the CPU resources to the threads comprises:

[0033] Obtaining historical resource allocation results and historical occupancy rates of cores corresponding to the historical resource allocation results;

[0034] constructing a sample set based on the historical resource allocation results and the historical occupancy of the core;

[0035] Based on the sample set, construct and train a central processing unit resource allocation model;

[0036] A resource allocation strategy is determined based on the central processing unit resource allocation model, and the central processing unit resources are reallocated to the nodes according to the resource allocation strategy.

[0037] In addition, to achieve the above-mentioned purpose, the present application also proposes a central processing unit resource adjustment device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the central processing unit resource adjustment method as described above.

[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the central processing unit resource adjustment method described above are implemented.

[0039] The present application obtains the running information of the thread that issues the resource request, the running information including the running priority of the node in the thread and the instruction consumption when the node is running; if the node does not have a designated running core, the total instruction consumption of the thread is determined according to the instruction consumption; the total instruction throughput of the central processing unit is determined according to the instruction throughput of multiple cores of the central processing unit; if the total instruction consumption is greater than the total instruction throughput, the central processing unit resources are allocated to the nodes in the order of running priority, thereby realizing automatic real-time scheduling of the central processing unit resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0042] Figure 1 A flowchart of the first embodiment of the method for scheduling resources of a central processing unit of the present application is provided;

[0043] Figure 2 This is an example diagram of the thread running information description provided in the first embodiment of the present application;

[0044] Figure 3 This is an example diagram of node operation information provided in Example 1 of the present application;

[0045] Figure 4 This is an example diagram of node operation information provided in Example 1 of the present application;

[0046] Figure 5 This is an example diagram of the CPU core information description provided in Example 1 of the present application;

[0047] Figure 6 This is an example diagram of CPU core information provided in Example 1 of the present application;

[0048] Figure 7 A schematic diagram of a method flow provided for the first embodiment of the method for scheduling resources of a central processing unit of the present application;

[0049] Figure 8 A schematic diagram of a method flow provided for the first embodiment of the method for scheduling resources of a central processing unit of the present application;

[0050] Fig. 9 A flowchart diagram of the second embodiment of the method for scheduling resources of a central processing unit of the present application;

[0051] Fig.10 A flowchart of the third embodiment of the method for scheduling resources of a central processing unit of the present application is provided;

[0052] Fig.11 A flowchart diagram of a fourth embodiment of the method for scheduling resources of a central processing unit of the present application;

[0053] Fig.12 A flowchart diagram of a fifth embodiment of the method for scheduling resources of a central processing unit of the present application;

[0054] Fig.13 A schematic diagram of a method flow provided for the fifth embodiment of the method for scheduling resources of a central processing unit of the present application;

[0055] Fig.14 A schematic diagram of a brief process flow of a method for scheduling resources of a central processing unit in an embodiment of the present application;

[0056] Fig.15 This is a schematic diagram of the operation logic of the central processing unit resource scheduling module in an embodiment of the present application;

[0057] Fig.16 Schematic diagram of the device structure of the hardware operating environment involved in the central processing unit resource scheduling method in the embodiment of the present application.

[0058] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0059] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0060] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0061] In audio and video processing systems, multi-core CPUs are widely used to enhance data processing efficiency due to the need to process massive amounts of data in real time. However, the system often relies solely on manual static allocation by R&D personnel for resource management, or simply assigns threads to specific CPU cores. In actual operation, this fixed core binding may cause the utilization of a certain CPU core to rise to 100%, making it impossible for tasks executed on that core to obtain immediate resource allocation, ultimately causing problems such as delays, stagnation, and even image distortion in audio and video playback.

[0062] In view of the above problems, the present application proposes a central processing unit resource scheduling method, which obtains the running information of the thread that issues the resource request, the running information includes the running priority of the node in the thread and the instruction consumption when the node is running; if the node does not have a designated running core, the total instruction consumption of the thread is determined according to the instruction consumption; according to the instruction throughput of multiple cores of the central processing unit, the total instruction throughput of the central processing unit is determined; if the total instruction consumption is greater than the total instruction throughput, the central processing unit resources are allocated to the nodes in the order of running priority, so as to realize real-time scheduling of the central processing unit resources.

[0063] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, etc., or an electronic device that can realize the above functions. The following takes the central processing unit resource scheduling module as an example to illustrate this embodiment and the following embodiments.

[0064] Based on this, the first embodiment proposed in this application provides a central processing unit resource scheduling method, referring to Figure 1 In this embodiment, the central processing unit includes multiple cores, the cores are used to process one or more threads, the threads include one or more nodes, and the central processing unit resource scheduling method includes steps S10 to S40:

[0065] Step S10, obtaining the running information of the thread that issues the resource request, wherein the running information includes the running priority of the node in the thread and the instruction consumption when the node is running.

[0066] It should be noted that a thread is an execution unit running on the CPU, including one or more nodes. It is an independently executed sequence in the operating system and is responsible for executing program code to complete specific tasks. A node represents the smallest execution unit in a thread, represents a specific task or functional module in the thread, and is responsible for completing a specific function in the thread. For example, a video processing thread contains multiple nodes such as video acquisition, video encoding, and video transmission. The running priority refers to the priority of the node execution, which is used to determine the order of resource allocation. Nodes with high running priorities will be given priority to obtain more CPU resources to ensure the timely execution of key tasks. Instruction consumption refers to the number of CPU instructions consumed when a node is running, reflecting its resource requirements, and is used to evaluate the node's occupancy of CPU resources and control resource allocation.

[0067] Optionally, the nodes can be divided into interrupt processing nodes and running nodes. The interrupt processing nodes are responsible for processing interrupt signals, such as network interruption, device interruption, etc.; the running nodes are responsible for performing audio and video processing tasks, such as audio and video encoding, decoding, scaling, etc.

[0068] Exemplarily, the thread running information is described by JSON (JavaScript Object Notation). Specifically, JSON is defined to describe the node running information, including the name, type, running priority, running mode, CPU instruction consumption, other node arrays with bound dependencies, CPU binding type, and bound CPU core name of the node in the thread. Optionally, refer to Figure 2 , the running information of the node includes "node running name", "type", "priority", "running mode", "CPU instruction consumption", "bound other node array", "binding type" and the specified CPU core when forcibly binding. Among them, "type" includes independent interrupt, multiple groups of interrupt, entity interrupt, running node, other interrupt and other running nodes; "priority" uses the value 0~100 to indicate the priority of thread running; "running mode" includes first in first out (fifo), polling (rr), interrupt (interrupt); in "CPU instruction consumption", "0" is used to indicate dynamic consumption, that is, the number of instructions consumed by the node needs to be monitored and adjusted in real time, and other values ​​are used to indicate the specific number of CPU instructions consumed; "binding type" includes forced binding and dynamic binding.

[0069] In order to better understand the solution provided in this implementation, this example is further explained.

[0070] Optionally, in the node type, the interrupt processing node can be divided into independent interrupt, multiple interrupt groups, entity interrupt and common interrupt. Independent interrupt refers to the interrupt processing node associated with a specific audio and video thread node, such as the capture interrupt processing node cap chip[0] corresponding to the video capture node vcap[0]; the entity interrupt refers to the interrupt processing node of a single independent processing logic, such as the video input (Video Interface, VI) interrupt processing node, the video output (Video Output, VO) interrupt processing node, the mobile industry processor interface (Mobile Industry Processor Interface, MIPI) receiving interrupt processing node, etc., which are generated by specific hardware devices, such as cameras, displays, MIPI, etc.; multiple interrupt groups refer to multiple interrupt groups corresponding to CPU hardware resources, which are generated by multiple hardware modules inside the CPU, such as the video pre-processing subsystem (Video Pre-Processing Subsystem, VPSS), the video encoding and decoding unit (Video Encoding and Decoding Unit, VEDU), etc.; the common interrupt is generated by common resources, such as general-purpose input / output chips, Ethernet, etc., and is dynamically bound to the CPU hardware resources.

[0071] Optionally, the priority value is used to determine the operation priority of the node according to the importance of the node and the resource demand. The CPU resource scheduling module allocates the node to a suitable CPU core for operation according to the priority value of the node, so as to more accurately allocate and schedule resources. Among them, the priority value can be dynamically adjusted as needed. For example, if a node has a processing delay, the CPU resource scheduling module can temporarily increase its priority value so that it can obtain more CPU resources to support the operation of the node.

[0072] Optionally, the operation modes include first-in-first-out, polling and interrupt. First-in-first-out means that the node processes data in the order in which it arrives, and the data that arrives first is processed first; polling means that the node periodically checks whether there is data to be processed, and if there is data, it processes it. Compared with the first-in-first-out operation mode, polling is used in scenarios where data arrives quickly and needs to be processed in a timely manner, but it takes up more CPU resources for polling; interrupt means that when the hardware device generates an interrupt signal, the CPU suspends the execution of the current task and executes the interrupt handler instead, which is applied to the interrupt processing node.

[0073] Optionally, the CPU binding type includes mandatory binding and dynamic binding. Mandatory binding means that the node needs to run on a specified CPU core, and dynamic binding means that the node is dynamically assigned to a suitable CPU core for running according to the instruction consumption and running priority of the node.

[0074] For example, "FIFO" indicates the first-in-first-out mode, "RR" indicates the polling mode, and "-" indicates the interrupt mode. In the description of CPU instruction consumption, "0" indicates that the node is dynamically consumed and the number of CPU instructions consumed by the node during operation needs to be monitored and adjusted in real time; other values ​​indicate the instruction consumption of the node. Figure 3 and Figure 4 , Figure 3 and Figure 4 The running information of two thread nodes is given. Figure 3 The node represented is a network sending node with the node name "netsend". It is a running node with a running priority of 20. It uses polling to occupy the CPU. The CPU instruction consumption is 50000. It has a dependency relationship with the cap chip node and the venc node, and is dynamically bound to the CPU. Figure 4 The node represented is the network card interrupt processing node, the node name is "ethernet", belongs to multiple interrupt groups, the running priority is 20, the running mode is interrupt, the instruction consumption needs to be detected and obtained in real time, and the CPU is dynamically bound.

[0075] Step S20: If the node does not have a designated running core, determine the total instruction consumption of the thread according to the instruction consumption.

[0076] Step S30, determining the total instruction throughput of the central processing unit according to the instruction throughputs of the multiple cores of the central processing unit.

[0077] If the CPU binding type of the node is dynamic binding, and there is no specified running core, determine all nodes included in the thread, obtain its individual instruction consumption for each node, add up the instruction consumption of all nodes in the thread, and the accumulated result is the total instruction consumption of the thread, which represents the total number of CPU instructions required to run the entire thread. In the same way, the total instruction throughput of the CPU is obtained, which represents the total number of instructions that the entire CPU can execute per unit time.

[0078] It should be noted that the instruction throughput of multiple cores refers to the number of instructions that the CPU core can process per unit time, reflecting the processing power of the CPU core.

[0079] Optionally, describe the CPU core information using JSON, including the CPU name, CPU core serial number, and CPU core instruction throughput.

[0080] For example, refer to Figure 5 and Figure 6 , Figure 5This is an example diagram describing the CPU core information, including "CPU core naming", "Processor ID", and "CPU instruction capability". Figure 6 This is an example diagram of information corresponding to a specific CPU core. Figure 6 The CPU core represented is named "test2024" and "Processor id" is "0". This CPU core can process 4800000 CPU instructions per second.

[0081] Optionally, an accumulation algorithm is preset in the central processing unit resource scheduling module, through which all nodes in the thread are traversed, the instruction consumption of each node is accumulated, and finally the total instruction consumption of the thread is obtained, wherein the accumulation process can be performed before the thread is started, or it can be dynamically updated during the operation. Similarly, all cores in the CPU are traversed by the algorithm, the instruction throughput of each CPU core is accumulated, and finally the total instruction throughput of the CPU is obtained, which can be accumulated before the thread is run, or it can be updated according to the dynamic state of the CPU core during the operation.

[0082] Step S40: if the total instruction consumption is greater than the total instruction throughput, the central processing unit resources are allocated to the nodes in the order of the running priorities.

[0083] Compare the total instruction consumption of the thread with the total instruction throughput of the CPU. If the total instruction consumption exceeds the total instruction throughput, it means that the CPU's processing capacity is insufficient to meet the thread's needs. In this case, it is necessary to allocate CPU resources to the nodes in order of their running priorities. Nodes with high running priorities get resources first to ensure timely processing of critical tasks.

[0084] In a feasible implementation manner, the node includes an independent node and a dependent node, wherein the dependent node represents a node in the thread that has a dependent relationship with other nodes, Figure 7 , step S40 includes steps S41 to S45:

[0085] Step S41, traversing the independent nodes according to the running priority order of the independent nodes, and allocating the central processing unit resources to the current independent node being traversed, wherein the current independent node is preferentially allocated to the core with a large instruction throughput for running.

[0086] Step S42, obtaining the remaining instruction throughput of the multiple cores after executing the current independent node resource allocation.

[0087] Step S43: if the remaining instruction throughputs of the multiple cores are all less than or equal to a preset throughput threshold, stop allocating resources to the independent node.

[0088] Step S44: if the remaining instruction throughput of the multiple cores is greater than the preset throughput threshold, the central processing unit resources are allocated to the next independent node of the current independent node.

[0089] According to the running priority of the independent node, starting from the highest running priority, each independent node is processed one by one and CPU resources are allocated to it. Traverse each independent node in the thread and allocate the current independent node to the CPU core with large instruction throughput to ensure that it can be executed efficiently. After allocating CPU resources to the current independent node, check the remaining instruction throughput of each CPU core, that is, the remaining instruction processing capacity of the CPU core. If the remaining instruction throughput of the CPU core is greater than the preset throughput threshold after allocating resources to the current independent node, it means that the CPU resources are sufficient and continue to process the next independent node. If the remaining instruction throughput of all CPU cores is equal to or less than the preset throughput threshold after allocating resources to the current independent node, it means that the CPU core is close to full load. At this time, stop allocating resources to the independent node to avoid overloading the CPU core. Wait until the remaining instruction throughput of the CPU core is equal to or greater than the preset throughput threshold before continuing to allocate resources.

[0090] Step S45: if all the independent nodes are allocated, the central processing unit resources are allocated to the dependent nodes.

[0091] Optionally, refer to Figure 8 , step S45 includes steps S451 to S454:

[0092] Step S451, determining the target core with the maximum remaining instruction throughput.

[0093] Step S452, determining the target instruction consumption of the dependent node and other nodes having the dependent relationship.

[0094] Step S453: when the remaining instruction throughput of the target core is greater than or equal to the target instruction consumption, the dependent node and other nodes having the dependent relationship with the dependent node are allocated to the target core for execution.

[0095] Step S454, when the remaining instruction throughput of the target core is less than the target instruction consumption, releasing the independent nodes in the target core according to the execution priority order until the remaining instruction throughput of the target core is greater than or equal to the target instruction consumption.

[0096] It should be noted that in a multi-core processor system, the execution of a thread usually depends on the various nodes within it. Some nodes have dependencies, that is, the execution of one node depends on the completion of another node to ensure that the entire thread can be executed smoothly. For example, in the audio and video processing thread, the video encoding node depends on the completion of the video acquisition node.

[0097] When processing dependent nodes, consider assigning nodes with dependencies to the same CPU core for execution, and ensure that the CPU core has sufficient processing power to provide the fastest processing speed, thereby reducing the waiting time of dependent nodes. Once the target core is determined, the dependent node and other nodes with dependencies on the dependent node are assigned to this target core for execution, ensuring that the dependent nodes can be executed according to their dependencies without reducing execution efficiency due to communication delays between CPU cores.

[0098] After allocating independent nodes, check the current load of each CPU core and find the target core with the largest remaining instruction throughput among all available CPU cores. Calculate the target instruction consumption of each related node based on the thread's running information and the node's dependencies. If the remaining instruction throughput of the target CPU core is greater than or equal to the target instruction consumption of these dependent nodes, allocate them directly; if the remaining instruction throughput of the target core is less than the required target instruction consumption, release the independent nodes with lower priorities based on the running priority to increase the available resources of the target core and ensure the stable operation of the dependent nodes. When the dependent nodes are allocated, the previously released independent nodes with lower priorities are allocated to the CPU cores based on the remaining instruction throughput of the available CPU cores to run until the entire thread task is completed.

[0099] By dynamically adjusting the nodes in the CPU core, some low-priority independent nodes can be released so that more resources can be allocated to dependent nodes, ensuring that dependent nodes can be executed in time, thereby improving the execution efficiency of the entire thread. Because dependent nodes usually need to exchange data with other nodes, if they can be executed in time, the execution speed of the entire thread will be faster.

[0100] Optionally, all independent nodes and dependent nodes are sorted in order of running priority, and the nodes are traversed in order of running priority, and central processing unit resources are allocated to the current traversed node, wherein the current node is preferentially allocated to a CPU core with a large instruction throughput for execution, and if the current node is a dependent node, the target core with the largest remaining instruction throughput is determined, and the dependent node and other nodes that have a dependent relationship with the dependent node are allocated to the target core for execution.

[0101] Optionally, if the current node traversed is a dependent node, and the remaining instruction throughput of the target core is less than the total instruction consumption of the dependent node and other nodes that have a dependent relationship with the dependent node, stop allocating resources until the remaining instruction throughput of the target core is equal to or greater than the total instruction consumption of the dependent node and other nodes that have a dependent relationship with the dependent node, that is, when the target core has sufficient processing power to run the dependent node, the dependent node and other nodes that have a dependent relationship with the dependent node are allocated to the target core for operation.

[0102] In this embodiment, the instruction throughput of the CPU core is monitored in real time, and the remaining instruction throughput of each CPU core is updated. Resources are allocated according to the remaining instruction throughput, thereby ensuring more efficient allocation of CPU resources and ensuring that key tasks are given priority while avoiding resource waste and CPU core overload.

[0103] In this embodiment, by comprehensively considering the running priority and instruction consumption, the nodes are allocated to the CPU cores in the order of running priority, ensuring that important thread tasks are processed first, realizing real-time scheduling of CPU resources, and utilizing CPU resources more efficiently.

[0104] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Fig. 9 After step S30, the central processing unit resource scheduling method further includes step S50:

[0105] Step S50, if the total instruction consumption is less than or equal to the total instruction throughput, the central processing unit resources are evenly allocated to each of the nodes, wherein the nodes with large instruction consumption are preferentially allocated to the core with large instruction throughput for operation.

[0106] Compare the total instruction consumption of the thread with the total instruction throughput of the CPU. If the total instruction consumption does not exceed the total instruction throughput, it means that the CPU is capable of processing all nodes of the thread. On the premise of meeting the processing capacity, the nodes should be evenly distributed to different CPU cores to make full use of CPU resources and maintain load balance. On the basis of even distribution, the operating efficiency of the node also needs to be considered. Nodes with large instruction consumption may require faster response or higher processing efficiency, so they should be preferentially distributed to CPU cores with stronger performance.

[0107] Optionally, the nodes are polled and evenly distributed to different CPU cores to ensure that the instruction consumption of the nodes on each CPU core is a certain proportion of the instruction throughput of the CPU core, thereby fully utilizing the CPU resources.

[0108] Optionally, the nodes are sorted according to their running priorities. Starting from the node with the highest running priority, the nodes are allocated to the CPU cores that are currently idle and have the largest instruction throughput. If the instruction throughput of all CPU cores is the same, the allocation can be simply polled.

[0109] For example, it is assumed that an audio and video processing system contains multiple threads, and each thread is responsible for different processing links of audio and video, such as acquisition, encoding, decoding, transmission, etc. According to the characteristics of audio and video processing, the running priority of the node is obtained. For example, the video acquisition node has a higher running priority because it needs to process camera data in real time, assuming it is 80; the video encoding node and the video decoding node have a medium running priority because they need to process a large amount of data, assuming it is 50; and the audio encoding node and the audio decoding node have a lower running priority because the amount of data processed is small, assuming it is 20. In the order of video acquisition node, video encoding node, video decoding node, audio encoding node, and audio decoding node, the nodes are allocated to the CPU core that is currently idle and has the largest instruction throughput. If the instruction throughput of all CPU cores is the same, a CPU core is randomly selected to poll and allocate nodes. In this way, it can be ensured that nodes with high running priority get better resource guarantee, while maintaining CPU load balancing and ensuring the stability of the audio and video processing system.

[0110] Optionally, a certain amount of CPU resources are reserved for nodes with high running priority to ensure that these nodes always have sufficient processing power. Based on the reserved resources, the remaining resources are evenly distributed.

[0111] Exemplarily, according to the characteristics of audio and video processing, the running priority of the nodes in each thread in the audio and video processing system is evaluated. Usually, nodes with higher real-time requirements, such as video acquisition nodes, have higher running priorities, and certain CPU resources are reserved for such nodes to ensure that they can always obtain sufficient processing power. The reserved resources can be a certain proportion of the CPU's instruction throughput, or a fixed number of instructions. On the basis of the reserved resources, the remaining resources are evenly distributed to ensure that other tasks in the system can also obtain reasonable CPU resources. Among them, the allocation of reserved resources can be dynamically adjusted according to the running status of the thread. For example, when the load of the audio and video processing system is low, the reserved resources can be appropriately reduced; when the load of the audio and video processing system is high, the reserved resources can be appropriately increased.

[0112] In this embodiment, through uniform allocation and priority consideration, it is possible to better balance the utilization of CPU resources and the demand for task processing, thereby avoiding waste or overload of CPU resources.

[0113] Based on the above embodiment, in the third embodiment of the present application, the same or similar contents as those in the above embodiment can be referred to the above introduction, and will not be described in detail later. Fig.10 After step S10, the central processing unit resource scheduling method further includes step S60:

[0114] Step S60: If the node has the designated running core, the node is allocated to run in the designated running core.

[0115] It should be noted that in a multi-core processor system, when certain critical tasks or high-priority tasks need to be processed in real time, CPU forced binding may be adopted, that is, these tasks are bound to specific CPU cores for execution. For example, the video encoding node in the audio and video processing thread may be bound to a CPU core with higher floating-point computing capabilities because it involves complex mathematical operations.

[0116] When a resource request arrives, if the node has a designated running core, the CPU resource scheduling module directly assigns the node to run on the designated CPU core. This allocation method avoids recalculating and comparing the performance of different CPU cores, thus saving time and improving the system's response speed.

[0117] Optionally, if all nodes in the thread are independent nodes, the total instruction consumption of all independent nodes is calculated. If the total instruction consumption of all independent nodes is greater than the total instruction throughput of all CPU cores, CPU resources are allocated to all independent nodes according to the running priority order of the independent nodes; if the total instruction consumption of all independent nodes is less than or equal to the total instruction throughput of all CPU cores, CPU resources are evenly allocated to all independent nodes, wherein independent nodes with large instruction consumption are preferentially allocated to CPU cores with large instruction throughput for operation.

[0118] Optionally, if all nodes in the thread are dependent nodes, the total instruction consumption of all dependent nodes is calculated. If the total instruction consumption of all dependent nodes is greater than the total instruction throughput of all CPU cores, CPU resources are allocated to all dependent nodes according to the running priority order of the dependent nodes; if the total instruction consumption of all dependent nodes is less than or equal to the total instruction throughput of all CPU cores, CPU resources are evenly allocated to all dependent nodes. Dependent nodes with a dependency relationship are allocated to the same CPU core.

[0119] In this embodiment, different allocation strategies are adopted according to the node types in the threads applying for resources to achieve real-time scheduling of CPU resources and improve CPU resource utilization efficiency.

[0120] Based on the above embodiments, in the fourth embodiment of the present application, the same or similar contents as those in the above embodiments can be referred to the above introduction, and will not be described in detail later. Fig.11 Before step S10, the central processing unit resource scheduling method further includes steps S70 to S80:

[0121] Step S70, based on a preset number of thread running tests, the number of instructions consumed by the nodes in the thread running within a preset time is obtained through command instructions of the operating system.

[0122] Under certain conditions, the thread is tested a preset number of times to collect data on the thread's running performance. The thread running information is obtained using command instructions provided by the operating system, such as the perf stat instruction and the top instruction. The number of instructions executed by each node in the thread within the preset time is obtained to reflect the resource consumption of the node.

[0123] Optionally, when performing a thread running test, first set the thread running conditions, such as the number of runs, time, etc., execute the thread running test, record the number of instructions of each node within a preset time, collect test results, analyze the number of instructions of each node, and evaluate thread performance.

[0124] For example, the command "perf stat -i instructions -p<thread pid>" is used to record the instruction consumption of the thread. The "-i instructions" parameter is used to record the number of instructions, and the "-p<thread pid>" parameter is used to specify the process identifier of the thread to be monitored. Repeat the test project multiple times, and record the number of instructions consumed by the thread each time it is run to obtain more accurate data.

[0125] Step S80, obtaining an average value of the number of instructions, and using the average value as the instruction consumption of the node.

[0126] Collect the number of instructions consumed by all running processes and calculate the average value of the total number of instructions as a reference value for node instruction consumption for subsequent resource allocation and scheduling decisions. The CPU resource scheduling module decides how to allocate CPU resources based on the number of instructions consumed by the node to ensure system performance and stability.

[0127] For example, in a Linux system, create a test project that includes thread nodes A and B. Execute the test project to run in the target environment, simulate the real workload, let nodes A and B execute their tasks respectively, use the "perf stat -i instructions -p<thread pid>" command to record the instruction consumption of thread nodes A and B, and repeat this command multiple times to obtain sufficient data samples. Process these data and calculate the average value of the total number of instructions executed per second. Assume that data from 5 runs are collected, each run lasts 1 second, and the following instruction consumption data is obtained: the number of instructions consumed by node A in the 5 runs is: 1000, 1100, 1200, 1300, 1400. The number of instructions consumed by node B in the 5 runs is: 800, 750, 700, 650, 600. The average instruction consumption of computing node A is: (1000+1100+1200+1300+1400) / 5=1200, and the average instruction consumption of computing node B is: (800+750+700+650+600) / 5=725. 1200 is taken as the instruction consumption of node A, and 725 is taken as the instruction consumption of node B.

[0128] Optionally, the instruction consumption of the node is detected in real time, and the instruction consumption of the node is adjusted according to the application situation.

[0129] For example, video acquisition usually requires real-time processing because video data is continuously generated. If the acquisition speed cannot keep up, video data may be lost. The instruction consumption of the node during operation can be detected in real time or a larger instruction consumption can be preset for the node so that the node can obtain more CPU resources when resources are allocated. The operation priority of the node can also be adjusted to ensure that the node can obtain CPU resources first.

[0130] In this embodiment, by running the test project multiple times and collecting instruction consumption data, the performance of the thread can be evaluated more accurately, and a basis can be provided for resource allocation and scheduling decisions, which is helpful to optimize resource allocation.

[0131] Based on the above embodiment, in the fifth embodiment of the present application, the same or similar contents as those in the above embodiment can be referred to the above introduction, and will not be described in detail later. Fig.12 , the central processing unit resource scheduling method further includes steps A10 to A20:

[0132] Step A10, detecting the occupancy rate of the core where the node in the thread is located.

[0133] Step A20: if the occupancy rate exceeds a preset occupancy threshold, reallocate the central processing unit resources to the node.

[0134] It should be noted that the occupancy rate refers to the proportion of a CPU core occupied by nodes in a thread per unit time. In this embodiment, it can be expressed as the ratio of the instruction consumption of the nodes in the CPU core to the instruction throughput of the CPU core. The preset occupancy threshold is used to determine whether the CPU core occupancy rate is too high.

[0135] Detect the occupancy rate of the CPU core where the node in the thread is located, that is, monitor the proportion of each CPU core occupied by the node in the thread per unit time. If the occupancy rate exceeds the preset threshold, it means that the load of the CPU core is high, which may affect the resource utilization of other CPU cores. At this time, it is necessary to reallocate CPU resources to the thread.

[0136] For example, assume that there are four cores in the CPU, and the node in thread A runs on core A with an occupancy rate of 90%. If the preset occupancy threshold is 80%, and the occupancy rate of core A exceeds the preset threshold, the system needs to reallocate CPU resources to thread A, such as transferring the node from core A to run on other cores. After reallocating resources, continue to monitor the CPU core occupancy rate to ensure stable operation of the thread.

[0137] In one possible implementation, refer to Fig.13 , step A20 may include steps A21 to A24:

[0138] Step A21, obtaining historical resource allocation results and historical core occupancy rates corresponding to the historical resource allocation results.

[0139] It should be noted that historical resource allocation results refer to the record of resource allocation to threads in the past period of time. Collect historical data on past thread resource allocation, including thread running priority, instruction consumption, and the CPU cores to which they are allocated. At the same time, collect the occupancy data of each CPU core in the historical resource allocation in the past. The historical resource allocation data can be collected through log records, monitoring data, etc.

[0140] Step A22: construct a sample set based on the historical resource allocation results and the historical occupancy of the core.

[0141] Based on historical data, a sample is constructed for each historical resource allocation result. Each sample contains one or more features, such as the node's running priority, instruction consumption, node type, node running time, etc., and adds the corresponding CPU core occupancy information. Optionally, the sample set is divided into a training set, a validation set, and a test set to evaluate the performance and generalization ability of the model.

[0142] Step A23: construct and train a central processing unit resource allocation model based on the sample set.

[0143] Optionally, a central processing unit resource allocation model can be constructed using machine learning algorithms such as decision trees, random forests, support vector machines, neural networks, etc., the model can be trained using a training set, model parameters can be adjusted to optimize performance, the performance of the model can be evaluated using a validation set, and the model can be adjusted based on the evaluation results, and the performance of the model can be optimized through cross-validation, hyperparameter tuning, and other techniques.

[0144] Step A24, determining a resource allocation strategy based on the central processing unit resource allocation model, and reallocating the central processing unit resources to the nodes according to the resource allocation strategy.

[0145] The trained CPU resource allocation model is deployed to the CPU resource scheduling module. In the CPU resource scheduling module, the CPU resource allocation model is used to predict the best resource allocation strategy based on the thread feature input. According to the model prediction results, the resource allocation strategy is executed to allocate CPU resources to the node and adjust the resource allocation strategy as needed.

[0146] In this embodiment, the CPU core occupancy rate of the node in the thread is detected in real time, and CPU resources are reallocated to the thread when the occupancy rate exceeds a preset threshold, so as to avoid CPU core overload and optimize CPU resource utilization. At the same time, a central processing unit resource allocation model is constructed and trained, and the best core allocation strategy is predicted based on historical data to further improve the accuracy of resource allocation.

[0147] For example, to help understand the implementation process of the central processing unit resource scheduling method obtained in the above embodiment, please refer to Fig.14 , Fig.14A brief flow chart of a central processing unit resource scheduling method is provided, specifically: when a thread applies for resources, the thread node information that makes the application is determined, including the thread node type. If the thread node has a designated running core, it is directly allocated to the designated core for running; if the thread node is an independent dynamic module or a dependent transaction flow module, the resources required by the dynamic module and the total resources required by the transaction flow are calculated, and compared with the total instruction throughput of the CPU core to determine whether the CPU core has sufficient resources. If there are sufficient resources, the nodes are evenly allocated. If there are not enough resources, the independent dynamic modules are rearranged and resources are allocated to them. Then, it is determined again whether the CPU core has sufficient resources to provide to the dependent transaction flow modules. If there are sufficient resources, resources are allocated to the dependent transaction flow modules. If there are not enough resources, the independent dynamic modules with low priorities in the core are released first, and then resources are allocated to the dependent transaction flow modules.

[0148] For example, refer to Fig.15 , Fig.15 This is a schematic diagram of the operation logic of the central processing unit resource scheduling module in the embodiment of the present application. When a thread process is running, it will apply for resources from the scheduling module, and the scheduling module will uniformly allocate the operation resources. If an abnormality is detected in the operation of the thread node, the CPU resources will be rescheduled. Specifically, when the media process applies for resources, the scheduling process specifies the operation resources for the media process, and the media process will be bound to the specified operation resources; when the environmental control and recording processes apply for resources, the scheduling process specifies the operation resources for the environmental control and recording processes, and the environmental control and recording processes will be bound to the specified operation resources; after starting the driver module, the driver module defaults to binding the operation core to start. The scheduling process is triggered regularly to detect the operating status of the system. If an interrupt processing is abnormal, the driver operation core is readjusted; if a thread processing is abnormal, the operation resources are readjusted, and the corresponding process is re-bound to the operation resources.

[0149] The present application provides a central processing unit resource scheduling device, which includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the central processing unit resource scheduling method in the above-mentioned embodiment one.

[0150] Reference below Fig.16, which shows a schematic diagram of the structure of a central processing unit resource scheduling device suitable for implementing the embodiment of the present application. The central processing unit resource scheduling device in the embodiment of the present application may include but is not limited to mobile terminals such as laptop computers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.16 The central processing unit resource scheduling device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0151] like Fig.16 As shown, the central processing unit resource scheduling device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the central processing unit resource scheduling device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the central processing unit resource scheduling device to communicate wirelessly or wired with other devices to exchange data. Although the central processing unit resource scheduling device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0152] The central processing unit resource scheduling device provided by the present application adopts the central processing unit resource scheduling method in the above embodiment, which can solve the technical problem that the central processing unit resources cannot be scheduled in real time in a multi-core processor. Compared with the prior art, the beneficial effects of the central processing unit resource scheduling device provided by the present application are the same as the beneficial effects of the central processing unit resource scheduling method provided by the above embodiment, and other technical features in the central processing unit resource scheduling device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0153] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0154] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0155] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, the computer-readable program instructions being used to execute the central processing unit resource scheduling method in the above-mentioned embodiment.

[0156] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may 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: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0157] The computer-readable storage medium may be included in the central processing unit resource scheduling device; or may exist independently without being assembled into the central processing unit resource scheduling device.

[0158] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the central processing unit resource scheduling device, the central processing unit resource scheduling device can write computer program codes for performing the operations of the present application in one or more programming languages ​​or a combination thereof. The programming languages ​​include object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0159] The flow chart and block diagram in the accompanying drawings illustrate the system architecture, function and operation that may be realized according to the system and method of various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the 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 implementations as replacements, the functions marked in the box can also occur in a sequence different from that 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 and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart 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.

[0160] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0161] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned central processing unit resource scheduling method, and can solve the technical problem that the central processing unit resources cannot be scheduled in real time in a multi-core processor. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the central processing unit resource scheduling method provided by the above-mentioned embodiment, and will not be repeated here.

[0162] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A central processing unit resource scheduling method, characterized in that: The central processing unit includes a plurality of cores, the cores are used to process one or more threads, the threads include one or more nodes, the nodes include independent nodes and dependent nodes, the dependent nodes represent nodes in the threads that have a dependent relationship with other nodes, the method includes: Acquire the running information of the thread that issues the resource request, wherein the running information includes the running priority of the node in the thread and the instruction consumption of the node when running; If the node does not have a designated running core, determining the total instruction consumption of the thread according to the instruction consumption; Determining a total instruction throughput of the central processing unit according to instruction throughputs of multiple cores of the central processing unit; If the total instruction consumption is greater than the total instruction throughput, the independent nodes are traversed in order of their running priorities, and the central processing unit resources are allocated to the current independent node being traversed, wherein the current independent node is preferentially allocated to the core with a large instruction throughput for running; Obtaining remaining instruction throughputs of the plurality of cores after executing the current independent node resource allocation; If the remaining instruction throughputs of the multiple cores are all less than or equal to a preset throughput threshold, stopping allocating resources to the independent node; If the remaining instruction throughput of the plurality of cores is greater than the preset throughput threshold, allocating the central processing unit resources to the next independent node of the current independent node; If all the independent nodes are allocated, the central processing unit resources are allocated to the dependent nodes.

2. The method according to claim 1, characterized in that After the step of determining the total instruction throughput of the central processing unit according to the instruction throughputs of the multiple cores of the central processing unit, the method further includes: If the total instruction consumption is less than or equal to the total instruction throughput, the central processing unit resources are evenly allocated to each of the nodes, wherein the nodes with large instruction consumption are preferentially allocated to the core with large instruction throughput for operation.

3. The method according to claim 1, characterized in that After the step of obtaining the running information of the thread that issues the resource request, the method further includes: If the designated running core exists for the node, the node is allocated to run in the designated running core.

4. The method according to claim 1, characterized in that If all the independent nodes are allocated, the step of allocating the central processing unit resources to the dependent nodes includes: Determine a target core having a maximum remaining instruction throughput; Determine target instruction consumption of the dependent node and other nodes having the dependent relationship; When the remaining instruction throughput of the target core is greater than or equal to the target instruction consumption, allocating the dependent node and other nodes having the dependent relationship with the dependent node to the target core for execution; When the remaining instruction throughput of the target core is less than the target instruction consumption, the independent nodes in the target core are released according to the execution priority order until the remaining instruction throughput of the target core is greater than or equal to the target instruction consumption.

5. The method according to claim 1, characterized in that Before the step of obtaining the running information of the thread that issues the resource request, the method further includes: Based on a preset number of thread running tests, the number of instructions consumed by the nodes in the thread running within a preset time is obtained through command instructions of the operating system; An average value of the number of instructions is obtained, and the average value is used as the instruction consumption of the node.

6. The method according to claim 1, characterized in that The method further comprises: Detecting the occupancy rate of the core where the node in the thread is located; If the occupancy rate exceeds a preset occupancy threshold, the central processing unit resources are reallocated to the node.

7. The method according to claim 6, characterized in that The step of reallocating the central processing unit resources to the threads comprises: Obtaining historical resource allocation results and historical occupancy rates of cores corresponding to the historical resource allocation results; constructing a sample set based on the historical resource allocation results and the historical occupancy of the core; Based on the sample set, construct and train a central processing unit resource allocation model; A resource allocation strategy is determined based on the central processing unit resource allocation model, and the central processing unit resources are reallocated to the nodes according to the resource allocation strategy.

8. A central processing unit resource scheduling device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the central processing unit resource scheduling method according to any one of claims 1 to 7.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the central processing unit resource scheduling method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Task scheduling method, device and equipment

    CN115454602A

  • Service resource allocation method and device

    CN117640543A