Hybrid priority task scheduling method, device, equipment and storage medium
Patent Information
- Application Number
- CN202611224788.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-13
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2046-08-13
AI Technical Summary
[0006]本申请的主要目的在于提供一种混合优先级任务调度,旨在解决高优先级任务超时时,传统调度算法直接抛弃低优先级任务,造成数据丢失与日志中断的技术问题
通过实时识别并量化各处理器核心的动态空闲资源与松弛空闲资源以建立空闲预算,并在高优先级任务超时时优先消耗所述空闲预算以抵消超时开销,从而在预算充足期间维持低优先级任务正常执行;在所述空闲预算耗尽后,通过对低优先级任务进行降级处理以替代直接丢弃,并将降级后的低优先级任务切割为小粒度任务片段,再重映射至各处理器核心的资源碎缝中继续执行。由此克服了现有调度算法在高优先级任务超时时直接抛弃低优先级任务、造成数据丢失与日志中断的技术问题,从而保证了低优先级任务的执行连续性和数据完整性。
Smart Images

Figure CN122711343B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of multi-core processor scheduling technology, and in particular to a hybrid priority task scheduling method, apparatus, device and storage medium. Background Technology
[0002] Session boundary controllers (SBCs), as core devices in IP communication systems, are widely used in enterprise communications, carrier networks, and other scenarios. They need to handle tasks of different priority levels simultaneously, forming a hybrid priority system. High-priority tasks include core services such as real-time signaling control and call quality assurance, while low-priority tasks cover auxiliary functions such as logging, network status reporting, and data statistics. The coordinated execution of these two types of tasks directly affects the SBC's service quality and data integrity.
[0003] Existing hybrid priority task scheduling algorithms, when a high-priority task times out, release processor resources by directly discarding all low-priority tasks to ensure the high-priority task completes first. This approach achieves immediate reclamation of processor resources by removing all low-priority task loads at once.
[0004] In summary, when a high-priority task times out, traditional scheduling algorithms directly discard low-priority tasks, resulting in data loss and log interruption.
[0005] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0006] The main purpose of this application is to provide a hybrid priority task scheduling method, which aims to solve the technical problem that traditional scheduling algorithms directly discard low-priority tasks when high-priority tasks time out, resulting in data loss and log interruption.
[0007] To achieve the above objectives, this application proposes a hybrid priority task scheduling method, the method comprising: Obtain a task set, which includes tasks, task priorities, and maximum execution time; The task set is divided into different processor cores to form a load-balanced partitioning scheme. When a scheduling event is triggered, the idle budget of each partition is determined and updated in real time according to the partitioning scheme. If a first-priority task times out, the idle budget of the partition in which it is located is consumed to offset the timeout cost. When the idle budget is exhausted, the second-priority task is downgraded. The downgraded second-priority tasks are split and redistributed to each processor core to form a new partitioning scheme, thereby achieving semi-partitioned elastic scheduling of mixed-priority tasks.
[0008] In one embodiment, the step of determining and updating the idle budget of each partition in real time according to the partitioning scheme when the scheduling event is triggered includes: When a scheduling event is triggered, determine the execution requirements of the first-priority and second-priority tasks within each partition; Based on the execution requirements, analyze the blocking impact and sudden fluctuations caused by the first priority task on the second priority task, and determine the difference between the blocking time and the change in job requirements. Based on the arrival time of each task, the execution requirements, the blocking time, and the difference in job requirements, the idle budget of each partition is determined and updated using a preset function.
[0009] In one embodiment, before the idle budget of the partition where the consumption occurs offsets the timeout overhead, the method further includes: Obtain the historical execution data of the first priority task; Based on the historical execution data, determine whether the first priority task has a timeout risk; In the event of the aforementioned timeout risk, a preset proportion of the idle budget will be reserved as a reserve budget.
[0010] In one embodiment, after the step of forming the new partitioning scheme, the method further includes: Monitor the load rate of each processor core and the actual execution time of each task; Get the load threshold and duration threshold; Based on the actual execution time, the maximum execution time of each task is corrected according to a simple smoothing model, and the maximum execution time of the corresponding task in the task set is updated. When the duration for which the load rate is less than the load threshold is greater than the duration threshold, the system is determined to enter an idle safe period and the degraded task is restored to full service.
[0011] In one embodiment, the downgrading process for the second priority task includes: Obtain execution budget degradation parameters, wherein the execution budget degradation parameters are dynamically calibrated to adapt to different application scenarios; Based on the execution budget downgrade parameters, the second priority task is downgraded to obtain the downgraded second priority task.
[0012] In one embodiment, the step of cutting and redistributing the downgraded second-priority tasks to each processor core includes: Obtain the time granularity threshold, communication overhead threshold, and communication overhead between each processor core; The downgraded second-priority task is divided into task fragments, and the time granularity of the task fragments is smaller than the time granularity threshold. Based on the communication overhead, the task segments are allocated to the processor cores whose communication overhead is below the communication overhead threshold.
[0013] In one embodiment, after the step of triggering the scheduling event, the method further includes: Record system data, including: system mode switching status, execution status of second priority tasks, and idle budget utilization data; Based on the system data, the idle budget, execution budget degradation parameters, time granularity threshold, and communication overhead threshold are adjusted to optimize the scheduling performance of the hybrid priority task semi-partition elastic scheduling method.
[0014] Furthermore, to achieve the above objectives, this application also proposes a hybrid priority task scheduling device, which includes: The task set module is used to obtain a task set, which includes tasks, task priorities, and maximum execution time. The partitioning module is used to divide the task set into each processor core to form a load-balanced partitioning scheme. The scheduling module is used to determine and update the idle budget of each partition in real time according to the partitioning scheme when a scheduling event is triggered. The timeout module is used to consume the idle budget of the partition to offset the timeout overhead when the first priority task times out, and to degrade the second priority task when the idle budget is exhausted. The partitioning module is used to partition and redistribute the downgraded second-priority tasks to each processor core, forming a new partitioning scheme to achieve semi-partitioned elastic scheduling of mixed-priority tasks.
[0015] In addition, to achieve the above objectives, this application also proposes a hybrid priority task scheduling device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the hybrid priority task scheduling method as described above.
[0016] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and which, when executed by a processor, implements the steps of the hybrid priority task scheduling method described above.
[0017] One or more technical solutions proposed in this application have at least the following technical effects: By identifying and quantifying the dynamic idle and relaxed idle resources of each processor core in real time to establish an idle budget, and prioritizing the consumption of this idle budget to offset timeout overhead when high-priority tasks time out, low-priority tasks can continue to execute normally during periods of sufficient budget. After the idle budget is exhausted, low-priority tasks are downgraded instead of being directly discarded. These downgraded low-priority tasks are then segmented into smaller task fragments and remapped to the resource gaps of each processor core for continued execution. This overcomes the technical problem of existing scheduling algorithms that directly discard low-priority tasks when high-priority tasks time out, causing data loss and log interruptions, thus ensuring the execution continuity and data integrity of low-priority tasks. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating an embodiment of the hybrid priority task scheduling method of this application. Figure 2 This is a flowchart illustrating Embodiment 2 of the hybrid priority task scheduling method of this application; Figure 3 A simplified flowchart is provided for one embodiment of the hybrid priority task scheduling method of this application; Figure 4 This is a schematic diagram of the module structure of the hybrid priority task scheduling device according to an embodiment of this application; Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the hybrid priority task scheduling method in this application embodiment.
[0021] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0022] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0023] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0024] The main solution of this application embodiment is as follows: An idle budget is established by real-time identification and quantification of the dynamic idle and relaxed idle resources of each processor core. When a high-priority task times out, the idle budget is consumed first to offset the timeout overhead, thereby maintaining the normal execution of low-priority tasks during periods of sufficient budget. After the idle budget is exhausted, low-priority tasks are downgraded instead of being directly discarded. The downgraded low-priority tasks are then cut into small-granularity task fragments and remapped to the resource gaps of each processor core for continued execution. This ensures that low-priority tasks maintain execution continuity even after high-priority tasks time out.
[0025] In this embodiment, for ease of description, the following description uses a multi-core processor as the execution subject.
[0026] Existing hybrid priority task scheduling algorithms release processor resources by directly discarding low-priority tasks when high-priority tasks time out. This causes low-priority tasks to stop executing, creating a break in the task data sequence and disrupting data continuity.
[0027] This application provides a solution that uses idle budget as a buffer, degrades tasks instead of discarding them, and uses segmentation and remapping to utilize fragmented tasks, thus solving the technical problem of data interruption caused by the direct discarding of low-priority tasks when high-priority tasks time out. Compared with existing technologies, low-priority tasks are not terminated during timeout events, thereby ensuring the execution continuity and data integrity of low-priority tasks.
[0028] As can be seen from the above embodiments, this application establishes an idle budget by real-time identification and quantification of the dynamic idle resources and relaxed idle resources of each processor core. When a high-priority task times out, the idle budget is consumed first to offset the timeout overhead, thereby maintaining the normal execution of low-priority tasks during periods of sufficient budget. After the idle budget is exhausted, low-priority tasks are downgraded instead of being directly discarded. The downgraded low-priority tasks are then cut into small-granularity task fragments and remapped to the resource gaps of each processor core for continued execution. After the system enters a safe idle period, full service for low-priority tasks is restored. This overcomes the technical problem of existing scheduling algorithms directly discarding low-priority tasks when high-priority tasks time out, causing data loss and log interruption, thus ensuring the execution continuity and data integrity of low-priority tasks.
[0029] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or multi-core processor capable of performing the above functions. The following description uses a multi-core processor as an example to illustrate this embodiment and the subsequent embodiments.
[0030] Based on this, embodiments of this application provide a hybrid priority task scheduling method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the hybrid priority task scheduling method of this application.
[0031] In this embodiment, the hybrid priority task scheduling method includes steps S10 to S50: Step S10: Obtain a task set, which includes tasks, task priorities, and maximum execution time. It should be noted that a task set refers to a collection of multiple tasks, and a task refers to a program unit that needs to be scheduled and executed by the processor core. Task priority refers to the execution priority level of a task during the scheduling process, including at least first priority and second priority, where first priority tasks have a higher execution priority than second priority tasks. Maximum execution time refers to the upper limit of the time required for a task to execute a single time on the processor core, representing the worst-case execution time budget for a task.
[0032] Additionally, it should be noted that the task cycle refers to the time interval between two scheduled executions of a task, used to define the task's activation frequency. The task absolute deadline refers to the absolute point in time when the task will complete execution after each scheduled execution, used as a benchmark for determining whether a task has timed out.
[0033] Specifically, a quadruple (C) is defined for the task set processed by the multi-core SBC processor. i , T i D i , L i ), where C i T is the maximum execution time of the task. i For the task cycle, D i L is the absolute deadline for the task. i Task priority level; Understandably, by obtaining the task set and defining the four-tuple attributes, the task objects processed by the scheduling method and their priority characteristic parameters are clarified. Specifically, distinguishing task priority levels provides a classification basis for differentiating tasks of different priorities in subsequent steps; obtaining the maximum execution time provides a quantitative basis for subsequent idle budget calculation and timeout judgment; and the task cycle and absolute deadline provide time constraint parameters for load balancing evaluation in partitioning. Therefore, this step lays a complete task model foundation for the subsequent implementation of semi-partitioning, idle budget determination, and timeout handling mechanisms.
[0034] Step S20: Divide the task set into each processor core to form a load-balanced partitioning scheme; It should be noted that a semi-partitioning strategy is used, assigning the first-priority tasks and second-priority tasks in the task set to the respective processor cores of the multi-core SBC processor. Independent partitioning means that each processor core and its assigned tasks constitute an independent scheduling partition. Under normal circumstances, tasks within each partition execute only on their respective processor cores and do not migrate across cores. Load balancing means that after partitioning, the load on the first-priority tasks and the load on the second-priority tasks are distributed evenly across the cores, and the total load difference between the cores remains within a preset range.
[0035] In addition, the worst-criticism-fit algorithm (MCWF) is used to prioritize the first priority task with the longest execution time in the task set to the processor core with the largest remaining load capacity. Then, the second priority tasks are allocated to the remaining load capacity of each processor core according to the same rules, so that the total load of each processor core tends to be balanced, forming a load-balanced partitioning scheme composed of independent partitions of each core.
[0036] Understandably, this step uses a semi-partition initialization to fix first-priority and second-priority tasks within their respective processor core partitions from the initial stage. This avoids frequent task migrations between cores during subsequent scheduling, reducing cross-core communication overhead. Furthermore, the load-balanced independent partitioning scheme provides a unified benchmark for accurate calculation of the subsequent idle budget, ensuring that idle resource identification in each partition is performed at the same load level, avoiding deviations in idle budget estimation caused by uneven partition load. Simultaneously, evenly distributing first-priority tasks across cores reduces the risk of a single core rapidly exhausting its idle budget due to concentrated timeouts of first-priority tasks, creating favorable conditions for the subsequent timeout buffering mechanism to take effect.
[0037] Step S30: When a scheduling event is triggered, the idle budget of each partition is determined and updated in real time according to the partitioning scheme. It should be noted that scheduling events refer to any event in the system that may lead to a change in task status, including task arrival, task completion, task timeout, or time slice expiration. Idle budget refers to the total amount of reserved processor time resources in each processor core partition that can be used to offset the timeout overhead of the highest priority task at the current moment. It consists of two parts: dynamic idle resources and relaxed idle resources. Dynamic idle resources refer to processor time resources generated due to early task completion that can be immediately reclaimed. Relaxed idle resources refer to processor time resources generated due to unused reserves during the task cycle that can be borrowed without affecting the timely completion of each task.
[0038] Additionally, when a scheduling event is triggered, the event type and the running status information of each processor core are first obtained. Based on the partitioning scheme, all currently active tasks within each partition are identified, including first-priority tasks and second-priority tasks.
[0039] Secondly, for each active task within each partition, the execution requirement of that task at the current moment, the blocking time caused by being blocked by other tasks, the difference in job requirement caused by priority increases or job release fluctuations, and the arrival time of the next job for that task are obtained. Specifically, the execution requirement is determined based on the task's maximum execution time and current execution duration, representing the processor time the task still needs to occupy before completion; the blocking time is determined based on the longest possible blocking time that the task might be blocked by lower-priority tasks when accessing shared resources; the difference in job requirement is determined based on statistics of the instantaneous demand changes caused by the task's historical mode switching or irregular job releases; and the arrival time is the scheduled arrival time of the job in the next scheduling cycle for that task.
[0040] Next, the above parameters are substituted into the improved dynamic demand boundary function for calculation. The formula for calculating the improved dynamic demand boundary function (SDDBF) is as follows:
[0041] in, To fulfill the requirements, For blocking time, This represents the difference in job requirements. The arrival time is calculated by comparing the sum of dynamic blocking factors and fluctuation factors with the minimum arrival time of the task, taking the maximum value, and adding it to the execution requirements to obtain the boundary value of the processor resource requirements of the task at the current moment.
[0042] After obtaining the demand boundary values of all active tasks within the partition, the total capacity of the corresponding processor cores is subtracted from the sum of the demand boundary values of all tasks to obtain the idle budget of the partition. If no tasks are active within the partition, the idle budget of the partition is equal to the total capacity of the processor cores.
[0043] Finally, the calculated idle budget for each partition is compared with the currently recorded idle budget. If a difference exists, the idle budget value for that partition is updated to the new calculated value for use in subsequent timeout handling steps. This completes the idle budget determination and update process triggered by a scheduling event. The system waits for the next scheduling event to trigger and then re-executes the above process.
[0044] Understandably, this step, through the improved SDBF function, accurately identifies and quantifies the dynamic and relaxed idle resources of each partition when each scheduling event is triggered, transforming scattered, fragmented idle time into a measurable idle budget. This provides a quantified resource basis for buffering when first-priority tasks time out, enabling the system to clearly determine whether the currently available idle budget is sufficient to offset timeout costs. Furthermore, by linking the calculation of the idle budget to scheduling events in real time, it ensures the timeliness and accuracy of the idle resource status, avoiding budget deviations caused by static estimations.
[0045] Step S40: If the first priority task times out, the idle budget of the partition where it is located is consumed to offset the timeout overhead. When the idle budget is exhausted, the second priority task is downgraded. It's important to note that timeout refers to a first-priority task's actual execution time exceeding its maximum execution time, preventing it from completing within the scheduled time budget. Timeout overhead refers to the additional processor time consumed due to a first-priority task's timeout, exceeding the original time budget allocated to that task. Degradation involves reducing the execution budget of a second-priority task, allowing it to continue running with the reduced budget, rather than being discarded or terminated outright.
[0046] Additionally, it should be noted that the regular idle budget and the reserve budget together constitute the idle budget of this partition; that is, the idle budget equals the sum of the regular idle budget and the reserve budget. The regular idle budget can be used in both normal scheduling and boundary modes, while the reserve budget is only used to continue offsetting timeout overhead after the regular idle budget is exhausted.
[0047] First, obtain the historical execution data of the first-priority task over the most recent scheduling cycles, including the actual execution time and maximum execution time for each cycle. Based on the historical execution data, calculate the ratio of the actual execution time to the maximum execution time of the first-priority task over the most recent cycles. If this ratio exceeds a preset risk threshold, the first-priority task is determined to have a timeout risk. When a timeout risk is determined, a portion of the current idle budget from the partition where the task is located is allocated as a reserve budget according to a preset ratio. This reserve budget is not consumed during normal scheduling.
[0048] Secondly, when a timeout is detected in the first-priority task within the partition, the current idle budget value of the partition is queried. If the idle budget is greater than zero, boundary mode is entered. In boundary mode, the regular idle budget (excluding the reserve budget) of the partition is consumed first. Processor time resources equal to the timeout overhead are deducted from this regular idle budget, and these resources are used to compensate for the timeout of the first-priority task. The second-priority task within the partition maintains its original execution budget and continues to run normally. As the timeout duration increases, the regular idle budget is continuously consumed and decreases.
[0049] Finally, when the partition's regular idle budget decreases to zero, the reserve budget set aside in the first phase begins to be consumed to offset timeout costs. When the reserve budget also decreases to zero, meaning all of the partition's idle budget is exhausted, the system exits boundary mode and enters high-priority mode. In high-priority mode, preset execution budget degradation parameters are retrieved, and the values of these parameters range from [value missing]. This allows for dynamic calibration to adapt to different application scenarios using multi-core SBC processors. The current execution budget of the second-priority task is multiplied by the execution budget downgrade parameter to obtain the downgraded execution budget, allowing the second-priority task to continue running with the reduced execution budget. It is understood that if the task set also contains third-priority or lower-priority tasks, they can also be downgraded sequentially from lowest to highest priority, with the downgrade steps being the same as those for the second-priority task.
[0050] Meanwhile, when the system mode is switched, the mode state before and after the switch and the reason for the switch are recorded; during the period when the second priority task is downgraded, the change in the execution budget and the actual execution time of the second priority task are recorded; when the idle budget is consumed, the amount of idle budget consumed and the amount remaining are recorded.
[0051] Understandably, this step, through pre-emptive prediction based on historical execution data, establishes a reserve of backup budget before the actual occurrence of a timeout event, providing additional buffer capacity for the system to handle occasional timeouts. Using the regular idle budget as a buffer, it ensures that second-priority tasks can continue to execute normally after a timeout. After all idle budget is exhausted, second-priority and lower-priority tasks are downgraded instead of being directly discarded, allowing each priority task to continue producing data with a reduced execution budget. Where multiple priority levels exist, tasks are downgraded sequentially from lowest to highest priority, ensuring that higher-priority tasks maintain normal execution as much as possible. Recording system mode switching status, the downgraded execution of second-priority tasks, and idle budget consumption data provides a data foundation for subsequent scheduling strategy analysis and optimization. Thus, each priority task maintains execution continuity throughout the entire time a first-priority task times out, ensuring the data integrity of auxiliary functions such as log recording and status reporting. The introduction of pre-emptive prediction and the backup budget mechanism further reduces the probability of being forced to immediately switch to a high-priority mode due to insufficient idle budget, reducing the frequency of priority switching from the source.
[0052] Step S50: The downgraded second priority task is cut and redistributed to each processor core to form a new partitioning scheme, so as to realize the semi-partition elastic scheduling of mixed priority tasks.
[0053] It's important to note that "segmentation" refers to dividing a downgraded second-priority task into multiple independent task segments based on a preset time granularity threshold. Each task segment has its own independent start and end times and execution budget. "Resource gaps" refer to short, scattered idle periods within each processor core partition caused by tasks completing early, task cycle margins, or scheduling gaps. These idle periods are too short for a complete task to utilize. "Reassignment" refers to distributing the segmented task segments to these resource gaps within each processor core using the MCWF algorithm, allowing previously unusable fragmented idle time to support task execution.
[0054] First, obtain the set of second priority tasks after downgrading, the current partitioning scheme and resource usage status of each processor core, the preset time granularity threshold, and the communication overhead threshold; then, cut each downgraded second priority task into multiple task segments according to the time granularity threshold. The execution time of each task segment does not exceed the time granularity threshold, and the original execution order dependency relationship is retained between each task segment. The time granularity threshold is less than 1ms. Secondly, scan each processor core partition, identify the existing resource fragments in each partition and their start and end times and durations, sort them in descending order of duration, and build a list of available fragments; obtain the communication overhead between each processor core, sort all the task segments generated by the segmentation in the order of execution and the remaining execution time, and build a queue of segments to be allocated. Then, task fragments are sequentially retrieved from the queue of fragments to be allocated. Using the MCWF algorithm, the task fragment is allocated to the resource fragment with the longest duration in the list of available fragments, whose corresponding processor core communication overhead is lower than the communication overhead threshold, and which can accommodate the execution duration of the task fragment. The remaining duration of the occupied resource fragment is updated, and the task fragment is removed from the queue of fragments to be allocated. The above allocation process is repeated until the queue of fragments to be allocated is empty or the resource fragments in the list of available fragments cannot accommodate the remaining task fragments. Finally, based on the allocation results of each task fragment in the resource gaps of each processor core, the partition configuration of each processor core is updated, and the newly allocated task fragments are included in the scheduling queue of each partition to form a new partition scheme. In addition, after the system has run for a preset duration or a preset number of scheduling cycles, the recorded system data is acquired, and the idle budget, the execution budget degradation parameter, the time granularity threshold, and the communication overhead threshold are adjusted based on the system data.
[0055] Understandably, this step involves cutting and reallocating the downgraded second-priority tasks. Tasks that would otherwise face reduced execution opportunities due to budget cuts are embedded as task fragments within resource gaps in each processor core for continued execution. Specifically, the minimum time granularity of these task fragments is limited to within one millisecond, ensuring that the fragmented task fragments match the typical resource gap size of the multi-core session boundary controller processor, effectively filling fragmented idle time. Simultaneously, by acquiring the communication overhead between processor cores and setting a communication overhead threshold, task fragments are preferentially allocated to processor cores with lower communication overhead, reducing the communication overhead associated with migrating task fragments across cores. Adjustments to the idle budget, execution budget downgrade parameters, time granularity threshold, and communication overhead threshold based on recorded system data allow for dynamic optimization of scheduling parameters according to actual operating conditions, forming a closed-loop feedback for scheduling decisions and improving the scheduling method's continuous adaptability to different operating scenarios of the multi-core session boundary controller.
[0056] This embodiment provides a hybrid priority task scheduling method that ensures the execution continuity and data integrity of low-priority tasks.
[0057] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 After step S50, the method further includes steps S60-S70: Step S60: Based on the simple smoothing model, correct the maximum execution time of each task and update the maximum execution time of the corresponding task in the task set.
[0058] It should be noted that the simple smoothing model refers to a feedback correction model that uses a smoothing factor to weight and fuse actual execution values and historical values. Since the execution time of a first-priority task may exceed the maximum execution time due to occasional traffic fluctuations during actual operation, directly using the single timeout value as the new maximum execution time would lead to overly conservative calculations of subsequent idle budgets, causing unnecessary mode switching.
[0059] Additionally, after each first-priority task is completed, the actual execution time of that task and the currently recorded maximum execution time are obtained. A preset smoothing factor is then obtained, and the actual execution time, the currently recorded maximum execution time, and the smoothing factor are substituted into the feedback formula of the simple smoothing model for calculation.
[0060]
[0061] in, This is the corrected maximum execution time; This refers to the actual execution time. The maximum execution time currently recorded; This is a smoothing factor, with a value range of [value range missing]. When the value of γ is small, the corrected maximum execution time depends more on historical cumulative data and is less affected by fluctuations in the actual execution time of a single instance. The calculated corrected maximum execution time replaces the currently recorded maximum execution time for this task, updating the maximum execution time attribute of the corresponding task in the task set.
[0062] Understandably, this step uses a simple smoothing model to correct the maximum execution time. By using a small smoothing factor, the corrected maximum execution time mainly depends on long-term historical trends, avoiding a one-time large increase in the maximum execution time due to occasional timeouts. This reduces the probability of subsequent idle budget calculations being too high and the system entering high-priority mode too early.
[0063] Step S70: When the system enters the idle safe period, restore the full service of the downgraded task.
[0064] It should be noted that the idle safe moment refers to the time when the load rate of each processor core remains below the preset load threshold for a preset duration, indicating that the system has no risk of first-priority tasks timing out and processor resources are sufficient. Restoring full service to degraded tasks means restoring the execution budget of second-priority tasks and other lower-priority tasks that have been degraded to their original levels before degrading, so that they can run normally with the full execution budget.
[0065] First, continuously monitor the load rate of each processor core and the actual execution time of each task. Obtain preset load thresholds and duration thresholds. When the load rate of each processor core is found to be lower than the load threshold, start timing. If the duration of the load rate remaining lower than the load threshold exceeds the duration threshold, the system is determined to have entered an idle safe period. After determining that the system has entered an idle safe period, query the list of priority tasks currently in a degraded state and obtain the original execution budget of each degraded task before the degrade process. Restore the current execution budget of each degraded task to its original execution budget, restoring it from a degraded execution state to a full execution state.
[0066] Understandably, this step uses dual safety conditions to trigger recovery only after the load rate falls below a threshold and remains in that state for a sufficient duration, avoiding frequent switching caused by instantaneous fluctuations in load rate. Each degraded task is then restored from its degraded state to a full service state, allowing it to run with its full execution budget once system resources are sufficient, thus restoring the integrity and timeliness of data output.
[0067] This embodiment avoids excessive impact of occasional timeouts on subsequent scheduling decisions by smoothly correcting the maximum execution time, reducing unnecessary switching caused by overly high predicted values. By setting dual safety conditions to determine the safe idle time before restoring full service, it avoids repeated switching oscillations caused by premature restoration, ensuring the smoothness of system mode fallback. These steps, in conjunction with the idle budget consumption and degradation handling mechanism in Embodiment 1, form a complete control loop for system priority switching from the two stages of "in-process buffering—post-process smoothing," reducing the frequency of priority switching and improving the stability of system service quality.
[0068] For example, to help understand the implementation flow of the hybrid priority task scheduling method obtained by combining this embodiment with the above embodiment one, please refer to... Figure 3 , Figure 3 A simplified flowchart of a hybrid priority task scheduling method is provided, specifically: Task attribute definition: Defines a quadruple (C) for the task set processed by the multi-core SBC processor. i , T i D i , L i ), where Ci T is the maximum execution time of the task. i For the task cycle, D i L is the absolute deadline for the task. i Task priority level; Semi-partition initialization: Using the MCWF algorithm, the first priority tasks and the second priority tasks in the task set are assigned to the designated CPU cores of the multi-core SBC processor to form independent partitions, ensuring load balance among the cores; Real-time monitoring of idle resources: Based on the improved SDBF function, the dynamic idle resources and relaxed idle resources in each partition are identified in real time when each task scheduling event is triggered, and the idle budget (SptR) is calculated and updated. Priority mode flexible control: When a first-priority task times out, it enters boundary mode, prioritizing the use of the current partition's idle budget to offset the timeout overhead and maintain the normal operation of the second-priority task. If the idle budget is exhausted, switch to high priority mode and degrade second priority and lower priority tasks. Second-priority task fragmentation remapping: Using task cutting technology, the downgraded second-priority tasks are cut into task fragments and redistributed to the partitions of each processor core through the MCWF algorithm to fill the resource gaps within the partitions; System mode adaptive fallback: Through a feedback mechanism based on a simple smoothing model, the actual execution time of tasks is monitored in real time. The maximum execution time prediction value of the next task is corrected using a smoothing factor. When the system enters an idle and safe period, it smoothly switches back to the normal mode and restores full service of the second priority task.
[0069] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the hybrid priority task scheduling method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0070] This application also provides a hybrid priority task scheduling device; please refer to [reference needed]. Figure 4 The hybrid priority task scheduling device includes: Task set module 10 is used to obtain a task set, which includes tasks, task priorities and maximum execution time; Partitioning module 20 is used to divide the task set into each processor core to form a load-balanced partitioning scheme. The scheduling module 30 is used to determine and update the idle budget of each partition in real time according to the partitioning scheme when a scheduling event is triggered. The timeout module 40 is used to consume the idle budget of the partition where the first priority task times out to offset the timeout overhead, and to degrade the second priority task when the idle budget is exhausted. The cutting module 50 is used to cut down the second priority tasks and redistribute them to each processor core to form a new partitioning scheme, so as to realize the semi-partition elastic scheduling of mixed priority tasks.
[0071] The hybrid priority task scheduling device provided in this application, employing the hybrid priority task scheduling method in the above embodiments, can solve the technical problem that traditional scheduling algorithms directly discard low-priority tasks when high-priority tasks time out, causing data loss and log interruption. Compared with the prior art, the beneficial effects of the hybrid priority task scheduling device provided in this application are the same as those of the hybrid priority task scheduling method provided in the above embodiments, and other technical features in the hybrid priority task scheduling device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0072] This application provides a hybrid priority task scheduling device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the hybrid priority task scheduling method in the above embodiment 1.
[0073] The following is for reference. Figure 5 The diagram illustrates a structural schematic of a hybrid priority task scheduling device suitable for implementing embodiments of this application. The hybrid priority task scheduling device in embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The hybrid priority task scheduling device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0074] like Figure 5As shown, the hybrid priority task scheduling device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1002 or a program loaded from storage device 1003 into random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the hybrid priority task scheduling device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the hybrid priority task scheduling device to communicate wirelessly or wiredly with other devices to exchange data. Although a hybrid priority task scheduling device with various systems is shown in the figure, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0075] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0076] The hybrid priority task scheduling device provided in this application, employing the hybrid priority task scheduling method described in the above embodiments, can solve the technical problem that traditional scheduling algorithms directly discard low-priority tasks when high-priority tasks time out, resulting in data loss and log interruption. Compared with the prior art, the beneficial effects of the hybrid priority task scheduling device provided in this application are the same as those of the hybrid priority task scheduling method provided in the above embodiments, and other technical features of this hybrid priority task scheduling device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0077] It should be understood that the various parts disclosed in this application can be implemented using 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 suitable manner in one or more embodiments or examples.
[0078] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0079] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the hybrid priority task scheduling method in the above embodiments.
[0080] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0081] The aforementioned computer-readable storage medium may be included in a mixed-priority task scheduling device; or it may exist independently and not be assembled into a mixed-priority task scheduling device.
[0082] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by a hybrid priority task scheduling device, the hybrid priority task scheduling device: acquires a task set, the task set including tasks, task priorities, and maximum execution time; divides the task set into various processor cores to form a load-balanced partitioning scheme; when a scheduling event is triggered, determines and updates the idle budget of each partition in real time according to the partitioning scheme; in the case of a first-priority task timeout, consumes the idle budget of the partition to offset the timeout overhead; when the idle budget is exhausted, downgrades the second-priority task; and cuts and redistributes the downgraded second-priority task to various processor cores to form a new partitioning scheme, thereby achieving hybrid priority task semi-partition elastic scheduling.
[0083] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "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 a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0084] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0085] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0086] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described hybrid priority task scheduling method. This solves the technical problem that traditional scheduling algorithms directly discard low-priority tasks when high-priority tasks time out, causing data loss and log interruption. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the hybrid priority task scheduling method provided in the above embodiments, and will not be repeated here.
[0087] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A hybrid priority task scheduling method, characterized in that, The method includes: Obtain a task set, which includes tasks, task priorities, and maximum execution time; The task set is divided into different processor cores to form a load-balanced partitioning scheme. When a scheduling event is triggered, the idle budget of each partition is determined and updated in real time according to the partitioning scheme. If a first-priority task times out, the idle budget of the partition in which it is located is consumed to offset the timeout cost. When the idle budget is exhausted, the second-priority task is downgraded. The downgraded second-priority tasks are split and redistributed to each processor core to form a new partitioning scheme, so as to achieve semi-partitioned elastic scheduling of mixed-priority tasks. The downgrading process for the second priority task includes: Obtain execution budget degradation parameters, wherein the execution budget degradation parameters are dynamically calibrated to adapt to different application scenarios; Based on the execution budget downgrade parameters, the second priority task is downgraded to obtain the downgraded second priority task; The idle budget includes a regular idle budget and a reserve budget; the step of consuming the idle budget of the partition to offset the timeout overhead when the first priority task times out, and before degrading the second priority task when the idle budget is exhausted, includes: Obtain historical execution data of the first priority task, and determine whether the first priority task has a timeout risk based on the historical execution data; When the aforementioned timeout risk exists, a preset proportion of the idle budget is reserved as a backup budget, and the remaining idle operations are reserved as a regular idle budget. Wherein, in the case of a first-priority task timeout, the idle budget of the partition where it is located is consumed to offset the timeout overhead; and when the idle budget is exhausted, the second-priority task is downgraded, including: In the event of a timeout for a first-priority task, the regular idle budget of the partition in which the task is located is consumed first to offset the timeout cost. After the regular idle budget is exhausted, the reserve budget is consumed to offset the timeout cost. When both the regular idle budget and the reserve budget are exhausted, the second priority task is downgraded.
2. The method as described in claim 1, characterized in that, When a scheduling event is triggered, the idle budget of each partition is determined and updated in real time according to the partitioning scheme, including: When a scheduling event is triggered, determine the execution requirements of the first-priority and second-priority tasks within each partition; Based on the execution requirements, analyze the blocking impact and sudden fluctuations caused by the first priority task on the second priority task, and determine the difference between the blocking time and the change in job requirements. Based on the arrival time of each task, the execution requirements, the blocking time, and the difference in job requirements, the idle budget of each partition is determined and updated using a preset function.
3. The method as described in claim 1, characterized in that, Following the step of forming a new partitioning scheme, the method further includes: Monitor the load rate of each processor core and the actual execution time of each task; Get the load threshold and duration threshold; Based on the actual execution time, the maximum execution time of each task is corrected according to a simple smoothing model, and the maximum execution time of the corresponding task in the task set is updated. When the duration for which the load rate is less than the load threshold is greater than the duration threshold, the system is determined to enter an idle safe period and the degraded task is restored to full service.
4. The method as described in claim 1, characterized in that, The step of splitting and redistributing the downgraded second-priority tasks to each processor core includes: Obtain the time granularity threshold, communication overhead threshold, and communication overhead between each processor core; The downgraded second-priority task is divided into task fragments, and the time granularity of the task fragments is smaller than the time granularity threshold. Based on the communication overhead, the task segments are allocated to the processor cores whose communication overhead is below the communication overhead threshold.
5. The method according to any one of claims 1 to 4, characterized in that, Following the step of triggering the scheduling event, the following steps are also included: Record system data, including: system mode switching status, execution status of second priority tasks, and idle budget utilization data; Based on the system data, the idle budget, execution budget degradation parameters, time granularity threshold, and communication overhead threshold are adjusted to optimize the scheduling performance of the hybrid priority task semi-partition elastic scheduling method.
6. A hybrid priority task scheduling device, characterized in that, The device includes: The task set module is used to obtain a task set, which includes tasks, task priorities, and maximum execution time. The partitioning module is used to divide the task set into each processor core to form a load-balanced partitioning scheme. The scheduling module is used to determine and update the idle budget of each partition in real time according to the partitioning scheme when a scheduling event is triggered; wherein the idle budget includes a regular idle budget and a reserve budget. The timeout module is used to consume the idle budget of the partition to offset the timeout overhead when the first priority task times out, and to degrade the second priority task when the idle budget is exhausted. The partitioning module is used to partition and redistribute the downgraded second-priority tasks to each processor core to form a new partitioning scheme, so as to realize the semi-partition elastic scheduling of mixed priority tasks. The timeout module is also used to obtain execution budget degradation parameters, wherein the execution budget degradation parameters are dynamically calibrated to adapt to different application scenarios; and the second priority task is downgraded according to the execution budget degradation parameters to obtain the downgraded second priority task. The scheduling module is further configured to acquire historical execution data of the first priority task, determine whether the first priority task has a timeout risk based on the historical execution data, and when the timeout risk exists, reserve a preset proportion of the idle budget as a backup budget and reserve the remaining idle operations as a regular idle budget. The timeout module is further configured to, in the event of a timeout of a first-priority task, first consume the regular idle budget of the partition to offset the timeout overhead, and consume the reserve budget to offset the timeout overhead after the regular idle budget is exhausted; and when both the regular idle budget and the reserve budget are exhausted, downgrade the second-priority task.
7. A hybrid priority task scheduling device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the hybrid priority task scheduling method as described in any one of claims 1 to 5.
8. 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, it implements the steps of the hybrid priority task scheduling method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Computing resource scheduling method and device and computer device
CN112363821A
Load balancing method and system of low-power AI processor
CN121070629A
Task priority scheduling and resource awareness management method for unmanned ship
CN121277645A
Data link dynamic time slot allocation method and device based on service priority
CN122476465A
