Task resource dynamic adaptive scheduling method, automobile electronic physical system and automobile
By calculating the uplink value of tasks and scheduling slack time in real time in automotive electronic physical systems, dynamically sorting and allocating resources, the problem that traditional static scheduling methods are difficult to cope with dynamic task scheduling, and efficient scheduling and real-time requirements of task resources are realized , ensuring the timely completion of critical tasks and improving system efficiency.
Patent Information
- Application Number
- CN202411505043.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-01-03
AI Technical Summary
Traditional static scheduling methods are difficult to cope with the dynamic and randomly published task resource scheduling requirements in automotive electronic physical systems, especially when tasks are highly real-time and security requirements, it is difficult to ensure efficient execution of tasks.
Using the dynamic adaptive scheduling method of task resources, the uplink order value and scheduling slack time of real-time calculation, dynamically sort the task priority, and allocate processor resources during each round of scheduling to ensure that high-priority tasks are executed in a timely manner, and Degrading mode and priority adjustments are performed when tasks are timed out or resources are insufficient.
In the case of tasks intensive and limited resources, ensuring that critical tasks are completed within the specified time will improve the overall efficiency and resource utilization of the system, respond to task changes in a timely manner, and reduce task missed rates and resource waste.
Smart Images

Figure CN119248457A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method for dynamically adaptively scheduling task resources, an automotive electronic-physical system, and an automobile. Background Art
[0002] With the rapid development of autonomous driving technology, automotive cyberphysical systems (ACPS) need to handle dynamic and randomly released applications. The system divides applications into different priorities according to the real-time and safety requirements of the tasks and executes them on the on-board computing platform. Traditional static scheduling methods have difficulty in dealing with this dynamic and multi-task complexity. Summary of the invention
[0003] The purpose of this application is to provide a task resource dynamic adaptive scheduling method, an automotive electronic physical system and a vehicle, which can meet the real-time requirements of task resource scheduling under uncertain task release conditions and improve the overall efficiency of task scheduling.
[0004] To achieve the above objectives, this application provides the following solutions.
[0005] In a first aspect, the present application provides a method for dynamically adaptively scheduling task resources, comprising:
[0006] In each round of scheduling, the upstream order value and scheduling slack time of each task are calculated in real time;
[0007] Dynamically sort tasks based on their upstream order values and scheduling slack time, and output a priority list of tasks;
[0008] Select a preset number of tasks from the priority list of tasks and add them to the list of tasks to be executed;
[0009] Processors are allocated to tasks in the to-be-executed task list, and the allocated processors execute the corresponding tasks.
[0010] Optionally, the real-time calculation of the uplink sequence value of each task specifically includes:
[0011] Using formula
[0012] Calculate each task A m .n i The ascending order value rank(A m .n i ); where A m .n i Representative application set A m The i-th task in ; Represents Task A m .n i The average worst-case execution time on all processors capable of handling the task; succ(A m .n i ) is Task A m .n i The set of all subsequent tasks of A m .n j It is Task A m .n i The successor task of rank(A m .n j ) indicates task A m .n j The ascending order value of A m .Comm i,j It is Task A m .n i and the successor task A m .n j The communication delay between them; max means taking the maximum value.
[0013] Optionally, the real-time calculation of the scheduling slack time of each task specifically includes:
[0014] Using the formula scheduleslack(A m .n i )=abs_deadline(A m .n i )-lower_bound(A m .n i ) Calculate each task A m .n i Schedule slack (A m .n i ); where sabs_deadline(A m .n i ) indicates task A m .n i The absolute deadline; lower_bound(A m .n i ) indicates task A m .n i The execution lower bound of .
[0015] Optionally, the dynamically sorting based on the upstream sequence value and the scheduling slack time of the tasks and outputting a priority list of the tasks specifically includes:
[0016] The task with a larger upward order value and a shorter scheduling slack time has a higher priority and is ranked higher in the priority list;
[0017] If two tasks have the same upstream order value and scheduling slack time, the task with the earlier absolute deadline will be sorted first.
[0018] Optionally, the step of assigning a processor to a task in the to-be-executed task list specifically includes:
[0019] Using formula
[0020] Computational Task A m .n i In the processor p k The earliest start time on EST (A m .n i ,p k );where avail(p k ) represents processor p k Available time; pred(A m .n i ) is Task A m .n i The set of all predecessor tasks of A m .n' j It is Task A m .n i The precursor task of AFT (A m .n' j ) represents the predecessor task A m .n' j Actual completion time of Comm j,i It is a precursor task A m .n' j With Task A m .n i Communication delay between
[0021] Using the formula EFT(A m .n i ,p k )=EST(A m .n i ,p k )+WCET(A m .n i ,p k ) Computational Task A m .n i In the processor p k The earliest completion time EFT (A m .n i ,p k ); WCET(A m .n i ,p k) indicates task A m .n i In the processor p k Worst case execution time on ;
[0022] Task A m .n i Assigned to the group with the minimum EFT(A m .n i ,p k ) processor p k superior.
[0023] Optionally, before calculating the uplink order value and scheduling slack time of each task in real time during each round of scheduling, the process further includes:
[0024] Initial systematization priority SYS.Priority, application set A m And the list of tasks to be executed SYS_ReadyList;
[0025] Initialize the timeout flag AS_OverRun and mode flag AS_Mode of each application.
[0026] Optionally, the task resource dynamic adaptive scheduling method further includes:
[0027] During each round of scheduling, a timeout check is performed on each task:
[0028] When a task timeout is detected, all unfinished tasks related to the task in the current scheduling round are immediately canceled and put back into their priority list. At the same time, the mode flag of the task is set to AS_Mode 1, and the task enters the degraded mode.
[0029] Optionally, after the task enters the degraded mode, the process further includes:
[0030] If a task still cannot be completed within the specified absolute deadline in the degraded mode, the priority adjustment mechanism is started to adjust the current system priority SYS.Priority according to the priority Am.Pri of the unfinished task.
[0031] In a second aspect, the present application also provides an automotive electronic-physical system, comprising: a memory, a server, and a computer program stored in the memory and executable on the server, wherein the server executes the computer program to implement the method for dynamic adaptive scheduling of task resources.
[0032] In a third aspect, the present application also provides a car equipped with the above-mentioned automotive electronic physical system.
[0033] According to the specific embodiments provided in this application, this application discloses the following technical effects:
[0034] The present application provides a method for dynamically adaptive scheduling of task resources, an automotive electronic-physical system, and an automotive vehicle. In the task sorting stage, dynamic sorting is performed based on the upstream sequence value and scheduling slack time of the tasks, ensuring that high-priority and time-critical tasks can be executed first, so that the system can still ensure that key tasks are completed within the specified deadline when the tasks are intensive and resources are limited; further, the priority of the task can be updated in real time according to the results of each round of scheduling. This adaptive scheduling strategy can respond to various changes in task execution in a timely manner, and can meet the real-time requirements of task resource scheduling when the task release is uncertain; the scheduling order is adjusted according to the priority and real-time requirements of the new task. This flexibility can handle randomly released new tasks without increasing a large amount of rescheduling burden, avoid resource waste, and improve the overall utilization of the system and the overall efficiency of task scheduling. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 A flowchart of a method for dynamic adaptive scheduling of task resources is shown;
[0037] Figure 2 Schematic diagram of the main process of dynamic adaptive scheduling of task resources. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0039] The present application proposes a task resource dynamic adaptive scheduling method, an automotive electronic physical system and a vehicle, which can meet the real-time requirements of task resource scheduling under uncertain task release conditions and improve the overall efficiency of task scheduling.
[0040] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0041] In an exemplary embodiment, Figure 1 As shown, the present application provides a method for dynamically adaptively scheduling task resources, including the following steps 1 to 4. The method for dynamically adaptively scheduling task resources of the present application is usually executed by an automotive electronic physical system (as a task scheduling system, hereinafter referred to as the system). Figure 2 As shown in the figure, the system needs to be initialized when it starts. During the system initialization process, the key parameters of the system are first set to ensure that the basic environment of task scheduling can run stably. The key parameters of the system mainly include the system priority (also called system priority) SYS.Priority, application set A m , the task list to be executed SYS_ReadyList, and the timeout flag AS_OverRun and mode flag AS_Mode of each application.
[0042] Among them, the system priority SYS.Priority is initialized to 1, which means that the current system is in the lowest priority state. The priority will be dynamically adjusted according to actual task requirements to adapt to the urgency and importance of different tasks.
[0043] The system loads the initial application set A m , which contains all applications released when the system is started (referred to as applications, that is, the tasks described in this application). Each application will be registered at this stage to ensure that these tasks can be executed normally in subsequent scheduling. This step provides the basis for the source of tasks for system scheduling. All tasks to be executed are marked and assigned to the corresponding application set in this step. The applications released by the automotive electronic physical system mainly involve drive control, braking system, body control and other aspects. For example, applications involving automotive body control are responsible for controlling various electrical devices in the car, such as windows, door locks, air conditioners, etc., which can respond to the driver's operating instructions in real time and provide convenient in-car environment control. Applications involving engine control are responsible for controlling the operation of the engine, including fuel injection, ignition timing, etc. Communicate with the engine through sensors and actuators to ensure efficient and safe operation of the engine. Applications involving airbag control are used to quickly activate airbags to protect passenger safety after detecting danger signals through sensors in the event of a collision. This requires complex algorithms and high-speed response mechanisms. In addition, there are some auxiliary and intelligent applications, such as adaptive cruise control, lane keeping assist system, etc. These applications collect data through sensors such as cameras and radars, and provide more intelligent driving assistance functions after algorithm processing. mIt contains all the applications that need to be executed initially, and plays the role of initializing all tasks. The tasks in the application set will be scheduled according to the subsequent steps and become tasks to be executed. In short, it is a collection of tasks.
[0044] In order to deal with possible timeouts during task execution, the system configures a timeout flag AS_OverRun for each application. During initialization, the timeout flags of all applications are set to 0, indicating that no task timeouts occurred during the initial system startup. If an application fails to complete within the specified time during subsequent execution, its corresponding timeout flag will be set to the priority of the task, making it easier for the system to rearrange the execution order of the task, thereby ensuring that high-priority tasks get more execution opportunities when resources are tight.
[0045] At the same time, the system configures a mode flag AS_Mode for each application to distinguish whether the task is in normal mode or degraded mode. In the initial state, the mode flags of all applications are set to 0, indicating that all tasks of the system are in normal execution mode. In the subsequent scheduling process, if a task fails to be completed on time due to resource constraints or other reasons, the system will set its corresponding mode flag to 1, indicating that the task has entered degraded mode. The setting of degraded mode allows the task to complete the necessary functions even when the time budget is reduced, avoiding complete failure of the task.
[0046] Finally, a list of tasks to be executed, SYS_ReadyList, is initialized. The list is empty at first. Then, according to the system priority, qualified tasks are selected from the application's task priority list and added to the list of tasks to be executed. At the beginning of each round of scheduling, the system dynamically updates the list according to the current priority and task slack time to ensure that the system can flexibly respond to the addition of new tasks or changes in resource conditions.
[0047] Step 1: In each round of scheduling, the upstream order value and scheduling slack time of each task are calculated in real time.
[0048] See also Figure 2 After the system is initialized, the relevant attributes of each task need to be accurately calculated to ensure the effectiveness and real-time performance of task scheduling in a multi-priority system. The relevant attributes of each task usually include the task's upward rank value, absolute deadline, lower bound, and schedule slack.
[0049] Specifically, the upstream order value of a task is calculated based on the execution time and communication delay of its successor tasks. The larger the upstream order value, the longer the execution time of the task or its successor tasks, or the greater the communication delay between them. The calculation formula for the upstream order value of a task is as follows:
[0050]
[0051] Among them A m .n i Representative application set A m The i-th task in rank(A m .n i ) represents task A m .n i The ascending order value of ; Represents Task A m .n i The average worst-case execution time on all processors capable of handling the task; succ(A m .n i ) is Task A m .n i The set of all subsequent tasks of A m .n j It is Task A m .n i The successor task of rank(A m .n j ) indicates task A m .n j The ascending order value of A m .Comm i,j It is Task A m .n i and the successor task A m .n j The communication delay between them; max means taking the maximum value.
[0052] According to the calculation formula (1) of the task's upward order value, the system can assign a priority to the task and insert the task into the task priority list Am.task_PriorityList according to the priority. The larger the upward order value, the higher the priority, and the earlier the task is assigned for execution. For an exiting task, its upward order value is equal to the average WCET of the task. The average WCET of a task refers to the average worst-case execution time of the task on all processors that can process the task.
[0053] During the task priority calculation process, the system also calculates the scheduling slack time of each task based on the real-time requirements of the task. The scheduling slack time is the time difference between the absolute deadline of the task and its minimum response time (execution lower bound), and the formula is as follows:
[0054] scheduleslack(A m .n i )=abs_deadline(A m .n i )-lower_bound(A m .n i )(2)
[0055] Among them, scheduleslack (A m .n i ) indicates task A m .n i The scheduling slack time of sabs_deadline(A m .n i ) indicates task A m .n i The absolute deadline of the task, which is the latest completion time determined by the system requirements or physical safety of the task. m .n i ) indicates task A m .n i The execution lower bound is the shortest execution time required for the task under ideal conditions. In the process of calculating task attributes, the real-time requirements and execution lower bound of each application need to be considered. The execution lower bound is defined as the shortest response (execution) time of the application. When the application monopolizes all processor resources, its shortest response time is the same as the earliest completion time (EarliestFinishTime, EFT). This execution lower bound is an important basis for subsequent dynamic scheduling, which is used to determine whether the application can be completed on time under the real-time requirements of the system.
[0056] Schedule slack (A m .n i ) reflects Task A m .n i The maximum delay time that can be tolerated. If the delay of the task's completion time relative to the lower bound exceeds this scheduling slack time, the task will not be completed on time. By calculating the scheduling slack time, the system can evaluate the time margin of the task. Scheduling slack time is the maximum delay time that a task can tolerate without violating its absolute deadline. Scheduling slack time reflects the time difference between the earliest time a task can be completed and the time it must be completed. A longer scheduling slack time means that the task has a larger time margin, while a shorter scheduling slack time means that the task is close to timeout and its execution must be given priority.
[0057] As a result, the system can dynamically adjust the priority of tasks, so that tasks with shorter scheduling slack time and more likely to miss the deadline can be given priority execution. In this way, it is ensured that tasks can be completed within their absolute deadlines, improving the overall scheduling efficiency of the system.
[0058] Step 2: Dynamically sort the tasks based on their upstream order values and scheduling slack time, and output a priority list of tasks.
[0059] In the task scheduling process, task sorting is a core step to ensure that the system can complete critical tasks in a timely manner. The priority of a task is determined by analyzing its importance in the entire application and the task chain it depends on (i.e., its predecessor and successor tasks). Each task is sorted according to its upstream order value and scheduling slack time to determine the scheduling order of the tasks. Tasks with larger upstream order values and shorter scheduling slack times have higher priorities and will receive higher execution priority during the scheduling process. This process ensures that those tasks that are most likely to miss their deadlines get priority in processor resources by sorting all the tasks to be executed.
[0060] See also Figure 2 , this application uses the HEFT (Heterogeneous EarliestFinishTime) algorithm to determine the priority list Am.task_PriorityList of each task and the earliest completion time EFT of the task. The HEFT algorithm is an effective DAG (directed acyclic graph) scheduling algorithm widely used on heterogeneous computing platforms, which can minimize the earliest completion time of tasks on multi-processor platforms. Since scheduling DAG tasks with the requirement of minimum completion time on multi-processor platforms has been proven to be an NP-hard problem, the HEFT algorithm is considered in the industry and academia to be an important tool for obtaining the lower bound of task execution. The HEFT algorithm is mainly divided into two stages for task scheduling: task priority sorting stage (corresponding to step 2) and processor selection stage (corresponding to step 4).
[0061] Through the HEFT (Heterogeneous Earliest Finish Time) algorithm, the system first prioritizes tasks according to their ascending order values. The ascending order value represents the execution time of the task itself and its successor tasks, as well as the communication delay between them. Therefore, tasks with longer execution time or larger communication delay will be given higher priority, ensuring that these tasks are processed first in scheduling.
[0062] During the sorting process, the system also calculates the scheduling slack time of each task. Scheduling slack time is the time difference between the absolute deadline of a task and its minimum response time, which reflects the maximum delay time that a task can tolerate during execution. Tasks with shorter scheduling slack time mean that they are closer to the edge of timeout, so they will be prioritized when the system schedules them.
[0063] The system adds all tasks to the priority list in order of priority based on their ascending order values and scheduled slack times. The system first sorts tasks by their ascending order values, and then sorts them again by scheduled slack time for tasks of the same priority. The ascending order value determines the importance of the task, while the scheduled slack time reflects the time urgency of the task, so the combination of the two ensures that the most urgent and important tasks are processed first. Tasks with larger ascending order values and shorter scheduled slack times have higher priorities and are ranked higher in the priority list. If two tasks have the same ascending order value and scheduled slack time, the task with the earlier absolute deadline is ranked higher.
[0064] Through this task sorting strategy, the system can ensure that critical tasks are completed on time and strike a balance between task priority and system resources. This dynamic sorting method also takes into account the insertion and dynamic release of new tasks. New tasks are added to the existing task list according to their priority and real-time requirements and are reordered in each round of scheduling. Through this flexible sorting strategy, the system can optimize resource allocation according to the urgency of the task and the current execution status, maximizing the system's real-time performance and scheduling efficiency.
[0065] Step 3: Select a preset number of tasks from the task priority list and add them to the pending task list.
[0066] After the task priority sorting stage, we can get the task priority list Am.task_PriorityList, which is a list of tasks arranged according to priority. This priority list is used in the subsequent task scheduling process. In the task selection and task allocation stages, the scheduler will select tasks from this list for scheduling. Specifically, in each round of scheduling, the system will select Nmax(Am) tasks from the task priority list Am.task_PriorityList according to the current priority dynamics and add them to the task list SYS_ReadyList to be executed, for example, inserting them to the end of the task list SYS_ReadyList to be executed.
[0067] The scheduling process follows the "round-robin scheduling" strategy, that is, in each round of scheduling, the system selects tasks from the head of the task priority list and adds them to the list of tasks to be executed. Through the dynamic sorting strategy, the system updates the list of tasks to be executed SYS_ReadyList in each round of scheduling. This list contains the tasks to be executed selected by the system based on the current priority and scheduling slack time. In the subsequent task allocation stage, the system will allocate processor resources to tasks based on this list.
[0068] Step 4: Allocate processors to the tasks in the to-be-executed task list, and let the allocated processors execute the corresponding tasks.
[0069] See also Figure 2 During the process of task preparation and task allocation, the system selects a certain number of tasks from the task priority list and enters the task list to be executed SYS_ReadyList. The selection is based on the current system priority SYS.Priority and the execution status of each application. After the task is prepared, the system begins to allocate tasks. Specifically, the scheduling system calculates the earliest completion time of each task on different processors based on the earliest completion time algorithm. In order to ensure that the task can be executed as early as possible, the system assigns each task to the processor with the smallest EFT value. The EFT value of each task is determined by its earliest start time (EST) and the worst case execution time (WCET) of the task. The earliest start time EST is determined by the completion time of the predecessor task of the task and the available time of the processor. The formula is as follows:
[0070]
[0071] Among them, EST(A m .n i ,p k ) is the computing task A m .n i In the processor k The earliest start time on avail(p k ) represents processor p k Available time; pred(A m .n i ) is Task A m .n i The set of all predecessor tasks of A m .n' j It is Task A m .n i The precursor task of AFT (A m .n'j ) represents the predecessor task A m .n' j Actual completion time of Comm j,i It is a precursor task A m .n' j With Task A m .n i The communication delay between them.
[0072] In the processor selection phase, the system assigns a processor to each task to ensure that the task is completed as early as possible. The core of processor selection is to calculate the earliest completion time EFT of the task on different processors. The basis of the EFT algorithm is to first determine the earliest start time EST of the task, and then calculate the EFT of the task based on this time. The formula is as follows:
[0073] EFT(A m .n i ,p k )=EST(A m .n i ,p k )+WCET(A m .n i ,p k )(4)
[0074] Among them, EFT(A m .n i ,p k ) is task A m .n i In the processor k The earliest completion time on WCET (A m .n i ,p k ) indicates task A m .n i In the processor k Worst case execution time on .
[0075] After obtaining the EST of the task, the system continues to calculate the EFT value of each task on each processor. In order to maximize the execution efficiency of the task, the system assigns the task to the processor with the smallest EFT value. In other words, assign task A to the processor with the smallest EFT value. m .n i Assigned to the group with the minimum EFT(A m .n i ,p k ) processor p k If a task A m .n iIf the task is assigned to the same processor as its predecessor, the communication delay is ignored. Otherwise, the system takes into account the communication time between the two tasks and adjusts the EFT value of the task accordingly. In this way, the system can ensure that the task is completed as early as possible and minimize the time wasted due to communication delays.
[0076] The system ensures that the task is assigned to the best execution environment by selecting the processor with the smallest EFT value and inserting it into the scheduling list Task_ScheduleList of the corresponding processor. This can ensure that the scheduling efficiency of the task is maximized and the task can start execution as early as possible.
[0077] During the task allocation process, the system will not only consider the order in which the tasks are executed, but also determine the absolute deadline of the tasks. If a task misses the absolute deadline during normal scheduling, the system will cancel the task, but this cancellation does not completely remove the task from the system. Instead, it returns it to Am.task_PriorityList and waits for the next scheduling. This mechanism ensures that tasks can continue to be scheduled without affecting the real-time performance of the system, and will not be permanently ignored. The following is a detailed introduction to the system's timeout check and task degradation mechanism.
[0078] See also Figure 2 In each round of scheduling, the system performs a timeout check on each task to ensure that the task can be completed within the specified deadline (usually the absolute deadline). Specifically, the system compares the actual finish time (AFT) of each task with its absolute deadline (abs_deadline). When it is detected that a task fails to complete in normal mode and exceeds its absolute deadline, the system immediately cancels all unfinished tasks related to the task in the current scheduling round. These unfinished tasks are not permanently removed, but are put back into their priority list Am.task_PriorityList for rescheduling in future scheduling rounds. At the same time, the task's mode flag AS_Mode will be set to 1, indicating that the task enters degraded mode. In degraded mode, the system allows the task to continue to execute, but allocates a smaller execution time budget to it. This can avoid completely canceling the task without affecting the overall real-time requirements of the system, ensuring that it can at least complete some key functions in degraded mode. In addition, the system will readjust the scheduling strategy of the task to reduce its impact on other tasks.
[0079] If the task still cannot be completed within the deadline in degraded mode, the system will perform further priority adjustments on the task. At this time, the task's timeout flag AS_OverRun will be set to the priority of the task, and based on the timeout flag AS_OverRun, the system will determine whether the overall priority of the system needs to be increased. If necessary, the system will cancel all unfinished tasks assigned to the task in the current and previous scheduling rounds, and temporarily store these tasks in the canceled task set Cancel_task_set. These tasks will later be put back into the original task priority list Am.task_PriorityList and wait for the next scheduling round. At the same time, the system priority SYS.Priority will be adjusted according to the priority of the task to ensure that high-priority tasks are scheduled more promptly.
[0080] When the system cancels a task, it only cancels tasks that have not yet started. Tasks that have already started will not be interrupted or canceled. This mechanism ensures the scheduling stability and real-time performance of the system while avoiding resource waste due to timeouts. Through this timeout check and task downgrade mechanism, the system can effectively deal with the timeout problem of sudden tasks while ensuring that the system can still operate normally in the event of task failure or timeout.
[0081] After the task enters the degraded mode, the system priority adjustment and task recovery mechanism are also involved, such as Figure 2 shown.
[0082] During the system scheduling process, when a task still fails to be completed within the specified absolute deadline in the degraded mode, the system will start the priority adjustment mechanism to ensure that high-priority tasks can be executed in time. Specifically, the system will adjust the current system priority SYS.Priority according to the priority Am.Pri of the unfinished task. This adjustment ensures that high-priority tasks can get priority execution opportunities in the next scheduling process to avoid negative impact on the overall system performance.
[0083] When the system detects that a task has timed out and is in degraded mode, the system will set the task's timeout flag AS_OverRun(Am) to the task's priority Am.Pri. At this point, the system will re-evaluate the current task's priority and the system priority SYS.Priority, and determine whether the system priority needs to be increased. If it is found that the system's current priority is lower than the task's priority, the system will cancel all unfinished tasks in the current scheduling round and store these tasks in the canceled task set Cancel_task_set. Subsequently, these tasks in Cancel_task_set will be placed back in their original task priority list Am.task_PriorityList, waiting for the next scheduling round. At the same time, the system's priority SYS.Priority will be adjusted to the task's priority Am.Pri to ensure that high-priority tasks can be scheduled first in the next round.
[0084] During this process, the system's scheduling logic will also take into account the tasks that have already started, and these tasks will not be cancelled midway to ensure the stability and continuity of the system scheduling. At the same time, for low-priority tasks, the system will reschedule them to the waiting task list SYS_ReadyList, thereby ensuring that even in the case of tight resources, low-priority tasks will not be permanently ignored, but can continue to be scheduled at an appropriate time.
[0085] Through this priority adjustment and task recovery mechanism, the system can dynamically adapt to the execution status of tasks and ensure that timely adjustments can be made when high-priority tasks have timeouts or other problems, so as to avoid affecting the overall performance and reliability of the system. At the same time, this mechanism can also ensure that when resources are tight, the system can flexibly allocate resources and complete as many task scheduling goals as possible.
[0086] After the task is completed or the timeout check is completed, the system will automatically restore to the previous priority state to ensure that low-priority tasks can still get the opportunity to execute. The system will check the priority of the tasks that have not yet been completed, and re-prioritize them according to the scheduling slack time of these tasks to ensure that those tasks that are most likely to miss the deadline are scheduled first. The process of restoring system priorities can avoid the problem that high-priority tasks occupy system resources for too long, resulting in the complete inability to schedule low-priority tasks.
[0087] Specifically, the recovery process begins when the system completes the scheduling of a timed-out task. The system first confirms whether the task's timeout flag AS_OverRun(Am) has been cleared. If all high-priority tasks have been completed or the timeout flag has been cleared, the system will reset its current priority SYS.Priority to the next lower-priority but unfinished task to restore the system's scheduling capability for low-priority tasks. At this point, all unfinished low-priority tasks in the waiting task list SYS_ReadyList will be rearranged to ensure that these tasks can be executed at the new priority.
[0088] Through this priority recovery mechanism, the system avoids the situation where high-priority tasks occupy resources for a long time, ensuring the fairness of task scheduling and the optimization of overall system performance. This mechanism not only helps to maintain the real-time requirements of the system, but also provides execution opportunities for low-priority tasks to ensure that they are not abandoned prematurely or completely ignored.
[0089] The present invention proposes a method for dynamic adaptive scheduling of task resources, which is particularly suitable for multi-priority automotive electronic physical systems. By extracting scheduling rules from mixed integer linear programming (MILP), a dynamic adaptive scheduling algorithm is designed. The algorithm processes dynamically released tasks in real time, gives priority to the execution of high-priority tasks, and adopts a task downgrade strategy to optimize the overall system performance in the case of insufficient resources or task timeouts. The scheduling method of the present application can effectively reduce the system's task deadline miss rate (Deadline Miss Rate, DMR) and improve the overall efficiency of task scheduling.
[0090] In an exemplary embodiment, the present application also provides an automotive electronic physical system, which includes a server, a memory, an input / output interface and a communication interface. The server, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The server of the automotive electronic physical system is used to provide computing and control capabilities. The memory of the automotive electronic physical system includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the automotive electronic physical system is used to exchange information between the server and an external device. The communication interface of the automotive electronic physical system is used to communicate with an external terminal through a network connection. When the computer program is executed by the server, the dynamic adaptive scheduling method of task resources is implemented.
[0091] In multi-priority automotive electronic physical systems, the scheduling slack time and upstream order value of tasks will change dynamically with each round of scheduling. Figure 2 , the system must recalculate the upstream order value and scheduling slack time of each task in real time, and dynamically sort the tasks based on this to ensure the optimization of the overall system performance. Through this dynamic update mechanism, the system can prioritize the tasks that are most likely to miss the deadline, thereby reducing the probability of tasks missing the deadline.
[0092] In each round of scheduling, the system first reorders the tasks according to their ascending order values and scheduling slack times to update the task priority list Am.task_PriorityList. Tasks are prioritized based on the scheduling slack time and the ascending order values of the tasks. Among tasks with the same ascending order value priority, tasks with shorter scheduling slack times will be executed first. This dynamic sorting mechanism ensures that time-critical and important tasks can be executed as soon as possible after high-priority tasks.
[0093] In each round of scheduling, the system will also re-evaluate the priority of each task based on the earliest completion time of each task under the current system resource status. By dynamically updating the execution order of tasks, the system can better cope with dynamically released applications, especially in the case of limited resources, to ensure that high-priority and critical tasks can be processed in a timely manner. Specifically, the reordering of tasks is based on the schedule slack time (scheduleslack) of each task. m .n i ), the absolute deadline of the task sabs_deadline (A m .n i ) and the calculated lower bound lower_bound(A m .n i ). Scheduling tasks with shorter slack time means that they are closer to the deadline, and the system should give priority to these tasks to avoid timeouts. Therefore, tasks with smaller scheduling slack time will be sorted higher in the task list and scheduled first. The absolute deadline of a task is the final completion time of the task, which is usually determined by system or physical safety requirements. If the scheduling slack times of two tasks are similar or the same, the system will further compare their absolute deadlines, and the task with an earlier absolute deadline will be scheduled first. The execution lower bound is the shortest execution time of a task under ideal conditions. Tasks with larger lower bounds may need to be scheduled in advance to ensure that they are completed within the deadline. The task reordering process updates the task priority list Am.task_PriorityList, and the system will rearrange the scheduling order for tasks based on this list to ensure that urgent tasks are executed first.
[0094] In addition, during the dynamic scheduling process, when new tasks are released, the system will adopt different processing strategies according to the priority and real-time requirements of the tasks. When a new task is added to the system, the system will decide whether it needs to be processed first based on the importance and time requirements of the task. Simply put, if the new task is more urgent than the currently waiting task, the system will dynamically adjust its position and insert it into the priority task list. For example, if the priority of the new task is very high, or it must be completed quickly (because the deadline is very close), the system will ensure that it is executed earlier in the next scheduling. This is based on the real-time calculation of the task's upward order value and the scheduling slack time. The system will sort all tasks according to the upward order value of each task and insert them into the task's priority list Am.task_PriorityList. This method not only reduces the workload of rescheduling, but also ensures the real-time and high efficiency of the overall system strategy.
[0095] In an exemplary embodiment, the present application also provides a car equipped with the above automotive electronic physical system.
[0096] It can be understood by a person of ordinary skill in the art that all or part of the processes in the above-mentioned embodiment method can be completed by hardware related to computer program instructions, and the computer program can be stored in a non-volatile computer-readable storage medium, and the computer program can include the process of the embodiment of the above-mentioned method when executed. Among them, any reference to memory or other media in each embodiment provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0097] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0098] In the traditional fixed priority scheduling scheme, the priority of the task is fixed when the system is initialized, and it will not be dynamically adjusted with the change of scheduling slack time or task status. Although this method can simplify the complexity of the scheduling algorithm, it cannot flexibly respond to changes in task execution, which may cause low-priority tasks to not be executed for a long time, and the real-time performance is poor. Another traditional solution is to use the earliest deadline priority scheduling algorithm (EDF). In EDF, the system dynamically adjusts the scheduling order according to the deadline of the task, and the task closest to the deadline will be executed first. Although EDF can effectively reduce the task miss rate, it ignores the priority and scheduling slack time of the task, and cannot balance the scheduling requirements of priority tasks and low-priority tasks like the method of this application. The traditional round-robin scheduling scheme allocates time slices to each task by polling, without considering the priority and real-time requirements of the task. Although this method can ensure that all tasks have the opportunity to be executed, for time-sensitive high-priority tasks, this scheduling strategy cannot ensure that they complete the task on time, and the real-time performance is poor.
[0099] Although there are traditional solutions such as the above fixed priority scheduling, EDF and round-robin scheduling methods, these solutions can achieve the purpose of scheduling tasks in some scenarios, but when faced with complex requirements such as task real-time and dynamic adjustment of priority, these traditional solutions are difficult to meet the requirements of real-time and scheduling efficiency at the same time. Therefore, the dynamic sorting solution based on the task uplink order value and scheduling slack time in this application is more advantageous, mainly reflected in the following aspects.
[0100] 1) Improve task real-time performance: This application prioritizes high-priority tasks, especially in the task sorting stage, dynamically sorting tasks based on their upstream order values and scheduling slack time, ensuring that high-priority and time-critical tasks are executed first. This allows the system to ensure that critical tasks are completed within the specified deadline even when tasks are intensive and resources are limited.
[0101] 2) Reduce task miss rate: By designing a task downgrade mechanism, the system can handle tasks that cannot be completed on time under normal mode and allocate a smaller execution time budget to them. This mechanism ensures that tasks will not be completely cancelled without affecting the overall real-time performance of the system, thereby reducing the task miss rate.
[0102] 3) Dynamic scheduling optimization: The system can update the priority and scheduling slack time of tasks in real time according to the results of each round of scheduling, and dynamically sort the tasks. This adaptive scheduling strategy enables the system to respond to various changes in task execution in a timely manner, optimize resource allocation, and ensure that those tasks that are most likely to miss their deadlines are scheduled first.
[0103] 4) Flexible processing of new tasks: The system can process dynamically released tasks in a timely manner and adjust the scheduling order according to the priority and real-time requirements of the new tasks. This flexibility allows the system to process randomly released new tasks without adding a large amount of rescheduling burden, avoiding resource waste and improving the overall utilization of the system.
[0104] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0105] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A method for dynamic adaptive scheduling of task resources, characterized in that: include: In each round of scheduling, the upstream order value and scheduling slack time of each task are calculated in real time; Dynamically sort tasks based on their upstream order values and scheduling slack time, and output a priority list of tasks; Select a preset number of tasks from the priority list of tasks and add them to the list of tasks to be executed; Processors are allocated to tasks in the to-be-executed task list, and the allocated processors execute the corresponding tasks.
2. The task resource dynamic adaptive scheduling method according to claim 1, characterized in that: The real-time calculation of the uplink sequence value of each task specifically includes: Using formula Calculate each task A m .n i The ascending order value rank(A m .n i ); where A m .n i Representative application set A m The i-th task in ; Represents Task A m .n i The average worst-case execution time on all processors capable of handling the task; succ(A m .n i ) is Task A m .n i The set of all subsequent tasks of A m .n j It is Task A m .n i The successor task of rank(A m .n j ) indicates task A m .n j The ascending order value of A m .Comm i,j It is Task A m .n i and the successor task A m .n j The communication delay between them; max means taking the maximum value.
3. The task resource dynamic adaptive scheduling method according to claim 2 is characterized in that: The real-time calculation of the scheduling slack time of each task specifically includes: Using the formula scheduleslack(A m .n i )=abs_deadline(A m .n i )-lower_bound(A m .n i ) Calculate each task A m .n i Schedule slack (A m .n i ); where sabs_deadline(A m .n i ) indicates task A m .n i The absolute deadline; lower_bound(A m .n i ) indicates task A m .n i The execution lower bound of .
4. The task resource dynamic adaptive scheduling method according to claim 3 is characterized in that: The task priority list is output based on the dynamic sorting of the task's upstream order value and scheduling slack time, specifically including: The task with a larger upward order value and a shorter scheduling slack time has a higher priority and is ranked higher in the priority list; If two tasks have the same upstream order value and scheduling slack time, the task with the earlier absolute deadline will be sorted first.
5. The task resource dynamic adaptive scheduling method according to claim 4 is characterized in that: The task allocation processor in the to-be-executed task list specifically includes: Using formula Computational Task A m .n i In the processor p k The earliest start time on EST (A m .n i ,p k );where avail(p k ) represents processor p k Available time; pred(A m .n i ) is Task A m .n i The set of all predecessor tasks of A m .n' j It is Task A m .n i The precursor task of AFT (A m .n' j ) represents the predecessor task A m .n' j Actual completion time of Comm j,i It is a precursor task A m .n' j With Task A m .n i Communication delay between Using the formula EFT(A m .n i ,p k )=EST(A m .n i ,p k )+WCET(A m .n i ,p k ) Computational Task A m .n i In the processor p k The earliest completion time EFT (A m .n i ,p k ); WCET(A m .n i ,p k ) indicates task A m .n i In the processor p k Worst case execution time on ; Task A m .n i Assigned to the group with the minimum EFT(A m .n i ,p k ) processor p k superior.
6. The task resource dynamic adaptive scheduling method according to claim 2, characterized in that: In each round of scheduling, before calculating the uplink order value and scheduling slack time of each task in real time, the method further includes: Initial systematization priority SYS.Priority, application set A m And the list of tasks to be executed SYS_ReadyList; Initialize the timeout flag AS_OverRun and mode flag AS_Mode of each application.
7. The method for dynamic adaptive scheduling of task resources according to claim 6, characterized in that: Also includes: During each round of scheduling, a timeout check is performed on each task: When a task timeout is detected, all unfinished tasks related to the task in the current scheduling round are immediately canceled and put back into their priority list. At the same time, the mode flag of the task is set to AS_Mode 1, and the task enters the degraded mode.
8. The task resource dynamic adaptive scheduling method according to claim 7, characterized in that: After the task enters the degraded mode, it also includes: If a task still cannot be completed within the specified absolute deadline in the degraded mode, the priority adjustment mechanism is started to adjust the current system priority SYS.Priority according to the priority Am.Pri of the unfinished task.
9. An automotive electronic physical system, comprising: A memory, a server, and a computer program stored in the memory and executable on the server, wherein the server executes the computer program to implement the method for dynamic adaptive scheduling of task resources according to any one of claims 1 to 8.
10. An automobile, characterized in that: The automotive electronic physical system as claimed in claim 9 is installed.
Citation Information
Cited By
Real-time task scheduling method and device, computer equipment and readable storage medium
CN119961001A
Method and device for automatically determining real-time task execution time
CN121636123A