A flexible and dynamic scheduling method for mixed-criticality systems
By dynamically adjusting the resource allocation of high- and low-criticality tasks, the problems of resource waste and unbalanced task execution in mixed-criticality systems are solved, and efficient resource utilization and task scheduling are achieved.
Patent Information
- Application Number
- CN202211150040.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-21
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-09-21
AI Technical Summary
In existing mixed-criticality system task scheduling methods, static resource allocation for high-criticality tasks leads to resource waste and performance degradation of low-criticality tasks, and cannot effectively balance resource utilization between high-criticality and low-criticality tasks.
A flexible and dynamic mixed-criticality system scheduling method is adopted to ensure the schedulability and resource utilization of high-criticality tasks by dynamically adjusting the resource allocation of high- and low-criticality tasks and dynamically switching modes according to the actual execution status of high-criticality tasks.
It reduces resource waste, improves the system's resource utilization efficiency, and ensures balanced execution performance of high and low critical tasks.
Smart Images

Figure CN115619002B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of embedded real-time systems, and in particular relates to a flexible dynamic hybrid critical system scheduling method. Background Art
[0002] Continuous breakthroughs in integrated circuit technology have significantly increased the scale and performance of embedded systems. In recent years, mixed-criticality systems (MCS) have seen increasing application in real-time embedded systems across automotive, industrial, power, and aerospace industries. For example, in the smart grid sector, a mixed-criticality system for power inspection drones consists of computing tasks with diverse safety requirements, such as motor control and image acquisition. The safe and reliable scheduling of motor control computing tasks directly impacts the flight performance of the inspection drone. Failure to promptly execute these high-security computing tasks can have serious or even fatal consequences for the inspection drone system. On the other hand, failure to promptly execute low-security computing tasks, such as capturing and capturing photos, more often impacts the quality of fault inspection photos obtained by grid personnel, and has less of an impact on the inspection drone system.
[0003] In mixed-criticality systems, computing tasks of functional subsystems with different safety criticalities are represented by different criticality levels. Tasks are divided into high-criticality (HC) tasks and low-criticality (LC) tasks based on the level of safety requirements. To ensure the schedulability of high-criticality tasks, existing work mainly includes the following three aspects:
[0004] (1) Ensure timely execution of high-criticality tasks: directly abandon the execution of all low-criticality tasks, which will cause the service quality of low-criticality tasks to be suddenly and significantly reduced, greatly affecting the user's overall experience of low-security requirement functions.
[0005] (2) Mode switching depends on triggering method: When a high-criticality task is overspent, all other high-criticality tasks will switch to the high-criticality mode, which will generate a large amount of unnecessary resource pre-sale and lead to waste of system resources.
[0006] (3) Static budget allocation method: The execution resource overhead of high-criticality tasks in low-criticality mode is determined before the task scheduling begins, and its execution resources are directly allocated according to the estimated execution time of the high-criticality tasks in low-criticality mode.
[0007] In the commonly used model for scheduling tasks in mixed-criticality systems, the need for low-criticality tasks to balance overall system resources by reducing their own execution time after a high-criticality task overruns is calculated by allocating idle system resources proportionally, assuming all high-criticality tasks will overrun. Overall, this method employs a static budget allocation approach, whereby the execution resource overhead of a high-criticality task in low-criticality mode is allocated directly based on the estimated execution time of the high-criticality task in low-criticality mode, without considering the actual operation of the high-criticality task. When the actual execution time of a high-criticality task is significantly less than its estimated execution time, a significant amount of redundant resource expenditure results, leading to wasted system resources and reduced execution performance of the low-criticality task. Summary of the Invention
[0008] The present invention aims to provide a flexible and dynamic hybrid critical system scheduling method to solve the above technical problems.
[0009] To solve the above technical problems, the specific technical solution of a flexible dynamic hybrid critical system scheduling method of the present invention is as follows:
[0010] A flexible and dynamic hybrid critical system scheduling method includes the following steps:
[0011] Step 1: Establish a task model, define K-level high-criticality patterns, service levels, and K-level maximum execution resource budget cap;
[0012] Step 2: Establish an execution framework. Initially, all tasks are in low-criticality mode. During the scheduling process, if any high-criticality task experiences an overspending, it will trigger a switch to high-criticality mode, and the system's high-criticality level will be raised by one level. If the conditions for returning to low-criticality mode are met during the scheduling process, all tasks will return to low-criticality mode, and this cycle will repeat until the scheduling is completed.
[0013] Step 3: Establish a scheduling algorithm;
[0014] Before scheduling begins, an indicator is used to determine whether the system needs to switch to high-criticality mode;
[0015] Scheduling starts. In the initial state, all high-critical tasks will be scheduled according to the virtual deadline x×T i When any high-critical task has an overspending, it will immediately switch to high-critical mode. At this time, the deadline used for scheduling the overspending high-critical task will be reduced from the original virtual deadline x×T i Restore to the actual deadline T i, other high-criticality tasks are not affected and are still scheduled with the original deadline. At the same time, the execution frequency of low-criticality tasks is updated under the new service level to achieve a utilization balance between low-criticality tasks and high-criticality tasks; the maximum execution resource budget under the new high-criticality mode is calculated; during the scheduling process, when the system detects an idle state, that is, there are no more tasks to be scheduled, the system returns to the low-criticality mode and the execution frequency of the low-criticality tasks returns to T i , until the scheduling is completed;
[0016] Step 4: Establish a maximum execution budget allocation strategy;
[0017] If the actual time required for scheduling and executing a high-criticality task in low-criticality mode is greater than the maximum execution budget that can be allocated according to the maximum execution budget allocation strategy, then the high-criticality task will be immediately switched to high-criticality mode, and other high-criticality tasks will remain in their original mode unchanged.
[0018] Furthermore, the task model establishment in step 1 includes: considering N Γ={τ1,τ2,...,τ n} The case of mixed criticality scheduling of non-dependent periodic tasks on a single-core processor platform Γ={τ1,τ2,...,τ n}, where any task τ i The characteristics can be expressed as Among them L i Indicates the critical level of the task, considering the case of a dual-critical system, that is, L i ={LO,HI},T i Represents the period of the task, and the deadline is equal to its period, Represents the task τ i The worst execution time WCET in high criticality mode, Represents the task τ i The worst execution time WCET in low-criticality mode is equal to the WCET of low-criticality tasks in low-criticality mode and high-criticality mode, while high-criticality tasks have two different WCETs and satisfy
[0019] The utilization of the mixed criticality system task set can be calculated by the following formula
[0020]
[0021]
[0022]
[0023]
[0024] When any high-criticality task has an overspending and requires compensation from a low-criticality task, the new system utilization of the low-criticality task is updated as follows:
[0025]
[0026] k represents the number of high-criticality tasks entering high-criticality mode, and τik represents the utilization rate of low-criticality tasks τik when k high-criticality tasks enter high-criticality mode.
[0027] Furthermore, the step 1 of defining the K-level high-key mode includes:
[0028] At a given moment, if k high-criticality tasks are switched to high-criticality mode, the system is in level k high-criticality mode. When all high-criticality tasks are in low-criticality mode, the system is considered to be in level 0 high-criticality mode.
[0029] Furthermore, the step 1 of defining the service level includes:
[0030] The service level is a marker used to specify the service quality of the low-criticality task after the high-criticality task switches mode, denoted as The system updates the current service level each time it switches modes Determine the new service quality of low-criticality tasks after mode switching, assuming the initial state and If the system has experienced the kth th Mode conversion, that low critical task τ i The new quality of service is That is, the execution frequency of low-critical tasks has been reduced from the original Adjust to
[0031] Furthermore, the step 1 of defining the K-level maximum execution resource budget upper limit includes:
[0032] The k-level maximum execution resource budget upper limit refers to the maximum resource expenditure that all high-criticality tasks in low-criticality mode can still maintain in low-criticality mode when the system is in k-level high-criticality mode, which is recorded as Assuming that the upper limit of the maximum execution resource budget of level 0 is the sum of the estimated execution time budget of all high-criticality tasks in low-criticality mode for the system CPU utilization, for the entire task set, the upper limit of the maximum execution resource budget of level 0 is:
[0033]
[0034] The maximum execution resource budget cap for level k is obtained by subtracting the cost of the high-criticality task that has switched to high-criticality mode in low-criticality mode before switching to high-criticality mode from the maximum execution resource budget cap for level 0. When the system is in level k high-criticality mode, once the running resource cost of the remaining high-criticality tasks still in low-criticality mode exceeds the maximum execution resource budget cap for level k, a new high-criticality task is triggered to switch modes, and the high-criticality mode of the system will be increased by one level. The maximum execution resource budget for all level k is:
[0035]
[0036] Here you is Refers to high-criticality tasks τ i The execution resources occupied in low-criticality mode before switching to high-criticality mode, Refers to the set of high-criticality tasks in high-criticality mode.
[0037] Furthermore, the step 1 includes calculating the utilization rate, specifically including:
[0038] Resource utilization of high-criticality tasks in low-criticality mode:
[0039]
[0040] Resource utilization of high-criticality tasks in high-criticality mode:
[0041]
[0042] Low mission-critical resource utilization:
[0043]
[0044] Low-criticality tasks are in the kth th Resource utilization after conversion to independent mode:
[0045]
[0046] For the entire task set,
[0047] Resource utilization of high-criticality tasks in high-criticality mode:
[0048]
[0049] Resource utilization of high-criticality tasks in low-criticality mode:
[0050]
[0051] Low mission-critical resource utilization:
[0052]
[0053] Low-criticality tasks are in the kth th Utilization after conversion to independent mode:
[0054]
[0055] Utilization at low mission critical minimum quality of service: in It is the minimum service level specified by the user.
[0056] Furthermore, the execution framework of step 2 includes:
[0057] Low-criticality mode: Initially, all tasks are in low-criticality mode, as long as they do not exceed the maximum execution budget. Then the system always remains in low-criticality mode for task scheduling;
[0058] Scheduling execution: During the scheduling process, when a new job is released, it will be inserted into the task queue to be scheduled. The system will select the job with the highest priority in the task queue to be scheduled for scheduling. i,j For high-criticality tasks and τ i,j In b i,j Failed to complete high-critical tasks i Immediately switch from low-criticality mode to high-criticality mode. Other high-criticality tasks remain in their original modes, and the system's high-criticality mode level k is increased by one level.
[0059] Update the execution time budget of low-criticality tasks: During the scheduling execution process, the system will update the current service level of low-criticality tasks every time it switches modes The execution frequency of low-critical tasks has changed from the original Adjust to The change is dynamically adjusted by the specific overrun situation of the high-criticality task. Under the new high-criticality mode level, the execution time budget of the low-criticality tasks remains unchanged and they are scheduled according to the new deadline.
[0060] Restore to low-criticality mode: When the system detects an idle state, that is, when there are no more tasks to be scheduled, the system returns to low-criticality mode and the execution frequency of low-criticality tasks returns to T i .
[0061] Furthermore, the step 3 includes the following specific steps:
[0062] Before scheduling begins, the virtual deadline factor x is calculated and the test condition of Formula 16 needs to be met to ensure the schedulability of the task under this method. The maximum resource cost for all high-criticality tasks to remain in low-criticality mode is calculated. Used as an indicator to determine whether the system needs to switch to high-criticality mode during the online task scheduling operation phase;
[0063]
[0064]
[0065] Scheduling starts. In the initial state, all high-critical tasks will be scheduled according to the virtual deadline x×T i When any high-critical task has an overspending, it will immediately switch to high-critical mode. At this time, the deadline used for scheduling the overspending high-critical task will be reduced from the original virtual deadline x×T i Restore to the actual deadline T i , other high-criticality tasks are not affected and are still scheduled with the original deadline. At the same time, the execution frequency of low-criticality tasks under the new service level is updated according to Formula 18 to achieve a utilization balance between low-criticality tasks and high-criticality tasks. The maximum execution resource budget in the new high-criticality mode is calculated according to Formula 7. During the scheduling process, when the system detects an idle state, that is, there are no more tasks to be scheduled, the system will return to the low-criticality mode, and the execution frequency of low-criticality tasks will return to T i , until the scheduling is completed;
[0066]
[0067] Furthermore, the step 4 is divided into four steps, including calculation, switching, updating and recovery;
[0068] Calculation: When the job currently assigned from the queue of tasks to be scheduled is a high-critical job, calculate the τ of this scheduled job according to formula 19 i,j The maximum execution time budget that can be allocated in low-criticality mode b i,j , which is subsequently used as an indicator to determine whether to trigger the switch to high-criticality mode. When the currently scheduled job selected from the task queue is a low-criticality job, this calculation step is not required;
[0069] Switching: When high-critical operations τ i,j In its maximum execution time budget b i,jIf the task fails to complete within 10 seconds, the mode switching link is triggered, and the high-criticality task is immediately switched from the low-criticality mode to the high-criticality mode. The high-criticality mode level k is increased by one level. The overspending of this task will not trigger other high-criticality tasks to enter the high-criticality mode. All other high-criticality tasks maintain their original modes unchanged. Under the new high-criticality mode level, the system re-determines the execution frequency of low-criticality tasks based on the overspending of high-criticality tasks to balance the resource demand caused by the overspending of high-criticality tasks. The execution time budget of low-criticality tasks remains unchanged and is scheduled according to the new deadline. At the same time, it is necessary to re-determine the maximum execution resources for the remaining high-criticality tasks that have not switched to the high-criticality mode to remain in the low-criticality mode under the new high-criticality mode level for subsequent calculations.
[0070] Update: From formula 19, we can know that the maximum execution time budget b that can be allocated to the high-criticality task is calculated i,j With other high-critical operations τ n,j Actual total execution time Therefore, in each high-criticality job τ i,j An update is triggered when the job is completed or preempted by a higher priority job and needs to return to the queue to be scheduled. link, the duration of the current scheduling operation e i,j Accumulate
[0071] Recovery: When the system detects an idle state, that is, there are no more tasks to be scheduled, the system recovery link is triggered and all tasks are restored to low-criticality mode. Clear, the execution frequency of low-critical tasks is restored to the original execution frequency,
[0072]
[0073] Mode switching condition, assuming that at time t°, the system is in a non-idle state, the job τ n,j Scheduling is in progress, and the system mode switch is triggered. Indicates that before time t, task τ i |t / T i |+1 jobτ i,j The total execution time, if the job τ n,j This scheduling starts at time t and an overspending occurs at time t°. If t≤t°, then the following conditions must be satisfied:
[0074]
[0075]
[0076] The flexible dynamic hybrid criticality system scheduling method of the present invention has the following advantages: the present invention can dynamically allocate resources based on the actual execution status of high-criticality tasks in low-criticality mode, reducing unnecessary resource waste caused by pessimistic processing. High-criticality tasks will dynamically allocate system resources in low-criticality mode based on the actual execution time requirements of their operation, and will no longer be statically allocated according to the execution time budget estimate allocated before scheduling; the condition for high-criticality tasks to switch from low-criticality mode to high-criticality mode is no longer based on their execution time budget estimate as an indicator, but will be dynamically calculated based on the actual operation status of all high-criticality tasks in low-criticality mode. Compared with the most advanced existing solutions, this method has a significant optimization effect in terms of task schedulability and system switching costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Figure 1 Schematic diagram of the flexible dynamic hybrid critical system scheduling execution framework of the present invention;
[0078] Figure 2 Schematic diagram of the flexible dynamic hybrid critical system scheduling algorithm framework of the present invention;
[0079] Figure 3 A schematic diagram of a maximum execution budget allocation strategy for flexible dynamic hybrid critical system scheduling according to the present invention;
[0080] Figure 4a This is a schematic diagram of the scheduling results under the static execution budget allocation of the present invention;
[0081] Figure 4b This is a schematic diagram of the scheduling results under the dynamic execution budget allocation of the present invention. DETAILED DESCRIPTION
[0082] In order to better understand the purpose, structure and function of the present invention, a flexible dynamic hybrid critical system scheduling method of the present invention is further described in detail below with reference to the accompanying drawings.
[0083] A flexible dynamic hybrid critical system scheduling method of the present invention comprises the following steps:
[0084] Step 1: Establish a mission model, define the high-criticality mode level, service level, and the maximum execution resource budget cap for each level.
[0085] Task model: The present invention considers N Γ={τ1,τ2,...,τ n} The case of mixed criticality scheduling of non-dependent periodic tasks on a single-core processor platform Γ={τ1,τ2,...,τ n}, where any task τ i The characteristics can be expressed as Among them L iIndicates the critical level of the task. The present invention considers the case of a dual-critical system, namely L i ={LO,HI}. T i Represents the period of the task, and the deadline is equal to its period. Represents the task τ i Worst Case Execution Time (WCET) in high criticality mode. Represents the task τ i Worst case execution time (WCET) in low criticality mode. Low criticality tasks have the same WCET in low criticality mode and high criticality mode, while high criticality tasks have two different WCETs and satisfy
[0086] The utilization of the mixed criticality system task set can be calculated by the following formula
[0087]
[0088]
[0089]
[0090]
[0091] When any high-criticality task has an overspending and requires compensation from a low-criticality task, the new system utilization of the low-criticality task is updated as follows:
[0092]
[0093] k represents the number of high-criticality tasks that enter high-criticality mode, τ i k Represents a low-criticality task when k high-criticality tasks enter high-criticality mode τ i k utilization rate.
[0094] To better characterize the execution budget of low-criticality tasks in high-criticality mode, the following definitions are used:
[0095] Definition 1: k-level high-key pattern
[0096] At a given moment, if k high-criticality tasks are switched to high-criticality mode, the system is in level k high-criticality mode. When all high-criticality tasks are in low-criticality mode, the system can be considered to be in level 0 high-criticality mode.
[0097] Definition 2: Service Level
[0098] The service level is a marker used to specify the service quality of the low-criticality task after the high-criticality task switches to a low-criticality task. The system will also update the current service level each time it switches modes. Determine the new service quality of low-criticality tasks after mode switching. Assuming the initial state and If the system has experienced the kth th Mode conversion, that low critical task τ i The new quality of service is That is, the execution frequency of low-critical tasks has been reduced from the original Adjust to
[0099] Definition 3: Maximum execution resource budget limit at level k
[0100] The k-level maximum execution resource budget upper limit refers to the maximum resource expenditure that all high-criticality tasks in low-criticality mode can still maintain in low-criticality mode when the system is in k-level high-criticality mode. It is recorded here as Assuming that the upper limit of the maximum execution resource budget of level 0 is the sum of the estimated execution time budget of all high-criticality tasks in low-criticality mode for the system CPU utilization, the upper limit of the maximum execution resource budget of level 0 for the entire task set is:
[0101]
[0102] The maximum execution resource budget cap for level k can be calculated by subtracting the cost of the high-criticality task that has switched to high-criticality mode from the cost of the high-criticality task in low-criticality mode before switching to high-criticality mode from the maximum execution resource budget cap for level 0. When the system is in high-criticality mode at level k, if the running resource cost of the remaining high-criticality tasks in low-criticality mode exceeds the maximum execution resource budget cap for level k, a new high-criticality task will be triggered to switch modes, and the system's high-criticality mode will be increased by one level. The total maximum execution resource budget for level k is:
[0103]
[0104] Here you is Refers to high-criticality tasks τ i The execution resources occupied in low-criticality mode before switching to high-criticality mode. Refers to the set of high-criticality tasks in high-criticality mode.
[0105] In addition, the calculation formulas for other relevant utilization rates are as follows.
[0106] Resource utilization of high-criticality tasks in low-criticality mode:
[0107]
[0108] Resource utilization of high-criticality tasks in high-criticality mode:
[0109]
[0110] Low mission-critical resource utilization:
[0111]
[0112] Low-criticality tasks are in the kth th Resource utilization after conversion to independent mode:
[0113]
[0114] For the entire task set,
[0115] Resource utilization of high-criticality tasks in high-criticality mode:
[0116]
[0117] Resource utilization of high-criticality tasks in low-criticality mode:
[0118]
[0119] Low mission-critical resource utilization:
[0120]
[0121] Low-criticality tasks are in the kth th Utilization after conversion to independent mode:
[0122]
[0123] Utilization at low mission critical minimum quality of service: in It is the minimum service level specified by the user.
[0124] Step 2: Establish an execution framework.
[0125] Initially, all tasks are in low-criticality mode. During the scheduling process, if any high-criticality task has an overspending, it will trigger itself to switch to high-criticality mode, and the system's high-criticality mode level will also be raised by one level. If the conditions for returning to low-criticality mode are met during the scheduling process, all tasks will return to low-criticality mode, and this cycle will repeat until the scheduling is completed. The execution framework is as follows: Figure 1 shown.
[0126] Low-criticality mode: Initially, all tasks are in low-criticality mode, as long as they do not exceed the maximum execution budget. Then the system can always remain in low-criticality mode for task scheduling.
[0127] Scheduling execution: During the scheduling process, when a new job is released, it will be inserted into the queue of tasks to be scheduled. The system will select the job with the highest priority in the queue of tasks to be scheduled for scheduling. i,j For high-criticality tasks and τ i,j In b i,j Failed to complete high-critical tasks i Immediately switch from low-criticality mode to high-criticality mode. Other high-criticality tasks remain in their original modes, and the system's high-criticality mode level k is increased by one level.
[0128] Update the execution time budget of low-criticality tasks: During the scheduling execution process, the system will update the current service level of low-criticality tasks every time it switches modes The execution frequency of low-critical tasks has changed from the original Adjust to The change is dynamically adjusted by the specific overrun situation of the high-criticality task. Under the new high-criticality mode level, the execution time budget of the low-criticality tasks remains unchanged and they are scheduled according to the new deadline.
[0129] Restore to low-criticality mode: When the system detects an idle state, that is, when there are no more tasks to be scheduled, the system returns to low-criticality mode and the execution frequency of low-criticality tasks returns to T i .
[0130] Step 3: Establish a scheduling algorithm.
[0131] Before scheduling begins, the virtual deadline factor x is calculated and the test condition of formula 16 must be met to ensure the schedulability of the task under this method. Calculate the maximum resource cost for all high-criticality tasks to remain running in low-criticality mode It is used as an indicator to judge whether the system needs to switch to high-criticality mode during the online task scheduling operation phase.
[0132]
[0133]
[0134] Scheduling starts. In the initial state, all high-critical tasks will be scheduled according to the virtual deadline x×T i When any high-critical task has an overspending, it will immediately switch to high-critical mode. At this time, the deadline used for scheduling the overspending high-critical task will be reduced from the original virtual deadline x×T i Restore to the actual deadline T i, other high-criticality tasks are not affected and are still scheduled with their original deadlines. At the same time, the execution frequency of low-criticality tasks under the new service level is updated according to Formula 18 to achieve a utilization balance between low-criticality tasks and high-criticality tasks. The maximum execution resource budget in the new high-criticality mode is calculated according to Formula 7. During the scheduling process, when the system detects an idle state, that is, there are no more tasks to be scheduled, the system will return to the low-criticality mode and the execution frequency of the low-criticality tasks will return to T i , until the scheduling is completed.
[0135]
[0136] Algorithm implementation framework such as Figure 2 As shown. Lines 1-2 are the offline calculation process before scheduling begins. First, the utilization u is calculated according to formulas 12-14 and 6 respectively. hl 、u hh 、 And the virtual deadline factor x of the high-criticality task in the low-criticality mode is obtained by calculation. The online scheduling stage can only be entered when the task set meets the schedulability conditions, otherwise a new task set needs to be regenerated until formula 16 is satisfied. Lines 3-12 are the online scheduling process. The initial state of all tasks is low-criticality mode (line 3). In low-criticality mode, high-criticality tasks are scheduled according to their virtual deadlines. The system selects the task closest to the deadline from the queue of tasks to be scheduled for scheduling (line 5). Once any high-criticality job τ i,j According to the actual operation status of all high-key tasks in low-key mode, b is dynamically calculated. i,j If a task fails to complete within the specified timeframe (line 6), the task's state is immediately switched from low-criticality mode to high-criticality mode, where it is given a larger execution time budget. Other high-criticality tasks remain in their original modes. The overrun for the high-criticality task is calculated using Equation 17, and the new quality of service for the low-criticality task is updated using Equation 18 to balance resource requirements. Equation 7 is also used to calculate the maximum total execution resource budget in the new high-criticality mode for subsequent scheduling calculations. Scheduling continues, and the system jumps back to line 5 to schedule the next job (line 7). When the assigned job is scheduled and there are no more jobs in the pending task queue (i.e., the system detects idleness), the completion status of all low-criticality tasks is calculated and updated. All tasks return to low-criticality mode, and the system jumps back to line 5, waiting for the pending job to be released and inserted into the pending queue for continued scheduling (lines 10-11). Otherwise, scheduling continues directly, and the system jumps back to line 5 to schedule the next job (lines 8-9). After scheduling is complete, the PFJ (PFJ represents the success rate of low-criticality tasks completing before their deadlines) and the switching cost are calculated, and the final result is output (line 13).
[0137] Step 4: Establish a maximum execution budget allocation strategy.
[0138] In the present invention, the execution time overhead of high-criticality tasks in low-criticality mode will be dynamically allocated according to the actual execution time of their operation. This way of dynamically allocating execution time overhead can more effectively take into account the actual situation of task scheduling, reduce unnecessary resource waste, and delay the frequency of system mode switching, ensuring the schedulability of high-criticality tasks while improving the execution performance of low-criticality tasks. The maximum execution budget allocation strategy is proposed to ensure that high-criticality tasks can dynamically allocate execution running overhead according to the actual time required for their scheduled execution in low-criticality mode, while determining that the high-criticality tasks can still maintain the upper limit of the execution budget that can be allocated when running in low-criticality mode, thereby ensuring the schedulability of high-criticality tasks. That is, if the actual time required for its scheduled execution is greater than the maximum execution budget that can be allocated calculated by the maximum execution budget allocation strategy, then the high-criticality task needs to switch to the high-criticality mode immediately, and other high-criticality tasks still maintain the original mode unchanged.
[0139] The following describes how the maximum execution budget allocation strategy in the present invention supports the dynamic allocation of execution overhead for high-criticality tasks in low-criticality mode. Figure 3 As shown, it can be divided into four links.
[0140] (1) Calculation: When the current scheduled task is selected from the task queue to be scheduled as a high-critical task, calculate the current scheduled task τ according to formula 19. i,j The maximum execution time budget that can be allocated in low-criticality mode b i,j , which is subsequently used as an indicator to determine whether to trigger the switch to high-criticality mode. If the job currently assigned from the queue of pending tasks is a low-criticality job, this calculation step is not required.
[0141] (2) Switching: When the high-criticality job τ i,j In its maximum execution time budget b i,j If the task fails to be completed within 30 seconds, the mode switch will be triggered. The high-criticality task will immediately switch from the low-criticality mode to the high-criticality mode, and the high-criticality mode level k will be increased by one level. The overspending of this task will not trigger other high-criticality tasks to enter the high-criticality mode. All other high-criticality tasks will maintain their original modes unchanged. Under the new high-criticality mode level, the system will redefine the execution frequency of low-criticality tasks based on the overspending of high-criticality tasks to balance the resource requirements caused by the overspending of high-criticality tasks. The execution time budget of low-criticality tasks remains unchanged and is scheduled according to the new deadline. At the same time, it is necessary to redefine the maximum execution resources that the remaining high-criticality tasks that have not switched to the high-criticality mode can still maintain in the low-criticality mode under the new high-criticality mode level for subsequent calculations.
[0142] (3) Update: From Formula 19, we can know that the maximum execution time budget b that can be allocated to the high-criticality task is calculated. i,j With other high-critical operations τ n,j Actual total execution time Therefore, in each high-criticality task τ i,j An update is triggered when the job is completed or preempted by a higher priority job and needs to return to the queue to be scheduled. link, the duration of the current scheduling operation e i,j Accumulate
[0143] (4) Recovery: When the system detects an idle state, that is, there are no more tasks to be scheduled, the system recovery phase will be triggered. All tasks will be restored to low-criticality mode. Cleared to zero, the execution frequency of the low-criticality task is restored to the original execution frequency.
[0144]
[0145] Mode switching condition. Assume that at time t°, the system is in a non-idle state and the job τ n,j Scheduling is in progress, and the system mode switch is triggered. Indicates that before time t, task τ i |t / T i |+1 jobτ i,j The total execution time, if the job τ n,j This scheduling starts at time t and an overspending occurs at time t°. If t≤t°, then the following conditions must be satisfied:
[0146]
[0147]
[0148] For clarity, the following is an example based on the method of the present invention. In this scheduling example, consider a task set. The system contains three tasks γ = {τ1, τ2, τ3}, as shown in Table 1, τ1 = {20, HC, 2, 4}, τ2 = {20, HC, 4, 8}, τ3 = {20, LC, 10, 10}. In the offline phase before scheduling begins, u can be calculated. hl =0.3,u hh =0.6,u ll =0.5, x=0.6, And it meets the test conditions of schedulability. The specific process of scheduling with the two methods before and after improvement can be seen Figure 4a-4b shown.
[0149] Table 1: Scheduling of mixed-criticality task scheduling examples
[0150]
[0151] In existing scheduling methods, the worst-case execution time budget estimate for a high-criticality task in low-criticality mode is determined before scheduling. As long as the high-criticality task is in low-criticality mode, it will be allocated the specified execution time budget. If the high-criticality task fails to complete within the worst-case execution time budget estimate in low-criticality mode, the system switches to high-criticality mode and allocates more execution time to the high-criticality task. This method is a static budget allocation method, where the budget is determined before the task begins scheduling and does not need to consider the actual operation of the task. In practice, if the actual execution time of a high-criticality task is far less than its worst-case execution time budget estimate, it will result in a large amount of resource waste.
[0152] This invention focuses on mixed-criticality system task scheduling and proposes a more practical and flexible dynamic mixed-criticality system task scheduling method to address the above-mentioned issues. In low-criticality mode, high-criticality tasks are dynamically allocated system resources based on their actual execution time requirements, rather than statically allocated according to pre-allocated execution time budget estimates. Furthermore, the condition for a high-criticality task to switch to high-criticality mode in low-criticality mode is no longer based on its execution time budget estimate, but is dynamically calculated based on the actual operation of all high-criticality tasks in low-criticality mode. This reduces the significant resource waste caused by unnecessary pessimistic processing while ensuring the schedulability of high-criticality tasks.
[0153] It will be understood that the present invention is described by way of some embodiments, and it will be appreciated by those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are intended to be protected by the present invention.
Claims
1. A flexible and dynamic hybrid critical system scheduling method, characterized in that: The steps include: Step 1: Establish a task model, define K-level high-criticality patterns, service levels, and K-level maximum execution resource budget cap; The step 1 defines the upper limit of the K-level maximum execution resource budget, including: The k-level maximum execution resource budget upper limit refers to the maximum resource expenditure that all high-criticality tasks in low-criticality mode can still maintain in low-criticality mode when the system is in k-level high-criticality mode, which is recorded as Assuming that the upper limit of the maximum execution resource budget of level 0 is the sum of the estimated execution time budget of all high-criticality tasks in low-criticality mode for the system CPU utilization, for the entire task set, the upper limit of the maximum execution resource budget of level 0 is: The maximum execution resource budget cap for level k is obtained by subtracting the cost of the high-criticality task that has switched to high-criticality mode in low-criticality mode before switching to high-criticality mode from the maximum execution resource budget cap for level 0. When the system is in level k high-criticality mode, once the running resource cost of the remaining high-criticality tasks still in low-criticality mode exceeds the maximum execution resource budget cap for level k, a new high-criticality task is triggered to switch modes, and the high-criticality mode of the system will be increased by one level. The maximum execution resource budget for all level k is: Here you is Refers to high-criticality tasks τ i The execution resources occupied in low-criticality mode before switching to high-criticality mode, Refers to the set of high-criticality tasks in high-criticality mode; Step 2: Establish an execution framework. Initially, all tasks are in low-criticality mode. During the scheduling process, if any high-criticality task experiences an overspending, it will trigger a switch to high-criticality mode, and the system's high-criticality level will be raised by one level. If the conditions for returning to low-criticality mode are met during the scheduling process, all tasks will return to low-criticality mode, and this cycle will repeat until the scheduling is completed. Step 3: Establish a scheduling algorithm; Before scheduling begins, an indicator is used to determine whether the system needs to switch to high-criticality mode; Scheduling starts. In the initial state, all high-critical tasks will be scheduled according to the virtual deadline x×T i When any high-critical task has an overspending, it will immediately switch to high-critical mode. At this time, the deadline used for scheduling the overspending high-critical task will be reduced from the original virtual deadline x×T i Restore to the actual deadline T i , other high-criticality tasks are not affected and are still scheduled with the original deadline. At the same time, the execution frequency of low-criticality tasks is updated under the new service level to achieve a utilization balance between low-criticality tasks and high-criticality tasks; the maximum execution resource budget under the new high-criticality mode is calculated; during the scheduling process, when the system detects an idle state, that is, there are no more tasks to be scheduled, the system returns to the low-criticality mode and the execution frequency of the low-criticality tasks returns to T i , until the scheduling is completed; Step 4: Establish a maximum execution budget allocation strategy; If the actual time required for a high-criticality task to be scheduled in low-criticality mode is greater than the maximum execution budget that can be allocated according to the maximum execution budget allocation strategy, then the high-criticality task will be immediately switched to high-criticality mode, while other high-criticality tasks will remain in their original mode. Step 4 is divided into four steps, including calculation, switching, updating and recovery; Calculation: When the job currently assigned from the queue of tasks to be scheduled is a high-critical job, calculate the τ of this scheduled job according to formula 19 i,j The maximum execution time budget that can be allocated in low-criticality mode b i,j , which is subsequently used as an indicator to determine whether to trigger the switch to high-criticality mode. When the currently scheduled job selected from the task queue is a low-criticality job, this calculation step is not required; Switching: When high-critical operations τ i,j In its maximum execution time budget b i,j If the task fails to complete within 10 seconds, the mode switching link is triggered, and the high-criticality task is immediately switched from the low-criticality mode to the high-criticality mode. The high-criticality mode level k is increased by one level. The overspending of this task will not trigger other high-criticality tasks to enter the high-criticality mode. All other high-criticality tasks maintain their original modes unchanged. Under the new high-criticality mode level, the system re-determines the execution frequency of low-criticality tasks based on the overspending of high-criticality tasks to balance the resource demand caused by the overspending of high-criticality tasks. The execution time budget of low-criticality tasks remains unchanged and is scheduled according to the new deadline. At the same time, it is necessary to re-determine the maximum execution resources for the remaining high-criticality tasks that have not switched to the high-criticality mode to remain in the low-criticality mode under the new high-criticality mode level for subsequent calculations. Update: From formula 19, we can know that the maximum execution time budget b that can be allocated to the high-criticality task is calculated i,j With other high-critical operations τ n,j Actual total execution time Therefore, in each high-criticality job τ i,j An update is triggered when the job is completed or preempted by a higher priority job and needs to return to the queue to be scheduled. link, the duration of the current scheduling operation e i,j Accumulate Recovery: When the system detects an idle state, that is, there are no more tasks to be scheduled, the system recovery link is triggered and all tasks are restored to low-criticality mode. Clear, the execution frequency of low-critical tasks is restored to the original execution frequency, Mode switching condition, assuming that at time t°, the system is in a non-idle state, the job τ n,j Scheduling is in progress, and the system mode switch is triggered. Indicates that before time t, task τ i |t / T i |+1 jobτ i,j The total execution time, if the job τ n,j This scheduling starts at time t and an overspending occurs at time t, t≤t°, then it must satisfy:
2. The flexible dynamic hybrid critical system scheduling method according to claim 1, characterized in that: The step 1 of establishing the task model includes: considering N Γ={τ1,τ2,...,τ n } The case of mixed criticality scheduling of non-dependent periodic tasks on a single-core processor platform Γ={τ1,τ2,...,τ n }, where any task τ i The characteristics can be expressed as Among them L i Indicates the critical level of the task, considering the case of a dual-critical system, that is, L i ={LO,HI},T i Represents the period of the task, and the deadline is equal to its period, Represents the task τ i The worst execution time WCET in high criticality mode, Represents the task τ i The worst execution time WCET in low-criticality mode is equal to the WCET of low-criticality tasks in low-criticality mode and high-criticality mode, while high-criticality tasks have two different WCETs and satisfy The utilization of the mixed criticality system task set can be calculated by the following formula When any high-criticality task has an overspending and requires compensation from a low-criticality task, the new system utilization of the low-criticality task is updated as follows: k represents the number of high-criticality tasks that enter high-criticality mode, Represents a low-criticality task when k high-criticality tasks enter high-criticality mode utilization rate.
3. The flexible dynamic hybrid critical system scheduling method according to claim 1, characterized in that: Step 1 of defining the K-level high-key mode includes: At a given moment, if k high-criticality tasks are switched to high-criticality mode, the system is in level k high-criticality mode. When all high-criticality tasks are in low-criticality mode, the system is considered to be in level 0 high-criticality mode.
4. The flexible dynamic hybrid critical system scheduling method according to claim 1, characterized in that: Step 1 of defining service levels includes: The service level is a marker used to specify the service quality of the low-criticality task after the high-criticality task switches mode, denoted as The system updates the current service level each time it switches modes Determine the new service quality of low-criticality tasks after mode switching, assuming the initial state and If the system has experienced the kth th Mode conversion, that low critical task τ i The new quality of service is That is, the execution frequency of low-critical tasks has been reduced from the original Adjust to 5. The flexible dynamic mixed criticality system scheduling method according to claim 1, characterized in that: The step 1 includes calculating the utilization rate, specifically including: Resource utilization of high-criticality tasks in low-criticality mode: Resource utilization of high-criticality tasks in high-criticality mode: Low mission-critical resource utilization: Low-criticality tasks are in the kth th Resource utilization after conversion to independent mode: For the entire task set, Resource utilization of high-criticality tasks in high-criticality mode: Resource utilization of high-criticality tasks in low-criticality mode: Low mission-critical resource utilization: Low-criticality tasks are in the kth th Utilization after conversion to independent mode: Utilization at low mission critical minimum quality of service: in It is the minimum service level specified by the user.
6. The flexible dynamic mixed criticality system scheduling method according to claim 1, characterized in that: The execution framework of step 2 includes: Low-criticality mode: Initially, all tasks are in low-criticality mode, as long as they do not exceed the maximum execution budget. Then the system always remains in low-criticality mode for task scheduling; Scheduling execution: During the scheduling process, when a new job is released, it will be inserted into the task queue to be scheduled. The system will select the job with the highest priority in the task queue to be scheduled for scheduling. i,j For high-criticality tasks and τ i,j In b i,j Failed to complete high-critical tasks i Immediately switch from low-criticality mode to high-criticality mode. Other high-criticality tasks remain in their original modes, and the system's high-criticality mode level k is increased by one level. Update the execution time budget of low-criticality tasks: During the scheduling execution process, the system will update the current service level of low-criticality tasks every time it switches modes The execution frequency of low-critical tasks has changed from the original Adjust to The change is dynamically adjusted by the specific overrun situation of the high-criticality task. Under the new high-criticality mode level, the execution time budget of the low-criticality tasks remains unchanged and they are scheduled according to the new deadline. Restore to low-criticality mode: When the system detects an idle state, that is, when there are no more tasks to be scheduled, the system returns to low-criticality mode and the execution frequency of low-criticality tasks returns to T i .
7. The flexible dynamic mixed criticality system scheduling method according to claim 1, characterized in that: The step 3 includes the following specific steps: Before scheduling begins, the virtual deadline factor x is calculated and the test condition of Formula 16 needs to be met to ensure the schedulability of the task under this method. The maximum resource cost for all high-criticality tasks to remain in low-criticality mode is calculated. Used as an indicator to determine whether the system needs to switch to high-criticality mode during the online task scheduling operation phase; Scheduling starts. In the initial state, all high-critical tasks will be scheduled according to the virtual deadline x×T i When any high-critical task has an overspending, it will immediately switch to high-critical mode. At this time, the deadline used for scheduling the overspending high-critical task will be reduced from the original virtual deadline x×T i Restore to the actual deadline T i , other high-criticality tasks are not affected and are still scheduled with the original deadline. At the same time, the execution frequency of low-criticality tasks under the new service level is updated according to Formula 18 to achieve a utilization balance between low-criticality tasks and high-criticality tasks. The maximum execution resource budget in the new high-criticality mode is calculated according to Formula 7. During the scheduling process, when the system detects an idle state, that is, there are no more tasks to be scheduled, the system will return to the low-criticality mode, and the execution frequency of low-criticality tasks will return to T i , until the scheduling is completed;
Citation Information
Patent Citations
Coverage extension for wireless devices
CN109076462A
Idle resource scheduling method in hybrid critical level system
CN112799808A