Task scheduling processing method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202211461683.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-17
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2042-11-17
AI Technical Summary
[0003]为了解决上述任务执行效率较低、实时性较差等技术问题,提出了本公开
[0008] Based on the task scheduling processing method, apparatus, electronic device, and storage medium provided in the above embodiments of this disclosure, by pre-determining the scheduling period based on the task information to be scheduled, determining the number of threads based on the target resource information, and then determining the time slice of each thread based on the scheduling period, the task to be scheduled is scheduled into the time slice of each thread, generating a task scheduling table. During task scheduling, each task can be scheduled directly based on the task scheduling table, realizing the static scheduling of periodic tasks. The thread and time point for task execution are pre-determined, ensuring that the task is executed at the expected time without being affected by other tasks, thereby effectively improving task scheduling efficiency and real-time performance.
Smart Images

Figure CN115756793B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to computer technology, and in particular to a task scheduling processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] In the field of autonomous driving, applications for autonomous driving are becoming increasingly complex, and there are many periodic tasks in these applications. In order to ensure the safety and reliability of autonomous driving, the requirements for the real-time performance and stability of task execution are becoming increasingly stringent. In related technologies, periodic tasks are usually executed based on dynamic scheduling strategies. However, dynamic scheduling can easily lead to low task execution efficiency and poor real-time performance. Summary of the Invention
[0003] To address the aforementioned technical problems such as low task execution efficiency and poor real-time performance, this disclosure is proposed. Embodiments of this disclosure provide a task scheduling processing method, apparatus, electronic device, and storage medium.
[0004] According to one aspect of the present disclosure, a task scheduling processing method is provided, comprising: acquiring task information to be scheduled and target resource information, wherein the task information to be scheduled includes periodic task description information corresponding to at least one task to be scheduled, and the target resource information includes available processing resource information; determining a first number of threads based on the target resource information; determining a scheduling period based on the task information to be scheduled; determining time slices corresponding to the first number of threads based on the scheduling period; generating a task scheduling table based on the task information to be scheduled and the time slices corresponding to each thread, wherein the task scheduling table includes the thread corresponding to each task to be scheduled and the execution time information corresponding to the time slice of the thread; and scheduling each task to be scheduled based on the task scheduling table.
[0005] According to another aspect of the present disclosure, a task scheduling processing apparatus is provided, comprising: a first acquisition module, configured to acquire task information to be scheduled and target resource information, wherein the task information to be scheduled includes periodic task description information corresponding to at least one task to be scheduled, and the target resource information includes available processing resource information; a first processing module, configured to determine a first number of threads based on the target resource information; a second processing module, configured to determine a scheduling period based on the task information to be scheduled; a third processing module, configured to determine time slices corresponding to the first number of threads based on the scheduling period; a fourth processing module, configured to generate a task scheduling table based on the task information to be scheduled and the time slices corresponding to each thread, wherein the task scheduling table includes threads corresponding to each task to be scheduled and execution time information corresponding to the time slices of the threads; and a scheduling module, configured to schedule each task to be scheduled based on the task scheduling table.
[0006] According to another aspect of the present disclosure, a computer-readable storage medium is provided, the storage medium storing a computer program for executing the task scheduling processing method described in any of the above embodiments of the present disclosure.
[0007] According to another aspect of the present disclosure, an electronic device is provided, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the task scheduling processing method described in any of the above embodiments of the present disclosure.
[0008] Based on the task scheduling processing method, apparatus, electronic device, and storage medium provided in the above embodiments of this disclosure, by pre-determining the scheduling period based on the task information to be scheduled, determining the number of threads based on the target resource information, and then determining the time slice of each thread based on the scheduling period, the task to be scheduled is scheduled into the time slice of each thread, generating a task scheduling table. During task scheduling, each task can be scheduled directly based on the task scheduling table, realizing the static scheduling of periodic tasks. The thread and time point for task execution are pre-determined, ensuring that the task is executed at the expected time without being affected by other tasks, thereby effectively improving task scheduling efficiency and real-time performance.
[0009] The technical solutions of this disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0010] The above and other objects, features, and advantages of this disclosure will become more apparent from the more detailed description of the embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0011] Figure 1 This is an exemplary application scenario of the task scheduling processing method provided in this disclosure;
[0012] Figure 2 This is a flowchart illustrating a task scheduling processing method provided in an exemplary embodiment of this disclosure;
[0013] Figure 3 This is a flowchart illustrating a task scheduling processing method provided in another exemplary embodiment of this disclosure;
[0014] Figure 4 This is a flowchart illustrating step 2051 provided in an exemplary embodiment of this disclosure;
[0015] Figure 5 This is a flowchart illustrating step 20511 provided in an exemplary embodiment of this disclosure;
[0016] Figure 6 This is a flowchart illustrating step 2051 provided in another exemplary embodiment of this disclosure;
[0017] Figure 7 This is a schematic diagram of a periodic task arrangement provided in an exemplary embodiment of this disclosure;
[0018] Figure 8 This is a schematic diagram of the worst-case backtracking process provided in an exemplary embodiment of this disclosure;
[0019] Figure 9 This is a schematic diagram of the structure of a task scheduling processing apparatus provided in an exemplary embodiment of the present disclosure;
[0020] Figure 10 This is a schematic diagram of the structure of a task scheduling processing apparatus provided in another exemplary embodiment of this disclosure;
[0021] Figure 11 This is a schematic diagram of the structure of an application embodiment of the electronic device disclosed herein. Detailed Implementation
[0022] Hereinafter, exemplary embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of the present disclosure, and not all embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the exemplary embodiments described herein.
[0023] It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of this disclosure.
[0024] Those skilled in the art will understand that the terms "first," "second," etc., in the embodiments of this disclosure are only used to distinguish different steps, devices, or modules, and do not represent any specific technical meaning, nor do they indicate a necessary logical order between them.
[0025] It should also be understood that in the embodiments disclosed herein, "a plurality of" may refer to two or more, and "at least one" may refer to one, two or more.
[0026] It should also be understood that any component, data or structure mentioned in the embodiments of this disclosure can generally be understood as one or more unless expressly defined or given to the contrary in the context.
[0027] Furthermore, the term "and / or" in this disclosure is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this disclosure generally indicates that the preceding and following related objects have an "or" relationship.
[0028] It should also be understood that the description of the various embodiments in this disclosure emphasizes the differences between the various embodiments, and the similarities or similarities can be referred to each other. For the sake of brevity, they will not be described in detail.
[0029] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.
[0030] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this disclosure or its application or use.
[0031] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.
[0032] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.
[0033] The embodiments disclosed herein can be applied to electronic devices such as terminal devices, computer systems, and servers, and can operate together with a wide range of other general-purpose or special-purpose computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments, and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, and servers include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputer systems, mainframe computer systems, and distributed cloud computing environments including any of the above systems, etc.
[0034] Electronic devices such as terminal devices, computer systems, and servers can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in distributed cloud computing environments, where tasks are executed by remote processing devices linked through communication networks. In distributed cloud computing environments, program modules can reside on local or remote computing system storage media, including storage devices.
[0035] This disclosure outlines
[0036] In the process of realizing this disclosure, the inventors discovered that in the field of autonomous driving, applications used for autonomous driving are becoming increasingly complex, and there are many periodic tasks within these applications. In order to ensure the safety and reliability of autonomous driving, the requirements for the real-time performance and stability of task execution are becoming increasingly stringent. In related technologies, periodic tasks are usually executed based on dynamic scheduling strategies. For example, a scheduler maintains a task queue in real time, and only when a task needs to be executed is the order of that task in the task queue determined. However, this dynamic scheduling, because tasks need to wait in the task queue for execution, can easily lead to low task execution efficiency and poor real-time performance.
[0037] Exemplary Overview
[0038] Figure 1 This is an exemplary application scenario of the task scheduling processing method provided in this disclosure.
[0039] In autonomous driving scenarios, for various applications with periodic tasks that meet preset conditions (no direct coupling between periodic tasks, and flexible setting of execution order and period), such as periodically acquiring raw data from vehicle sensors and determining the vehicle's speed, acceleration, and other states based on the raw data, or periodically detecting the health status of various sensors or other devices, the task scheduling processing method disclosed herein can predetermine the task scheduling table before the scheduler performs task scheduling. This allows scheduling to be performed directly according to the task scheduling table, ensuring that each periodic task can be scheduled accurately and in real time according to its preset period. This effectively solves the problems of low execution efficiency and poor real-time performance that are easily caused by existing dynamic scheduling. Specifically, it can obtain information on tasks to be orchestrated and target resources. The task information includes descriptions of at least one cyclical task, such as the worst-case execution time (WCET, the longest time a software can execute under possible operating conditions) and trigger cycle. The target resource information includes available processing resources for the tasks to be orchestrated, such as processors (CPU (Central Processing Unit), BPU (Brain Processing Unit), GPU (Graphics Processing Unit)). Based on the target resource information, the number of units (such as image processors) and processor identifiers can be determined. The initial number of threads can be identified. The orchestration period can be determined based on the task information to be orchestrated. The orchestration period represents the processor time slice allocated to each thread. Based on the orchestration period, the time slice corresponding to each thread is determined. Then, based on the task information to be orchestrated and the time slice corresponding to each thread, a task scheduling table is generated. This task scheduling table includes the thread corresponding to each task to be orchestrated and the execution time information corresponding to that thread's time slice. The execution time information can include the offset of at least one trigger execution time point relative to the start time point of the time slice. For example, if a task to be orchestrated can be executed 4 times in a orchestration period, the execution time information can include 4 offsets relative to the start time point, or it can only include the offset of the first trigger execution time point. During scheduling, the tasks are triggered sequentially at the corresponding time points according to the task period. The specific settings can be configured according to actual needs. After determining the task scheduling table, each task to be orchestrated can be scheduled based on the task scheduling table during task scheduling. Compared to dynamic scheduling, this effectively improves the real-time performance of task scheduling and eliminates the need for real-time maintenance of the task queue, thus improving task execution efficiency.
[0040] The task scheduling processing method disclosed herein is not limited to applications in autonomous driving scenarios or fields. It can be applied to any scenario or field with periodic tasks according to actual needs, and no specific scenario or field is limited.
[0041] Exemplary methods
[0042] Figure 2 This is a flowchart illustrating a task scheduling processing method provided in an exemplary embodiment of this disclosure. This embodiment can be applied to electronic devices, such as servers or terminals, specifically, such as in-vehicle computing platforms. Figure 2 As shown, it includes the following steps:
[0043] Step 201: Obtain the task information to be orchestrated and the target resource information. The task information to be orchestrated includes the periodic task description information corresponding to at least one task to be orchestrated, and the target resource information includes the available processing resource information.
[0044] The description information for periodic tasks includes the trigger cycle, worst-case execution time, and other relevant information for the tasks to be orchestrated, which can be set according to actual needs. Tasks to be orchestrated are periodic tasks that meet preset conditions, namely, no direct coupling between periodic tasks, and that the execution order and trigger cycle of the periodic tasks can be flexibly set according to actual needs. Processing resource information may include, for example, the number of processors and processor identifiers.
[0045] Step 202: Determine the first number of threads based on the target resource information.
[0046] The first quantity is determined by the number of processing resource information included in the target resource information. For example, each processor corresponds to one thread, and if there are N processors, then there can be N threads.
[0047] Step 203: Determine the orchestration cycle based on the information of the tasks to be orchestrated.
[0048] The scheduling cycle can be determined based on preset rules, which can be set according to actual needs.
[0049] For example, since the tasks to be orchestrated are all periodic tasks with corresponding task cycles (or trigger cycles), in order to make effective use of resources, the orchestration cycle can be determined based on the least common multiple of the task cycles of each task to be orchestrated. For example, the orchestration cycle can be the same as the least common multiple, or it can be an integer multiple of the least common multiple. The specific settings can be made according to actual needs.
[0050] Steps 202 and 203 are not in any particular order.
[0051] Step 204: Based on the orchestration cycle, determine the time slices corresponding to the first number of threads.
[0052] The time slice for a thread represents the processor time slice allocated to that thread when it is created, used to execute various scheduled tasks. Determining the time slice for each thread based on the scheduling period can either mean that the time slice for each thread is the same as the scheduling period, or that it is a preset multiple of the scheduling period. The specific setting can be configured according to actual needs. For example, the scheduling period determined above could be the least common multiple of the task cycles of all tasks to be scheduled, and the thread's time slice could be twice the scheduling period.
[0053] Step 205: Based on the task information to be orchestrated and the time slices corresponding to each thread, generate a task scheduling table. The task scheduling table includes the thread corresponding to each task to be orchestrated and the execution time information corresponding to the time slice of that thread.
[0054] Specifically, based on preset orchestration rules, the execution time of each task to be orchestrated can be mapped to the time slice of each thread to generate a task scheduling table. The preset orchestration rules can be set according to actual needs, such as using a preset orchestration algorithm or a backtracking algorithm; there are no specific limitations.
[0055] Step 206: Based on the task scheduling table, schedule each task to be orchestrated.
[0056] The task scheduling table is a static task scheduling table that is determined before task scheduling. It does not need to be dynamically maintained during task scheduling. It is only necessary to schedule the corresponding tasks according to the execution time information of each task to be scheduled in the task scheduling table.
[0057] The task scheduling method provided in this embodiment determines the scheduling period in advance based on the information of the tasks to be scheduled, determines the number of threads based on the target resource information, and then determines the time slice of each thread based on the scheduling period. The tasks to be scheduled are then scheduled into the time slices of each thread to generate a task scheduling table. During task scheduling, each task can be scheduled directly based on the task scheduling table. This achieves static scheduling of periodic tasks, predetermines the threads and time points for task execution, and ensures that tasks are executed at the expected time without being affected by other tasks. As a result, it can effectively improve the efficiency and real-time performance of task scheduling.
[0058] Figure 3 This is a flowchart illustrating a task scheduling processing method provided in another exemplary embodiment of this disclosure.
[0059] In an optional example, step 205 may specifically include the following steps:
[0060] Step 2051: Based on the information of the tasks to be orchestrated and the time slices corresponding to each thread, a backtracking algorithm is used to determine the thread corresponding to each task to be orchestrated and the execution time information corresponding to the time slice of that thread, and a task scheduling table is generated.
[0061] The backtracking algorithm is a selective search method that searches forward according to selection criteria to reach the target. When the search reaches a certain step and finds that the original selection is not optimal or cannot reach the target, it backtracks one step and selects again. In this disclosure, based on the backtracking algorithm, according to certain selection criteria, it searches for tasks suitable for scheduling in the thread's time slice, and schedules these tasks. When a task is scheduled, if it is found that the remaining tasks cannot be scheduled, it backtracks one step to the state before the task was scheduled, and selects other tasks for scheduling. Otherwise, it continues to schedule the remaining tasks according to the selection criteria until all tasks are scheduled and a task scheduling table is obtained.
[0062] This disclosure uses a backtracking algorithm for task orchestration, which enables all tasks to be orchestrated to be arranged in the most optimal way possible, thereby further improving the efficiency of task scheduling.
[0063] Figure 4 This is a flowchart illustrating step 2051 provided in an exemplary embodiment of this disclosure.
[0064] In an optional example, the periodic task description information includes the task period and execution time threshold of the task to be orchestrated; step 2051, based on the task information to be orchestrated and the time slices corresponding to each thread, uses a backtracking algorithm to determine the thread corresponding to each task to be orchestrated and the execution time information corresponding to the time slice of that thread, and generates a task scheduling table, including:
[0065] Step 20511: Based on the task cycle and execution time threshold corresponding to each task to be orchestrated, and the first rule, determine the priority sequence of each task to be orchestrated.
[0066] The task cycle of the tasks to be orchestrated can be set according to actual needs, and the execution time threshold can be determined based on the single execution time of the tasks to be orchestrated. For example, the execution time threshold can be the worst-case execution time of the tasks to be orchestrated. The first rule can be set according to actual needs. For example, it can be based on the priority requirements of each task to be orchestrated to determine the priority sequence; or, to reduce the return rate of the search process, a priority sequence can be determined according to the rule of prioritizing tasks with shorter cycles, and for tasks with the same cycle, prioritizing those with larger execution time thresholds. Specific details are not limited.
[0067] For example, each task to be orchestrated is numbered according to its priority, with smaller numbers indicating higher priority. The priority sequence of each task to be orchestrated is determined by the numbers from smallest to largest. During orchestration, tasks with higher priority (smaller numbers) are orchestrated first.
[0068] Step 20512: For any idle time point in the time slice corresponding to any thread, based on the priority sequence, determine the first task to be scheduled with the idle time point as the starting time point. The first task to be scheduled is one of the currently unscheduled tasks to be scheduled in the priority sequence, and the idle time point is the time point that is not currently occupied by the scheduled task to be scheduled.
[0069] In this context, any idle time point within a thread's time slice can be a target idle time point determined according to certain rules. For example, it can iterate through the idle time points in each thread's time slice in chronological order, taking the currently encountered idle time point as the target idle time point. Based on a priority sequence, a first scheduled task is determined with this target idle time point as its starting time point. When this target idle time point is used as the starting time point for the first scheduled task, this target idle time point and subsequent time points (determined according to the execution time threshold of the first scheduled task) are occupied by the first scheduled task and are no longer idle time points.
[0070] Step 20513: Based on the start time of the first task to be scheduled, the task cycle and execution time threshold corresponding to the first task to be scheduled, determine the execution time information of the first task to be scheduled in the time slice of the thread.
[0071] Once the start time of the first task to be orchestrated is determined, the execution time information corresponding to the periodic execution of the first task to be orchestrated in that time slice needs to be determined. This execution time information may include the start time of each triggered execution and the duration required, or it may include the start time of the first triggered execution, the task cycle, and the execution time threshold. The specific settings can be configured according to actual needs, as long as the periodic execution trigger time of the task to be orchestrated can be determined during scheduling.
[0072] Step 20514: In response to the inability to orchestrate the remaining un-orchestrated tasks, the second un-orchestrated task, which was last orchestrated, is reverted to the un-orchestrated tasks.
[0073] The remaining un-arranged tasks refer to all tasks to be arranged, excluding those already arranged. For tasks that cannot be arranged, certain rules can be set to determine if there are still un-arranged tasks after the idle time point traversal ends. Specific rules can be set according to actual needs. The second un-arranged task in the last arrangement refers to the last un-arranged task arranged before the current one. Returning the second un-arranged task to the list of un-arranged tasks means releasing the time slice occupied by the second un-arranged task, making it an idle time point again, and then treating the second un-arranged task as an un-arranged task, thus returning the arrangement process to the state before the second un-arranged task was arranged.
[0074] In practical applications, the orchestrated and unorchestrated task sets can be maintained in real time. The orchestration status of each task to be orchestrated is maintained in real time by transferring tasks between the orchestrated and unorchestrated sets. Alternatively, the orchestration status information (such as orchestration status flags) of each task to be orchestrated can be maintained in real time. The specific method can be set according to actual needs, and this disclosure does not limit it. It can also record in real time the threads occupied by each orchestrated task and the time occupied in the time slice of that thread. This facilitates the determination of idle time points or, during subsequent orchestration, the determination of whether there are time conflicts, thus determining whether subsequent tasks can be orchestrated.
[0075] Step 20515: Based on the priority sequence, determine the third task to be orchestrated from the remaining un-orchestrated tasks that has a lower priority than the second task to be orchestrated.
[0076] When the second task to be scheduled is returned to the list of unscheduled tasks, another task needs to be selected for scheduling. The selection rule is to choose a third task from the remaining unscheduled tasks that has a lower priority than the second task. For example, if the second task is numbered 3, and the unscheduled tasks include tasks numbered 4 and 5, then the task with the smallest number among those with a higher number than 3 (indicating a lower priority than 3), i.e., task number 4, is selected as the third task to be scheduled.
[0077] Step 20516: Based on the idle time point after the second task to be scheduled is returned, the third task to be scheduled is scheduled to be arranged, and the thread corresponding to the third task to be scheduled and the execution time information corresponding to the time slice of the thread are determined.
[0078] Specifically, the idle time point that was originally used as the start time point of the second task to be scheduled can be taken from the idle time point after the second task to be scheduled is returned, and the target idle time point can be used as the start time point of the third task to be scheduled. If the third task to be scheduled can be scheduled, the thread corresponding to the third task to be scheduled can be determined to be the thread where the target idle time point is located. The execution time information of the third task to be scheduled in the time slice of the thread includes the target idle time point (which is the start time point of the third task to be scheduled) and other time points or time periods occupied by the third task to be scheduled.
[0079] If the third task to be orchestrated cannot be orchestrated, then continue to select a task with a lower priority than the third task from the remaining un-orchestrated tasks for orchestration. If the task to be orchestrated can be orchestrated, then return to the normal orchestration process, that is, start executing from step 20512 above again.
[0080] Step 20517: For any idle time point in the time slice corresponding to any thread, execute the above step 20512, and determine the first task to be scheduled based on the priority sequence, with the idle time point as the starting time point, until the scheduling of each task to be scheduled is completed, and obtain the task scheduling table.
[0081] In step 20512, the idle time point determined is the target idle time point among the idle time points after the third task to be scheduled is scheduled. The specific determination of the target idle time point is as described above and will not be repeated here.
[0082] This disclosure first determines the priority sequence of each task to be orchestrated, and then uses a backtracking algorithm to orchestrate each task according to the priority sequence, so that the tasks with higher priority are scheduled to be triggered earlier in the time slice.
[0083] Figure 5 This is a flowchart illustrating step 20511 provided in an exemplary embodiment of this disclosure.
[0084] In an optional example, step 20511, based on the task cycle and execution time threshold corresponding to each task to be orchestrated, and the first rule, determines the priority sequence of each task to be orchestrated, including:
[0085] a. Based on the task cycle corresponding to each task to be scheduled, determine the priority of each task to be scheduled in ascending order, with the priority of the task to be scheduled having a shorter task cycle.
[0086] For example, if the task period of task A to be orchestrated is 20 milliseconds, the task period of task B to be orchestrated is 50 milliseconds, and the task period of task C to be orchestrated is 10 milliseconds, then the priority sequence from high to low is: C>A>B.
[0087] b. For at least two tasks to be scheduled with the same task cycle, the priority of the at least two tasks to be scheduled is determined based on the execution time threshold of the at least two tasks to be scheduled, in descending order. The priority of the task to be scheduled with the larger execution time threshold is higher than that of the task to be scheduled with the smaller execution time threshold.
[0088] For example, if the task to be orchestrated, D, has a task period of 20 milliseconds, the same as the aforementioned task to be orchestrated, then the execution time thresholds of A and D are compared. For example, if the execution time threshold of A is 20 milliseconds and the execution time threshold of D is 10 milliseconds, then A has a higher priority than D. The final priority sequence is: C>A>D>B.
[0089] c. Determine the priority sequence based on the priority of each task to be orchestrated.
[0090] This disclosure determines the priority sequence of tasks to be orchestrated by following the rule that tasks with shorter execution cycles have higher priority, and tasks with the same execution cycle and higher execution time thresholds have higher priority. This ensures that during the orchestration process using the backtracking algorithm, tasks that are executed more frequently and occupy more time points are prioritized for orchestration. As the orchestration process progresses, the remaining idle time is divided into more time periods by the orchestrated tasks. Tasks that are executed less frequently and occupy less time points are more likely to be orchestrated successfully, thereby effectively reducing the probability of backtracking and improving orchestration efficiency.
[0091] Figure 6 This is a flowchart illustrating step 2051 provided in another exemplary embodiment of this disclosure.
[0092] In an optional example, after step 20514, in response to the inability to orchestrate the remaining un-orchestrated tasks, the second un-orchestrated task that was last orchestrated is reverted to the un-orchestrated tasks, the method further includes:
[0093] Step 301: In response to the fact that there is no third task with a lower priority than the second task among the remaining un-arranged tasks to be arranged, or that none of the remaining un-arranged tasks with a lower priority than the second task to be arranged can be arranged, the fourth task to be arranged before the second task to be arranged will be returned to the un-arranged tasks to be arranged.
[0094] If there is no third task with a lower priority than the second task among the remaining unarranged tasks, or if none of the remaining unarranged tasks with a lower priority than the second task can be arranged, it means that all unarranged tasks have been traversed and there are still unarranged tasks. Therefore, it is necessary to backtrack again, return the fourth task that was arranged before the second task to the unarranged tasks, and select another arrangement path.
[0095] Step 302: Based on the priority sequence, determine the fifth task to be orchestrated from the remaining un-orchestrated tasks, which has a lower priority than the fourth task to be orchestrated.
[0096] The specific operating principle of this step is described in step 20515 above, and will not be repeated here.
[0097] Step 303: Based on the idle time point after the fourth task to be scheduled is returned, the fifth task to be scheduled is scheduled to be scheduled, and the thread corresponding to the fifth task to be scheduled and the execution time information corresponding to the time slice of the thread are determined.
[0098] The specific operating principle of this step is described in step 20516 above, and will not be repeated here.
[0099] Step 304: Execute step 20512, which determines the first task to be scheduled based on the priority sequence for any idle time point in the time slice corresponding to any thread, until the scheduling of each task to be scheduled is completed and the task scheduling table is obtained.
[0100] The specific operating principle of this step is described in step 20517 above, and will not be repeated here.
[0101] This disclosure utilizes a backtracking algorithm to perform multi-level backtracking during task orchestration until normal orchestration can be achieved, thereby completing the orchestration of all tasks to be orchestrated.
[0102] In an optional example, for time slices of multiple threads, the idle time points of each thread can be traversed sequentially to determine whether the idle time point can be used as the start time point of a task to be scheduled. For each thread, the idle time points are traversed from beginning to end according to the time slice of that thread, and the above process is followed to determine whether the idle time point can be used as the start time point of a task to be scheduled.
[0103] In one optional example, for each time slice, a preset time unit can be used as the minimum time unit, such as 1 microsecond. The specific time unit can be set according to actual needs, and each minimum time unit corresponds to a time point.
[0104] In an optional example, step 203, determining the orchestration period based on the task information to be orchestrated, includes:
[0105] Step 2031: Use the preset multiple of the least common multiple of the task cycles corresponding to each task to be scheduled as the scheduling cycle.
[0106] The least common multiple refers to the smallest of the common multiples among all task cycles. The preset multiple can be set according to actual needs, such as 2 times or 3 times, as long as it is an integer multiple.
[0107] This disclosure sets the orchestration period to a preset multiple of the least common multiple of the task periods of each task to be orchestrated, thereby ensuring that at least one execution of any task to be orchestrated can be triggered within the orchestration period, avoiding the situation where a task to be orchestrated cannot be orchestrated within the orchestration period, and ensuring that each thread can execute each task to be orchestrated.
[0108] In an optional example, step 204, based on the orchestration period, determines the time slices corresponding to the first number of threads, including:
[0109] Step 2041: For each thread, determine that the time slice corresponding to that thread is the same as the orchestration cycle duration.
[0110] Specifically, setting the thread's time slice to be the same as the orchestration cycle length ensures that the thread can execute any scheduled task at least once within the time slice, thus preventing situations where the thread's time slice is insufficient to execute a scheduled task.
[0111] In an optional example, the target resource information includes information on a first number of available processing resources; step 202, based on the target resource information, determines the first number of threads, including:
[0112] Step 2021: Based on the information of the first number of processing resources, determine the first number of threads, wherein each processing resource corresponds one-to-one with each thread.
[0113] The processing resource information includes the type and identifier of the processing resource. Each processing resource can create a thread at a certain time, and allocate a processing time slice to that thread to execute the tasks in the task scheduling table. Once the threads corresponding to each task to be scheduled are determined, different threads are created by their corresponding processing resources, and can complete the tasks scheduled in their time slices in parallel.
[0114] This disclosure determines the number of threads based on the amount of available processing resources, enabling multiple threads to execute periodic tasks in parallel without affecting each other, thereby further improving task scheduling efficiency.
[0115] In one optional example, Figure 7 is a schematic diagram of periodic task orchestration provided by an exemplary embodiment of the present disclosure. In this example, there are three tasks to be orchestrated, namely task 1 (with a task period of period T1), task 2 (with a task period of period T2), and task 3 (with a task period of period T3), where T2<T1<T3, and the order of worst-case execution time (WCET) is: task 1>task 2=task 3. This example takes the time slice of one thread as an example: task 2 is orchestrated first, then task 1, and finally task 3.
[0116] In an optional example, Figure 8 is a schematic diagram of a worst-case backtracking process provided by an exemplary embodiment of the present disclosure. In this example, three tasks are orchestrated, wherein pop represents backtracking (or退回), each large rectangular box represents one step in the orchestration process. Taking the first large rectangular box as an example, the U-shaped box on the left contains tasks that have been orchestrated, and the small rectangular box on the right represents remaining tasks that have not been orchestrated. Tasks ① and ② have been orchestrated, and task ③ has not been orchestrated. The size of the numbers 1, 2 and 3 indicates their priority, a smaller number indicates a higher priority, that is, the priority from high to low is ①>②>③. Starting from the second large rectangular box, the process is as follows: since task ③ cannot be orchestrated, task ② is backtracked, then task ③, which has a lower priority than task ②, is orchestrated, and then the normal orchestration process is entered, that is, remaining un-orchestrated tasks are orchestrated based on the priority sequence. At this time, the remaining task is task ②, and task ② cannot be orchestrated, so task ③ is backtracked. Since there is no task with a lower priority than task ③ among the remaining un-orchestrated tasks, task ① continues to be backtracked. At this time, there are tasks ② and ③ with lower priorities than task ① among the remaining un-orchestrated tasks, and task ②, which has the higher priority of the two, is selected for orchestration, and then the normal orchestration process is entered, that is, remaining un-orchestrated tasks are orchestrated based on the priority sequence, and task ① is orchestrated. The remaining task ③ cannot be orchestrated again, so task ① is backtracked, task ③ is orchestrated, the remaining task ① cannot be orchestrated again, and task ③ is backtracked again. There is no task with a lower priority than task ③ among the remaining un-orchestrated tasks, and task ② is backtracked again. By parity of reasoning, the orchestration is finally completed, and the order of the three tasks is ③-②-①. Of course, this is only an exemplary worst backtracking case for illustrating the backtracking process, and is not a limitation of the present disclosure.
[0117] It should be noted that, for tasks that need to be completed by different processors, for tasks of each type of processor, a task scheduling table for each task in this type of tasks may be determined according to the method of the present disclosure based on the required type of processor resources, so that the corresponding type of processor performs task scheduling according to the task scheduling table, and the specific principle will not be repeated here.
[0118] The embodiments or optional examples disclosed above can be implemented individually or in any combination without conflict. The specific implementation can be set according to actual needs, and this disclosure does not limit it.
[0119] Any of the task scheduling processing methods provided in this disclosure can be executed by any suitable device with data processing capabilities, including but not limited to: terminal devices and servers. Alternatively, any of the task scheduling processing methods provided in this disclosure can be executed by a processor, such as by a processor executing any of the task scheduling processing methods mentioned in this disclosure by calling corresponding instructions stored in memory. Further details will not be elaborated below.
[0120] Exemplary device
[0121] Figure 9 This is a schematic diagram of the structure of a task scheduling processing apparatus provided in an exemplary embodiment of this disclosure. The apparatus of this embodiment can be used to implement corresponding method embodiments of this disclosure, such as... Figure 9 The device shown includes: a first acquisition module 501, a first processing module 502, a second processing module 503, a third processing module 504, a fourth processing module 505, and a scheduling module 506.
[0122] The first acquisition module 501 is used to acquire information about tasks to be orchestrated and target resource information. The information about tasks to be orchestrated includes description information of periodic tasks corresponding to at least one task to be orchestrated, and the target resource information includes information on available processing resources. The first processing module 502 is used to determine a first number of threads based on the target resource information. The second processing module 503 is used to determine the orchestration period based on the information about tasks to be orchestrated. The third processing module 504 is used to determine the time slices corresponding to the first number of threads based on the orchestration period. The fourth processing module 505 is used to generate a task scheduling table based on the information about tasks to be orchestrated and the time slices corresponding to each thread. The task scheduling table includes the thread corresponding to each task to be orchestrated and the execution time information corresponding to the time slice of that thread. The scheduling module 506 is used to schedule each task to be orchestrated based on the task scheduling table.
[0123] Figure 10 This is a schematic diagram of the structure of a task scheduling processing apparatus provided in another exemplary embodiment of this disclosure.
[0124] In an optional example, the fourth processing module 505 includes: a first processing unit 5051, used to determine the thread corresponding to each task to be scheduled and the execution time information corresponding to the time slice of the thread based on the task information to be scheduled and the time slice of each thread, and generate a task scheduling table by using a backtracking algorithm.
[0125] In one optional example, the periodic task description information includes the task period and execution time threshold of the task to be orchestrated; the first processing unit 5051 is specifically used for:
[0126] Based on the task cycle and execution time threshold corresponding to each task to be orchestrated, and the first rule, the priority sequence of each task to be orchestrated is determined. For any idle time point in the time slice corresponding to any thread, based on the priority sequence, the first task to be orchestrated, with that idle time point as its starting time point, is determined. The first task to be orchestrated is one of the currently un-orchestrated tasks in the priority sequence, and the idle time point is the time point not currently occupied by an already orchestrated task to be orchestrated. Based on the starting time point of the first task to be orchestrated, and the task cycle and execution time threshold corresponding to the first task to be orchestrated, the execution time information corresponding to the first task to be orchestrated in the time slice of that thread is determined. In response to the remaining un-orchestrated tasks... If a task cannot be scheduled, the second task to be scheduled, which was last scheduled, is returned to the list of unscheduled tasks. Based on the priority sequence, a third task to be scheduled, with a lower priority than the second task, is determined from the remaining unscheduled tasks. Based on the idle time point after the second task is returned, the third task to be scheduled is scheduled, and the thread corresponding to the third task and its execution time information in the time slice of that thread are determined. For any idle time point in the time slice corresponding to any thread, the steps are executed to determine the first task to be scheduled with that idle time point as the starting time point, based on the priority sequence, until the scheduling of all tasks to be scheduled is completed and the task scheduling table is obtained.
[0127] In an optional example, the first processing unit 5051 is specifically used for:
[0128] Based on the task cycles corresponding to each task to be orchestrated, the priorities of each task to be orchestrated are determined in ascending order, with tasks with shorter task cycles having higher priorities than those with longer task cycles. For at least two tasks to be orchestrated with the same task cycle, the priorities of each task to be orchestrated are determined in descending order based on their execution time thresholds, with tasks with larger execution time thresholds having higher priorities than those with smaller execution time thresholds. Based on the priorities of each task to be orchestrated, a priority sequence is determined.
[0129] In an optional example, after the second task to be scheduled last scheduled is returned to the list of unscheduled tasks in response to the inability to schedule remaining tasks to be scheduled, the first processing unit 5051 is further configured to:
[0130] In response to the following situation: if there is no third task with a lower priority than the second task among the remaining un-arranged tasks, or if none of the remaining un-arranged tasks with a lower priority than the second task can be arranged, the fourth task, which was arranged before the second task, is returned to the un-arranged tasks. A fifth task with a lower priority than the fourth task is determined from the remaining un-arranged tasks. Based on the idle time point after the fourth task is returned, the fifth task is arranged, and the thread corresponding to the fifth task and its execution time information within the thread's time slice are determined. The steps described above, for any idle time point within the time slice corresponding to any thread, based on the priority sequence, determine the first task to be arranged starting from that idle time point, are executed until the arrangement of all tasks is completed, and a task scheduling table is obtained.
[0131] In an optional example, the second processing module 503 includes: a second processing unit 5031, used as a preset multiple of the least common multiple of the task cycles corresponding to each task to be scheduled as the scheduling cycle.
[0132] In an optional example, the third processing module 504 includes a third processing unit 5041, which determines, for each thread, that the time slice corresponding to that thread is the same as the orchestration period duration.
[0133] In an optional example, the target resource information includes a first number of available processing resources; the first processing module 502 includes: a fourth processing unit 5021, for determining a first number of threads based on the first number of processing resources, wherein each processing resource corresponds one-to-one with each thread.
[0134] The modules and units in this disclosed device can be further divided into finer-grained units according to actual needs, and the specific configuration can be set according to actual needs.
[0135] The specific operating principles of each part of the device disclosed herein are described in the foregoing corresponding method embodiments, and will not be repeated here.
[0136] Exemplary electronic devices
[0137] This disclosure also provides an electronic device, including: a memory for storing a computer program; and a processor for executing the computer program stored in the memory, wherein when the computer program is executed, it implements the task scheduling processing method described in any of the above embodiments of this disclosure.
[0138] Figure 11 This is a schematic diagram of an application embodiment of the electronic device disclosed herein. In this embodiment, the electronic device 10 includes one or more processors 11 and a memory 12.
[0139] The processor 11 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 10 to perform desired functions.
[0140] The memory 12 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 11 may execute the program instructions to implement the methods of the various embodiments of this disclosure described above and / or other desired functions. Various contents such as input signals, signal components, and noise components may also be stored in the computer-readable storage medium.
[0141] In one example, the electronic device 10 may also include an input device 13 and an output device 14, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).
[0142] For example, the input device 13 may be the microphone or microphone array described above, used to capture the input signal of the sound source.
[0143] In addition, the input device 13 may also include, for example, a keyboard, a mouse, etc.
[0144] The output device 14 can output various information to the outside, including determined distance information, direction information, etc. The output device 14 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.
[0145] Of course, for the sake of simplicity, Figure 11 Only some of the components of the electronic device 10 relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 10 may include any other suitable components depending on the specific application.
[0146] Exemplary computer program products and computer-readable storage media
[0147] In addition to the methods and apparatus described above, embodiments of this disclosure may also be computer program products comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps of the methods according to various embodiments of this disclosure as described in the "Exemplary Methods" section above.
[0148] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0149] Furthermore, embodiments of this disclosure may also be computer-readable storage media having computer program instructions stored thereon, which, when executed by a processor, cause the processor to perform the steps in the methods according to various embodiments of this disclosure described in the "Exemplary Methods" section above.
[0150] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0151] The basic principles of this disclosure have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.
[0152] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For system embodiments, since they largely correspond to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0153] The block diagrams of devices, apparatuses, devices, and systems disclosed herein are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0154] The methods and apparatus of this disclosure may be implemented in many ways. For example, they may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order of steps for the methods is for illustrative purposes only, and the steps of the methods of this disclosure are not limited to the order specifically described above unless otherwise specifically stated. Furthermore, in some embodiments, this disclosure may also be implemented as a program recorded on a recording medium, the program including machine-readable instructions for implementing the methods according to this disclosure. Thus, this disclosure also covers recording media storing programs for performing the methods according to this disclosure.
[0155] It should also be noted that in the apparatus, devices, and methods of this disclosure, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered as equivalent solutions to this disclosure.
[0156] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of this disclosure. Therefore, this disclosure is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.
[0157] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this disclosure to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations therein.
Claims
1. A task scheduling processing method, comprising: Obtain task information to be scheduled and target resource information, wherein the task information to be scheduled includes description information of periodic tasks corresponding to at least one task to be scheduled, and the target resource information includes information on available processing resources; Based on the target resource information, a first number of threads are determined; Based on the information of the tasks to be scheduled, the scheduling cycle is determined; Based on the orchestration period, determine the time slices corresponding to the first number of threads; Based on the task information to be orchestrated and the time slices corresponding to each thread, a task scheduling table is generated. The task scheduling table includes the thread corresponding to each task to be orchestrated and the execution time information corresponding to the time slice of that thread. Based on the task scheduling table, schedule each of the tasks to be arranged. The periodic task description information includes the task period and execution time threshold of the task to be orchestrated; the execution time information of each task to be orchestrated in the time slice of the thread is determined in the following way: Based on the task cycle and execution time threshold corresponding to each of the tasks to be orchestrated, and the first rule, the priority sequence of each of the tasks to be orchestrated is determined; For any idle time point in the time slice corresponding to any of the threads, based on the priority sequence, a first task to be scheduled is determined with the idle time point as the starting time point. The first task to be scheduled is one of the currently unscheduled tasks to be scheduled in the priority sequence, and the idle time point is the time point that is not currently occupied by the scheduled task to be scheduled. Based on the start time of the first task to be scheduled, the task period corresponding to the first task to be scheduled, and the execution time threshold, the execution time information corresponding to the first task to be scheduled in the time slice of the thread is determined.
2. The method according to claim 1, wherein, The step of generating a task scheduling table based on the task information to be scheduled and the time slices corresponding to each thread includes: Based on the task information to be scheduled and the time slices corresponding to each thread, a backtracking algorithm is used to determine the thread corresponding to each task to be scheduled and the execution time information corresponding to the time slice of that thread, and to generate the task scheduling table.
3. The method according to claim 2, wherein, Based on the task information to be scheduled and the time slices corresponding to each thread, a backtracking algorithm is used to determine the thread corresponding to each task to be scheduled and the execution time information corresponding to the time slice of that thread, and to generate the task scheduling table, including: Based on the task cycle and execution time threshold corresponding to each of the tasks to be orchestrated, and the first rule, the priority sequence of each of the tasks to be orchestrated is determined; For any idle time point in the time slice corresponding to any of the threads, based on the priority sequence, a first task to be scheduled is determined with the idle time point as the starting time point. The first task to be scheduled is one of the currently unscheduled tasks to be scheduled in the priority sequence, and the idle time point is the time point that is not currently occupied by the scheduled task to be scheduled. Based on the start time of the first task to be orchestrated, the task period corresponding to the first task to be orchestrated, and the execution time threshold, the execution time information corresponding to the first task to be orchestrated in the time slice of the thread is determined; In response to the inability to schedule the remaining unscheduled tasks, the second task scheduled last scheduled is returned to the unscheduled tasks. Based on the priority sequence, a third task with a lower priority than the second task to be orchestrated is determined from the remaining un-orchestrated tasks to be orchestrated; Based on the idle time point after the second task to be scheduled is returned, the third task to be scheduled is scheduled, and the thread corresponding to the third task to be scheduled and the execution time information corresponding to the time slice of the thread are determined. The process involves executing the step of determining the first task to be scheduled based on the priority sequence at any idle time point within the time slice corresponding to any of the threads, until the scheduling of each task to be scheduled is completed, thereby obtaining the task scheduling table.
4. The method according to claim 3, wherein, The step of determining the priority sequence of each task to be orchestrated based on the task period and execution time threshold corresponding to each task to be orchestrated, and the first rule, includes: Based on the task cycle corresponding to each of the tasks to be scheduled, the priority of each task to be scheduled is determined in ascending order, with the priority of the task to be scheduled having a shorter task cycle being higher than that of the task to be scheduled having a longer task cycle. For at least two tasks to be scheduled with the same task cycle, the priorities of the at least two tasks to be scheduled are determined in descending order based on the execution time thresholds of the at least two tasks to be scheduled. The priority of the task to be scheduled with the larger execution time threshold is higher than that of the task to be scheduled with the smaller execution time threshold. The priority sequence is determined based on the priority corresponding to each of the tasks to be orchestrated.
5. The method according to claim 3, wherein, After reverting the second task to the un-arranged tasks in response to the inability to arrange the remaining un-arranged tasks, the process further includes: In response to the fact that there is no third task with a lower priority than the second task among the remaining un-arranged tasks to be arranged, or that none of the remaining un-arranged tasks with a lower priority than the second task can be arranged, the fourth task to be arranged that was arranged before the second task will be returned to the un-arranged tasks to be arranged. From the remaining un-arranged tasks to be arranged, determine a fifth task with a lower priority than the fourth task to be arranged; Based on the idle time point after the fourth task to be scheduled is returned, the fifth task to be scheduled is scheduled, and the thread corresponding to the fifth task to be scheduled and the execution time information corresponding to the time slice of the thread are determined. The process involves executing the step of determining the first task to be scheduled based on the priority sequence at any idle time point within the time slice corresponding to any of the threads, until the scheduling of each task to be scheduled is completed, thereby obtaining the task scheduling table.
6. The method according to claim 1, wherein, The step of determining the orchestration cycle based on the task information to be orchestrated includes: The scheduling period is a preset multiple of the least common multiple of the task cycles corresponding to each of the tasks to be scheduled.
7. The method according to claim 1, wherein, The step of determining the time slices corresponding to the first number of threads based on the orchestration period includes: For each thread, it is determined that the time slice corresponding to that thread is the same as the duration of the orchestration cycle.
8. The method according to any one of claims 1-7, wherein, The target resource information includes a first number of processing resource information that are available; Determining the first number of threads based on the target resource information includes: Based on the first number of processing resource information, the first number of threads are determined, wherein each processing resource corresponds one-to-one with each thread.
9. A task scheduling processing apparatus, comprising: The first acquisition module is used to acquire task information to be orchestrated and target resource information. The task information to be orchestrated includes periodic task description information corresponding to at least one task to be orchestrated, and the target resource information includes available processing resource information. The first processing module is used to determine a first number of threads based on the target resource information; The second processing module is used to determine the orchestration cycle based on the information of the tasks to be orchestrated; The third processing module is used to determine the time slices corresponding to the first number of threads based on the orchestration period. The fourth processing module is used to generate a task scheduling table based on the task information to be scheduled and the time slices corresponding to each thread. The task scheduling table includes the thread corresponding to each task to be scheduled and the execution time information corresponding to the time slice of the thread. The scheduling module is used to schedule each of the tasks to be arranged based on the task scheduling table; The periodic task description information includes the task period and execution time threshold of the task to be orchestrated; the execution time information of each task to be orchestrated in the time slice of the thread is determined in the following way: Based on the task cycle and execution time threshold corresponding to each of the tasks to be orchestrated, and the first rule, the priority sequence of each of the tasks to be orchestrated is determined; For any idle time point in the time slice corresponding to any of the threads, based on the priority sequence, a first task to be scheduled is determined with the idle time point as the starting time point. The first task to be scheduled is one of the currently unscheduled tasks to be scheduled in the priority sequence, and the idle time point is the time point that is not currently occupied by the scheduled task to be scheduled. Based on the start time of the first task to be scheduled, the task period corresponding to the first task to be scheduled, and the execution time threshold, the execution time information corresponding to the first task to be scheduled in the time slice of the thread is determined.
10. A computer-readable storage medium storing a computer program for performing the task scheduling processing method according to any one of claims 1-8.
11. An electronic device, the electronic device comprising: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the task scheduling processing method according to any one of claims 1-8.
Citation Information
Patent Citations
Task scheduling method and device and computer storage medium
CN110515713A
Deterministic task scheduling and arranging method and system based on time triggering mechanism and storage medium
CN115309519A