Load balancing method, device, vehicle and storage medium
By calculating the load security index of the processor core and performing dynamic load balancing, the problems of processor overload and low resource utilization caused by static priority strategies in multi-core environments are solved, and the system's resource utilization and task execution efficiency are improved.
Patent Information
- Application Number
- CN202411972117.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-08
AI Technical Summary
In multi-core environments, static priority policies cause some processor cores to be overloaded while others are idle, reducing the utilization of system resources.
By obtaining the task load status data and task priority distribution sets of each processor core, the load safety index is calculated, and the target processor core that meets the resource allocation conditions are selected from the processor core whose load safety index is less than or equal to the target value according to the resource demand, in order to achieve load balancing.
Improve the resource utilization rate, task execution efficiency, security and reliability of the target operating system.
Smart Images

Figure CN119781980A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of data processing technology, and specifically to a load balancing method, device, vehicle and storage medium. Background Art
[0002] With the continuous advancement of multi-core processor technology, the application of real-time operating systems in the field of embedded systems has become more and more common. Especially in scenarios such as industrial automation, automotive electronics, and communication equipment that have extremely high requirements for real-time and load balancing performance, the QNX real-time kernel, as a well-known real-time operating system based on a microkernel architecture, is widely used in situations where multi-task loads are handled due to its excellent task management capabilities and low latency characteristics.
[0003] However, most real-time operating systems in related technologies use a task allocation mechanism with a static priority scheduling strategy, and the task allocation mechanism usually relies on fixed priority allocation rules or predefined load balancing strategies to allocate processor resources. However, in a multi-core environment, the static priority strategy easily causes some cores to be overloaded while other cores are idle, thereby greatly reducing the utilization of system resources. Summary of the invention
[0004] In view of the above problems, embodiments of the present invention provide a load balancing method, device, vehicle and storage medium.
[0005] According to one aspect of an embodiment of the present invention, a load balancing method is provided, which is applied to a scheduling management node in a target operating system, and the method includes: obtaining task load status data uploaded by each connected processor core, and a corresponding task priority distribution set; calculating the load safety index of each processor core based on the task load status data, the load safety index is determined based on the safety level parameters of each task to be executed in the processor core; for a first processor core whose load safety index is less than or equal to a target value, obtaining a target task with a priority of the target priority in the task priority distribution set corresponding to the first processor core; based on the resource demand of the target task, filtering out a target processor core that meets the resource allocation condition from a second processor core whose load safety index is less than or equal to the target value, so as to load balance the first processor core, and the resource allocation condition includes that the idle resource amount of the second processor core is greater than the resource demand of the target task. Through the above process, the resource utilization rate, task execution efficiency, security and reliability of the target operating system can be improved.
[0006] In an optional implementation, calculating the load safety index of each processor core based on the task load status data includes:
[0007] For any processor core, based on the task load status data, determine the resource consumption sensitivity, execution environment dependency, and task failure impact of each task to be executed;
[0008] Determine the security level parameters corresponding to each task to be executed based on resource consumption sensitivity, execution environment dependency, and task failure impact;
[0009] Based on the safety level parameters, the load safety index of each processor core is calculated.
[0010] In an optional implementation, the model for calculating the load safety index of each processor core is:
[0011]
[0012] Among them, L i is the load safety index of the i-th processor core; N is the number of processor cores in the target operating system; S ij is the safety level parameter of the jth task to be executed on the i-th processor core; α, β, γ, and δ are the weight coefficients corresponding to the task amount to be executed in the task load status data, the allocated execution time of the task to be executed, the resource occupancy rate, and the safety level parameter.
[0013] In an optional implementation, based on the resource demand of the target task, a target processor core that meets the resource allocation condition is selected from the second processor core whose load safety index is less than or equal to the target value to load balance the first processor core, including:
[0014] Obtain the security level parameters of the target task;
[0015] Obtaining the amount of resources that can be allocated to the target processor core that meets the resource allocation conditions;
[0016] Based on the security level parameters, task priority and allocable resource amount of the target task, the target task is migrated to the target processor core to load balance the first processor core.
[0017] In an optional implementation, after calculating the load safety index of each processor core based on the task load status data, the method further includes:
[0018] Obtaining a maximum load safety index and a minimum load safety index in the load safety index, and calculating a difference between the maximum load safety index and the minimum load safety index to obtain a safety index difference;
[0019] Based on the size relationship between the safety index difference and the load balancing safety threshold, and the safety level parameters of each task to be executed, determine a task load adjustment table for adjusting the task load state data and the task priority distribution set in each processor core;
[0020] The task load adjustment table is sent to each processor core, so that the processor core iteratively updates the task load status data and the task priority distribution set based on the task load adjustment table.
[0021] In an optional embodiment, the method further includes:
[0022] Obtaining abnormally executed tasks among tasks to be executed and / or target tasks, as well as task status data of abnormally executed tasks;
[0023] Calculate the task urgency of abnormally executed tasks based on task status data;
[0024] A target processor core set whose load safety index is less than the global average is screened out from the processor cores based on the task urgency, and the abnormally executed tasks are migrated to the processor cores in the target processor core set.
[0025] In an optional implementation, a model for calculating the task urgency of abnormally executed tasks based on task status data is:
[0026]
[0027] Among them, P max is the highest task priority value of the target operating system; P a is the current priority value of the abnormal task to be executed; E a E is the execution time consumed by the abnormal execution task; max is the maximum allowed execution time of the global task of the target operating system, S a It is the safety level parameter of abnormal execution task; the value range is [0,S max ], is the load safety index of the processor core to which the abnormally executed task belongs; is the current system load safety index, λ, μ, ν are weight parameters; δ a is the delay factor of abnormal execution task; E expected The expected execution time of the task for the exception.
[0028] According to another aspect of an embodiment of the present invention, a load balancing device is provided, which is applied to a scheduling management node in a target operating system, and includes: a data acquisition module, which is used to acquire task load status data uploaded by each connected processor core, and a corresponding task priority distribution set; an index calculation module, which is used to calculate the load safety index of each processor core based on the task load status data, and the load safety index is determined based on the safety level parameters of each task to be executed in the processor core; a task acquisition module, which is used to obtain a target task with a target priority in the task priority distribution set corresponding to the first processor core for a first processor core whose load safety index is less than or equal to a target value; a load balancing module, which is used to select a target processor core that meets a resource allocation condition from a second processor core whose load safety index is less than or equal to a target value based on the resource demand of the target task, so as to load balance the first processor core, and the resource allocation condition includes that the idle resource amount of the second processor core is greater than the resource demand of the target task. Through the above modules, the resource utilization rate, task execution efficiency, security and reliability of the target operating system can be improved.
[0029] According to another aspect of an embodiment of the present invention, a vehicle is provided, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform the operation of the aforementioned load balancing method.
[0030] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which at least one executable instruction is stored, and the executable instruction enables a vehicle / device to perform the operation of the aforementioned load balancing method.
[0031] The above description is only an overview of the technical solution of the embodiment of the present invention. In order to more clearly understand the technical means of the embodiment of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present invention. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:
[0033] Figure 1 A schematic diagram of a load balancing method provided by the present invention is shown;
[0034] Figure 2 Another schematic diagram of a load balancing method provided by the present invention is shown;
[0035] Figure 3 A structural schematic diagram of a load balancing device provided by the present invention is shown;
[0036] Figure 4 A structural schematic diagram of a vehicle provided by the present invention is shown. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0038] Figure 1 FIG. 1 is a flow chart showing a first embodiment of a load balancing method of the present invention, which is applied to a scheduling management node in a target operating system. Figure 1 As shown, the method comprises the following steps:
[0039] Step 110, obtaining task load status data uploaded by each connected processor core and a corresponding task priority distribution set.
[0040] The task load status data may include the task amount, allocated execution time and resource occupancy rate of the tasks to be executed in the current processor core. Each processor core uploads the task load status data and the corresponding task priority distribution set in real time.
[0041] In some optional implementations, the scheduling management node can collect in real time the amount of tasks to be executed in each processor core (task queue length), allocated execution time, resource occupancy rate and task priority distribution set through the load collection module built into the target operating system to form a task load status data set.
[0042] Specifically, the amount of tasks T in the task queue to be executed in each processor core i Perform real-time statistics, where i represents the processor core number, T i The value of is used to characterize the amount of data of the tasks to be executed in the current processor core. Collect the allocated execution time E of all tasks to be executed in each processor core ij , where j represents the jth task, and the total allocated execution time E of all tasks on the processor core is calculated by accumulating i . Real-time monitoring of the resource usage of each processor core, and obtaining the resource usage rate R i :
[0043]
[0044] The busy time represents the actual working time of the processor core for executing tasks, and the total time window is the sampling interval time, which is used to characterize the utilization efficiency of the processor core resources.
[0045] Count the priority P of the tasks to be executed in each processor core ij Distribution, recording the task priority distribution set P of all tasks to be executed on the processor core i = {P i1 ,P i2 ,…,P ini}, the lower the priority value, the higher the importance of the task.
[0046] Based on the collected processor core task volume, allocated execution time, resource occupancy rate, and task priority distribution set, a task load status dataset for each processor core is constructed:
[0047] D={(T i ,E i ,R i ,P i )|i=1,2,…,N};
[0048] Where N is the total number of processor cores in the system.
[0049] In some optional implementations, the scheduling management node can also build a globally shared task load information table based on the task load status data set uploaded by each processor core, and distribute it to all processor cores through the message passing mechanism of the target operating system, so that each processor core can understand the overall load distribution status of the target operating system.
[0050] In some optional implementations, the scheduling management node may also distribute the task load status data set uploaded by each processor core to all processor cores through the message passing mechanism of the target operating system, so that each processor core builds a globally shared task load information table based on the task load status data sets of other processor cores.
[0051] Specifically, the scheduling management node distributes the task load status data set D to each processor core through the message passing mechanism of the target operating system. Each processor core receives the task load status data set delivered by the message and parses the data, decomposing the data into the task amount, allocated execution time, resource occupancy rate, and task priority distribution set of each processor core. Then, the received load status data is used to construct a globally shared task load information table, which is defined as:
[0052] F={(i,T i ,E i ,R i ,P i )|i=1,2,…,N}
[0053] Among them, F is the globally shared task load information table, i is the unique identifier of the processor core, and records the task load T of each processor core. i , the allocated execution time and E i , resource utilization rate R i And the task priority distribution set P i .
[0054] Each processor core synchronizes the load status of other processor cores in real time according to the globally shared task load information table F, so that each processor core has global visibility of the task load distribution of the entire target operating system; in the process of synchronizing the task load information table, the target operating system (QNX microkernel) message passing mechanism is used to maintain data consistency, and data contention is avoided due to the distributed lock mechanism of the message passing mechanism.
[0055] Step 120: Calculate the load safety index of each processor core based on the task load status data.
[0056] The load safety index is determined based on the safety level parameters of each task to be executed in the processor core.
[0057] In some optional embodiments, when calculating the load safety index of each processor core based on the task load status data, for any processor core, the resource consumption sensitivity, execution environment dependency and task failure impact of each task to be executed can be determined based on the task load status data; based on the resource consumption sensitivity, execution environment dependency and task failure impact, the security level parameters corresponding to each task to be executed are determined; based on the security level parameters, the load safety index of each processor core is calculated.
[0058] In some optional implementations, the model for calculating the load safety index of each processor core is:
[0059]
[0060] Among them, L i is the load safety index of the i-th processor core. The higher the safety level parameter value, the greater the impact of the task to be executed on the security of the target operating system. N is the number of processor cores in the target operating system. S ihis the security level parameter of the jth task to be executed on the ith processor core; α, β, γ, and δ are the weight coefficients corresponding to the task volume to be executed, the allocated execution time and resource occupancy rate of the task to be executed, and the security level parameter in the task load status data, respectively, and are set according to the requirements of the specific target operating system.
[0061] Specifically, the scheduling management node calculates the safety level parameter S for each task to be executed from the task load information table F based on the globally shared task load information table F according to the resource consumption sensitivity, execution environment dependency, and task failure impact of the task to be executed. ih :
[0062]
[0063] in, is the resource consumption sensitivity, which is used to represent the resource consumption sensitivity of the jth task to be executed on the i-th processor core, and is calculated based on the average resource occupancy rate of the task to be executed and the current resource load; The execution environment dependency is used to indicate the degree of dependency of the task to be executed on a specific hardware or software environment, and is assigned a value through a predefined task environment matching rule; is the task failure impact, which is used to indicate the severity of the failure consequence of the task and is determined by the key indicators predefined for the task to be executed. 1 ,ω 2 ,ω 3 It is a weight coefficient, which is used to control the comprehensive impact of different dimensions on the task safety level and can be adjusted according to needs.
[0064] It should also be noted here that the above-mentioned resource consumption sensitivity is an indicator used to measure the use of processor core resources by tasks to be executed, which can comprehensively consider the average resource occupancy rate of the tasks to be executed themselves and the overall resource load of the current processor core. The average resource occupancy rate of tasks to be executed is obtained by evaluating the average demand for resources by tasks to be executed during the execution process, reflecting the resource usage characteristics of the tasks to be executed themselves, such as CPU time occupancy and memory requirements. The resource load of the processor core refers to the total demand for resources by all tasks to be executed currently running on the processor core, indicating the current working pressure of the processor core. When calculating resource consumption sensitivity, the average resource demand of tasks to be executed can be directly combined with the core load status for evaluation. That is:
[0065]
[0066] Among them, R avg is the average resource occupancy rate of the tasks to be executed, L i The resource load of the current processor core.
[0067] Step 130 : For a first processor core whose load safety index is less than or equal to a target value, obtain a target task having a target priority in a task priority distribution set corresponding to the first processor core.
[0068] Specifically, the load safety index of each processor core can be sorted to obtain the first processor core whose load safety index is less than or equal to the target value, such as the processor core with the smallest load safety index, or the processor core with a load safety index less than or equal to the average value. At this time, all the tasks to be executed with the highest priority and / or some of the tasks to be executed with the second priority in the task priority distribution set of each first processor core can be used as the target task.
[0069] In some optional implementations, for the first processor core whose load safety index is less than or equal to the target value, the target task with a priority of the target priority in the task priority distribution set corresponding to the first processor core is obtained. Then, the comprehensive weight of each target task is calculated based on the task priority and resource consumption sensitivity of the target task. The calculation formula of the comprehensive weight can be expressed as: comprehensive weight = task priority × resource consumption sensitivity × weight coefficient. In this way, the execution order of each target task on the current processor core can be determined. Finally, according to the calculated comprehensive weight, the target tasks are sorted and scheduled for execution in order from high to low priority. This ensures that high-priority and resource-sensitive target tasks can be processed first, thereby improving the operating efficiency and stability of the entire system.
[0070] Step 140 , based on the resource demand of the target task, select a target processor core that meets the resource allocation condition from the second processor cores whose load safety index is less than or equal to the target value, so as to load balance the first processor core.
[0071] The resource allocation condition includes that the load safety index of the second processor core matches the safety level parameter of the target task.
[0072] In some optional embodiments, based on the resource demand of the target task, a target processor core that meets the resource allocation conditions is screened out from the second processor core whose load safety index is less than or equal to the target value to load balance the first processor core, and the security level parameter of the target task can be obtained; the amount of resources that can be allocated of the target processor core that meets the resource allocation conditions is obtained; based on the security level parameter of the target task, the task priority and the amount of resources that can be allocated, the target task is migrated to the target processor core to load balance the first processor core.
[0073] For example, if the target task with high priority and low safety level parameters is assigned to the target processor core i with the lowest load safety index, min When a target task with high security level parameters needs to be allocated, it is preferentially allocated to the target processor core whose load security index is close to the global average value, so that the system load is balanced while isolating the high security level tasks.
[0074] After calculating the load safety index of each processor core based on the task load status data, the maximum load safety index and the minimum load safety index in the load safety index can also be obtained, and the difference between the maximum load safety index and the minimum load safety index can be calculated to obtain the safety index difference; based on the size relationship between the safety index difference and the load balancing safety threshold, as well as the safety level parameters of each task to be executed, determine the task load adjustment table for adjusting the task load status data and the task priority distribution set in each processor core; send the task load adjustment table to each processor core, so that the processor core iteratively updates the task load status data and the task priority distribution set based on the task load adjustment table (that is, iteratively updates the task load information table), so as to ensure that the system meets the real-time requirements while ensuring load safety.
[0075] The relationship between the safety index difference and the load balancing safety threshold is as follows:
[0076] |L max -L min |≤∈;
[0077] Among them, ∈ is the load balancing safety threshold, L max is the maximum load safety index, L min is the minimum load safety index.
[0078] In some optional implementations, the scheduling management node also separately records the execution status of the tasks to be executed with high security level parameters after the tasks to be executed are scheduled, and dynamically adjusts the weight coefficient δ by regularly analyzing its impact on the system load.
[0079] The load balancing method of the embodiment of the present invention obtains the task load status data uploaded by each connected processor core, and the corresponding task priority distribution set; calculates the load safety index of each processor core based on the task load status data; for a first processor core whose load safety index is less than or equal to a target value, obtains a target task with a priority of a target priority in the task priority distribution set corresponding to the first processor core; based on the resource demand of the target task, selects a target processor core that meets the resource allocation conditions from a second processor core whose load safety index is less than or equal to the target value, so as to load balance the first processor core, thereby improving the resource utilization rate, task execution efficiency, security and reliability of the target operating system.
[0080] Figure 2 FIG. 2 is a flow chart showing another embodiment of the load balancing method of the present invention, which is executed by a scheduling management node in a target operating system. Figure 2 As shown, the method comprises the following steps:
[0081] Step 210: Obtain task load status data uploaded by each connected processor core and a corresponding task priority distribution set.
[0082] For details, please see Figure 1 Step 110 of the illustrated embodiment will not be described in detail here.
[0083] Step 220: Calculate the load safety index of each processor core based on the task load status data.
[0084] For details, please see Figure 1 Step 120 of the illustrated embodiment will not be described in detail here.
[0085] Step 230 : For a first processor core whose load safety index is less than or equal to a target value, a target task having a target priority in a task priority distribution set corresponding to the first processor core is obtained.
[0086] For details, please see Figure 1 Step 130 of the illustrated embodiment will not be described in detail here.
[0087] Step 240 , based on the resource demand of the target task, select a target processor core that meets the resource allocation condition from the second processor cores whose load safety index is less than or equal to the target value, so as to load balance the first processor core.
[0088] Specifically, the above step 240 includes:
[0089] Step 2401, obtaining abnormally executed tasks among the tasks to be executed and / or the target tasks, and task status data of the abnormally executed tasks.
[0090] Step 2402: Calculate the task urgency of the abnormally executed task based on the task status data.
[0091] Specifically, the model for calculating the task urgency of abnormally executed tasks based on task status data is:
[0092]
[0093] Among them, P max is the highest task priority value of the target operating system; P a is the current priority value of the abnormal task to be executed; E a E is the execution time consumed by the abnormal execution task; max is the maximum allowed execution time of the global task of the target operating system, S a It is the safety level parameter of abnormal execution task; the value range is [0,S max ], L ia is the load safety index of the processor core to which the abnormally executed task belongs; is the current system load safety index, λ, μ, ν are weight parameters; δ a is the delay factor of abnormal execution task; E expected The expected execution time of the task for the exception.
[0094] Step 2403 , based on the task urgency, a target processor core set having a load safety index less than a global average is screened out from the processor cores, and the abnormally executed task is migrated to the processor core in the target processor core set.
[0095] In the actual operation process, first, the scheduling management node monitors the task execution status in the globally shared task load information table F in real time. When it detects that a processor core has timed out due to task conflict or insufficient resources, it records the number of the abnormally executed task T. a , processor core number i a and the priority of the task P a Then, the scheduling management node executes the task T according to the exception a The priority P a , Elapsed execution time a , Safety level parameter S a And the current system load status, calculate the task urgency U a :
[0096]
[0097] Among them, P max is the highest priority value of the target operating system, P ais the current priority value of the abnormal execution task. The lower the priority, the more important the task is and the higher the urgency is. a E is the execution time consumed by the abnormal execution task; max is the maximum allowed execution time of the global task, S a It is the safety level parameter of abnormal execution task, and its value range is [0,S max ], is the load safety index of the processor core to which the abnormally executed task belongs, is the current system load safety index, which is used to correct the impact of uneven processor core load in the urgency calculation. λ, μ, and ν are weight parameters, which are used to adjust the impact of priority, execution time, and security level parameters in the urgency calculation. δ a Indicates the delay factor of abnormal execution task:
[0098]
[0099] Among them, E expected is the expected execution time of the abnormal execution task, and a higher delay factor indicates a higher task urgency.
[0100] Then, the scheduling management node calculates the result U according to the urgency a In the globally shared task load information table F, select the task whose load balancing index is lower than the global average. The target processor core set And select the processor core with the lowest resource occupancy rate in the target processor core set G as the abnormal execution task T a target processor core.
[0101] Finally, the scheduling management node sends the abnormal execution task T to the a Migrate from the abnormal processor core to the target processor core, and update the globally shared task load information table F at the same time, adjust the task queue length, resource occupancy rate and comprehensive load safety index of the two processor cores after migration; after completing the abnormal execution task migration, t Real-time monitoring is performed to ensure that the reallocation of abnormal execution tasks will not cause new task conflicts or overloads. When the migration of abnormal execution tasks fails, the scheduling management node dynamically reduces the priority of other non-critical tasks to release resources to prioritize the execution of abnormal execution tasks, and records the adjustment strategy in the globally shared task load information table F. The urgency calculated during the abnormal execution task processing, migration time overhead, target processor core load changes, and system overall load balancing index changes are recorded in the system log.
[0102] In the actual operation process, the load collection module can collect the queue length of pending tasks, the allocated execution time and (execution time), resource occupancy rate and task priority distribution set (task priority distribution) in real time to form a load status data set; distribute the load status data set through the message passing mechanism of the QNX microkernel to build a task load information table (globally shared task load information table); calculate the load safety index of the processor core (core) and optimize the task allocation strategy through the scheduling management node; dynamically adjust the task priority, and allocate high-priority tasks to the core with the lowest load safety index; trigger the cross-core task migration strategy, adjust the low-priority task allocation core execution task and feedback the execution status through the QNX message mechanism to handle task conflicts or insufficient resources, and dynamically adjust abnormal task allocation; update the task load information table in real time to optimize the next round of scheduling strategy.
[0103] In the process of calculating the load safety index of the processor core (core) and optimizing the task allocation strategy, you can first obtain the task load information table, calculate the load safety index of each core based on the task load information table, and determine whether the load safety index of all cores meets the threshold condition; when the load safety index of all cores meets the threshold condition, the load balancing meets the required task allocation and is completed; when the load safety index of a core does not meet the threshold condition, identify the core with the highest load and the core with the lowest load; adjust the task priority to allocate high priority tasks to the core with the lowest load; trigger the cross-core task migration strategy to adjust the allocation of low priority tasks; update the global shared task load information table, and iteratively calculate the load safety index of each core.
[0104] The load balancing method of the embodiment of the present invention has the following beneficial effects:
[0105] By integrating the task queue length, allocated execution time, resource occupancy rate and task safety level parameters to achieve accurate load balancing in multi-core systems, and by real-time calculation and dynamic adjustment of scheduling strategies, the defects of uneven load distribution between processor cores in related technologies are avoided, and resource utilization and task execution efficiency are greatly improved. That is, by globally and dynamically sensing the load status, a load balancing algorithm with multi-dimensional parameter optimization is realized.
[0106] By introducing security level parameters, the importance of tasks is comprehensively evaluated from three dimensions: resource sensitivity, execution environment dependence, and severity of failure consequences. The execution priority of tasks is dynamically adjusted to ensure the priority processing of high-security level tasks and the overall security of the system, thereby significantly improving the security and flexibility of the target operating system.
[0107] By calculating the urgency of abnormal execution tasks and combining task priority, execution time and delay factor, the urgency of abnormal tasks can be dynamically evaluated. At the same time, the optimal target processor core is selected for task migration through the global task load information table, and the successful execution of abnormal tasks is guaranteed by adjusting the priorities of other tasks, which solves the shortcomings of related technologies in processing efficiency and system stability.
[0108] A globally shared task load information table is constructed through the message passing mechanism to ensure that each processor core synchronizes the overall system load status in real time to support global scheduling optimization, thereby achieving load perception and scheduling coordination for the entire system.
[0109] The global scheduling is managed uniformly through the scheduling management node, and the task priority, allocation strategy and migration of abnormal tasks are adjusted in real time, which improves the overall performance of the multi-core scheduling system and significantly improves the task processing efficiency.
[0110] By giving priority to allocating high-security-level tasks to processor cores whose load safety index is close to the global average, and by using task isolation strategies to reduce resource contention between critical tasks and other tasks, the security and reliability of the system are significantly improved.
[0111] Figure 3 FIG. 2 is a schematic diagram showing a structure of an embodiment of a load balancing device of the present invention. Figure 3 As shown, the scheduling management node applied to the target operating system includes:
[0112] The data acquisition module 310 is used to acquire the task load status data uploaded by each connected processor core and the corresponding task priority distribution set;
[0113] An index calculation module 320, for calculating a load safety index of each processor core based on the task load status data, wherein the load safety index is determined based on a safety level parameter of each task to be executed in the processor core;
[0114] The task acquisition module 330 is used to acquire, for a first processor core whose load safety index is less than or equal to a target value, a target task with a target priority in a task priority distribution set corresponding to the first processor core;
[0115] The load balancing module 340 is used to select a target processor core that meets the resource allocation condition from the second processor core whose load safety index is less than or equal to the target value based on the resource demand of the target task, so as to load balance the first processor core, and the resource allocation condition includes that the idle resource amount of the second processor core is greater than the resource demand of the target task.
[0116] In an optional implementation, the index calculation module 320 includes:
[0117] An information determination submodule, for determining, for any processor core, the resource consumption sensitivity, execution environment dependency, and task failure impact of each task to be executed based on the task load status data;
[0118] The parameter determination submodule is used to determine the security level parameters corresponding to each task to be executed based on the resource consumption sensitivity, execution environment dependency and task failure impact;
[0119] The index calculation submodule is used to calculate the load safety index of each processor core based on the safety level parameter.
[0120] In an optional implementation, the model for calculating the load safety index of each processor core is:
[0121]
[0122] Among them, L i is the load safety index of the i-th processor core; N is the number of processor cores in the target operating system; S ij is the safety level parameter of the jth task to be executed on the i-th processor core; α, β, γ, and δ are the weight coefficients corresponding to the task amount to be executed in the task load status data, the allocated execution time of the task to be executed, the resource occupancy rate, and the safety level parameter.
[0123] In an optional implementation, the load balancing module 340 includes:
[0124] The parameter acquisition submodule is used to obtain the safety level parameters of the target task;
[0125] A resource acquisition submodule is used to obtain the amount of configurable resources of the target processor core that meets the resource allocation conditions;
[0126] The load balancing submodule is used to migrate the target task to the target processor core based on the security level parameters, task priority and available resource quantity of the target task, so as to load balance the first processor core.
[0127] In some optional implementations, the task acquisition module 330 includes:
[0128] The difference calculation submodule is used to obtain the maximum load safety index and the minimum load safety index in the load safety index, and calculate the difference between the maximum load safety index and the minimum load safety index to obtain the safety index difference;
[0129] An adjustment table acquisition submodule is used to determine a task load adjustment table for adjusting task load status data and task priority distribution sets in each processor core based on the size relationship between the safety index difference and the load balancing safety threshold, and the safety level parameters of each task to be executed;
[0130] The data update submodule is used to send the task load adjustment table to each processor core, so that the processor core iteratively updates the task load status data and the task priority distribution set based on the task load adjustment table.
[0131] In some optional implementations, the load balancing module 340 further includes:
[0132] A data acquisition submodule is used to acquire abnormally executed tasks in the tasks to be executed and / or the target tasks, as well as task status data of the abnormally executed tasks;
[0133] An urgency calculation submodule is used to calculate the task urgency of the abnormally executed task based on the task status data;
[0134] The task migration submodule is used to screen out a target processor core set whose load safety index is less than the global average from the processor cores based on the task urgency, and migrate the abnormally executed tasks to the processor cores in the target processor core set.
[0135] In some optional implementations, the model for calculating the task urgency of abnormally executed tasks based on task status data is:
[0136]
[0137] Among them, P max is the highest task priority value of the target operating system; P a is the current priority value of the abnormal task to be executed; E a E is the execution time consumed by the abnormal execution task; max is the maximum allowed execution time of the global task of the target operating system, S a It is the safety level parameter of abnormal execution task; the value range is [0,S max ], is the load safety index of the processor core to which the abnormally executed task belongs; is the current system load safety index, λ, μ, ν are weight parameters; δ a is the delay factor of abnormal execution task; E expected The expected execution time of the task for the exception.
[0138] The further functional description of each of the above modules and units is the same as that of the above corresponding method embodiments and will not be repeated here.
[0139] Through the above device and its components, the technical solution provided by the embodiment of the present invention has the following advantages:
[0140] The load balancing device of the embodiment of the present invention obtains the task load status data uploaded by each connected processor core and the corresponding task priority distribution set through the data acquisition module; calculates the load safety index of each processor core based on the task load status data through the index calculation module, and the load safety index is determined based on the safety level parameters of each task to be executed in the processor core; obtains the target task with the target priority in the task priority distribution set corresponding to the first processor core for the first processor core whose load safety index is less than or equal to the target value through the task acquisition module; and selects the target processor core that meets the resource allocation condition from the second processor core whose load safety index is less than or equal to the target value based on the resource demand of the target task through the load balancing module, so as to load balance the first processor core. Through the above modules, the resource utilization rate, task execution efficiency, security and reliability of the target operating system can be improved.
[0141] See also Figure 4 , Figure 4 is a schematic diagram of the structure of a vehicle provided by an optional embodiment of the present invention, such as Figure 4 As shown, the vehicle includes: one or more processors 410, a memory 420, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed in the vehicle, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple vehicles can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 410 is taken as an example.
[0142] The processor 410 may be a central processing unit, a network processor or a combination thereof. The processor 410 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.
[0143] The memory 420 stores instructions executable by at least one processor 410 so as to enable at least one processor 410 to implement the method shown in the above embodiment.
[0144] The memory 420 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created based on the use of a vehicle displayed on a small program landing page, etc. In addition, the memory 420 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 420 may optionally include a memory remotely arranged relative to the processor 410, and these remote memories may be connected to the vehicle via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a server cluster, a mobile communication network, and a combination thereof.
[0145] The memory 420 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 420 may also include a combination of the above types of memory.
[0146] The vehicle also includes a communication interface 430 for the vehicle to communicate with other devices or communication networks.
[0147] An embodiment of the present invention further provides a computer-readable storage medium storing at least one executable instruction. When the executable instruction is executed on a vehicle / load balancing device, the vehicle / load balancing device executes the load balancing method in any of the above method embodiments.
[0148] The algorithms or displays provided herein are not inherently related to any particular computer, virtual system or other device. In addition, the embodiments of the present invention are not directed to any particular programming language.
[0149] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. Similarly, in order to simplify the present invention and help understand one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the embodiments of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. Wherein, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself is a separate embodiment of the present invention.
[0150] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and further may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive.
[0151] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.
Claims
1. A load balancing method, characterized in that: Applied to a scheduling management node in a target operating system, the method comprises: Obtain task load status data uploaded by each connected processor core, and the corresponding task priority distribution set; Calculating a load safety index of each of the processor cores based on the task load status data, wherein the load safety index is determined based on a safety level parameter of each task to be executed in the processor core; For a first processor core whose load safety index is less than or equal to a target value, obtaining a target task whose priority is a target priority in the task priority distribution set corresponding to the first processor core; Based on the resource demand of the target task, a target processor core that meets the resource allocation condition is screened out from the second processor core whose load safety index is less than or equal to the target value to load balance the first processor core, and the resource allocation condition includes that the load safety index of the second processor core matches the safety level parameter of the target task.
2. The method according to claim 1, characterized in that The calculating the load safety index of each processor core based on the task load status data includes: For any of the processor cores, based on the task load status data, determining the resource consumption sensitivity, execution environment dependency, and task failure impact of each of the tasks to be executed; Determining the security level parameter corresponding to each of the tasks to be executed based on the resource consumption sensitivity, the execution environment dependency, and the task failure impact; Based on the security level parameter, a load security index of each of the processor cores is calculated.
3. The method according to claim 2, characterized in that The model for calculating the load safety index of each processor core is: Among them, L i is the load safety index of the i-th processor core; N is the number of processor cores in the target operating system; S ij is the safety level parameter of the jth task to be executed on the i-th processor core; α, β, γ, and δ are the weight coefficients corresponding to the task amount to be executed in the task load status data, the allocated execution time of the task to be executed, the resource occupancy rate, and the safety level parameter.
4. The method according to claim 1, characterized in that The method of selecting a target processor core that meets a resource allocation condition from a second processor core whose load safety index is less than or equal to a target value based on the resource demand of the target task, so as to load balance the first processor core, includes: Obtaining the safety level parameters of the target task; Acquire the allocatable resource amount of the target processor core that meets the resource allocation condition; Based on the security level parameter, task priority and the allocable resource amount of the target task, the target task is migrated to the target processor core to load balance the first processor core.
5. The method according to claim 1, characterized in that After calculating the load safety index of each of the processor cores based on the task load status data, the method further includes: Obtaining a maximum load safety index and a minimum load safety index from the load safety indexes, and calculating a difference between the maximum load safety index and the minimum load safety index to obtain a safety index difference; Based on the size relationship between the safety index difference and the load balancing safety threshold, and the safety level parameters of each task to be executed, determine a task load adjustment table for adjusting the task load state data and the task priority distribution set in each processor core; The task load adjustment table is sent to each of the processor cores, so that the processor core iteratively updates the task load status data and the task priority distribution set based on the task load adjustment table.
6. The method according to claim 1, characterized in that The method further comprises: Acquire the tasks to be executed and / or the abnormally executed tasks in the target tasks, as well as the task status data of the abnormally executed tasks; Calculating the task urgency of the abnormally executed task based on the task status data; A target processor core set having a load safety index less than a global average is screened out from the processor cores based on the task urgency, and the abnormally executed task is migrated to a processor core in the target processor core set.
7. The method according to claim 6, characterized in that The model for calculating the task urgency of the abnormally executed task based on the task status data is: Among them, P max is the highest task priority value of the target operating system; P a is the current priority value of the abnormal task to be executed; E a E is the execution time consumed by the abnormal execution task; max is the maximum allowed execution time of the global task of the target operating system, S a It is the safety level parameter of abnormal execution task; the value range is [0,S max ], is the load safety index of the processor core to which the abnormally executed task belongs; is the current system load safety index, λ, μ, ν are weight parameters; δ a is the delay factor of abnormal execution task; E expected The expected execution time of the task for the exception.
8. A load balancing device, characterized in that: The device is applied to a scheduling management node in a target operating system, and comprises: A data acquisition module is used to obtain task load status data uploaded by each connected processor core and the corresponding task priority distribution set; An index calculation module, used to calculate a load safety index of each of the processor cores based on the task load status data, wherein the load safety index is determined based on a safety level parameter of each task to be executed in the processor core; A task acquisition module, configured to acquire, for a first processor core whose load safety index is less than or equal to a target value, a target task with a target priority in the task priority distribution set corresponding to the first processor core; A load balancing module is used to select a target processor core that meets a resource allocation condition from a second processor core whose load safety index is less than or equal to a target value based on the resource demand of the target task, so as to load balance the first processor core, wherein the resource allocation condition includes that the idle resource amount of the second processor core is greater than the resource demand of the target task.
9. A vehicle, characterized in that: include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform the operation of the load balancing method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The storage medium stores at least one executable instruction, and when the executable instruction is executed on the vehicle, the vehicle executes the operation of the load balancing method as described in any one of claims 1 to 7.
Citation Information
Cited By
Embedded multi-core operating system scheduling method and device and storage medium
CN120909738A