A task execution method, apparatus and device
By reordering tasks through a task grouping priority architecture and task margin calculation logic, the problem of task execution delay in multi-engine collaborative work is solved, and the efficiency of task execution and work engine scheduling is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
- Filing Date
- 2021-12-28
- Publication Date
- 2026-04-21
AI Technical Summary
In multi-engine collaborative operation, the execution delay caused by the first-come-last-serve strategy for short jobs can lead to system performance degradation or functional errors.
A task grouping priority architecture is adopted, which divides tasks into task groups with corresponding priorities, and reorders tasks through task margin calculation logic, and executes tasks using a priority round-robin method.
It improves task execution efficiency and job engine scheduling efficiency, and solves the problem of low latency caused by ignoring tasks during first-come-first-served execution.
Smart Images

Figure CN114443244B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a task execution method, apparatus, device, and storage medium. Background Technology
[0002] Big data poses significant challenges to data processing capabilities, dynamic scheduling, and bandwidth. Multi-engine collaborative processing has become a common approach. A common method involves assigning a work queue to each engine, with tasks executed on a first-come, first-served basis within their respective engines. However, this approach encounters the following situation: a task with strict latency requirements (a short job) and a task with more lenient latency requirements (a long job) are executed later. Because the work queue follows a first-come, first-served strategy, the short job can only receive service after the long job has completed, exceeding its tolerable waiting time, leading to system performance degradation or functional errors.
[0003] Therefore, how to improve task execution efficiency in multi-engine collaborative work is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a task execution method, apparatus, device, and storage medium that can solve the problem of neglecting low-latency execution due to the first-come, first-served nature of tasks, thereby improving the efficiency of task execution and job engine scheduling. The specific solution is as follows:
[0005] The first aspect of this application provides a task execution method, including:
[0006] Obtain the tasks to be executed and assign them to projects in task groups with corresponding first priorities; wherein each task group has a unique first priority.
[0007] The task margin of each task to be executed corresponding to each item in the task group is determined, and the tasks to be executed corresponding to each item are reordered according to the task margin to obtain a reordered task queue corresponding to the task group; wherein, the task margin represents the execution urgency of the task to be executed.
[0008] The task group is polled by priority polling to determine the task to be executed from the corresponding reordered task queue, and the task to be executed is executed by the working engine.
[0009] Optionally, obtaining the task to be executed includes:
[0010] The task to be executed is input through the task bus interface and flows through the task buffer. Parity checks are performed on the task to be executed. If the check passes, a valid task to be executed is obtained.
[0011] Optionally, the task execution method further includes:
[0012] Determine whether the available cache of the task buffer is less than a preset threshold. If so, trigger the generation of an interrupt warning signal to provide an interrupt warning when the task buffer is about to be full.
[0013] Optionally, determining the task margin of the tasks to be executed corresponding to each item in the task group includes:
[0014] The expected completion time and the latest completion time of each task to be executed corresponding to each project are determined, and the difference between the expected completion time and the latest completion time is determined as the task margin of the task to be executed.
[0015] Optionally, after the task to be executed is completed using the working engine, the process further includes:
[0016] Determine the completion time of the task to be executed, and adjust the expected completion time based on the completion time and the arrival time of the task to be executed after it is divided into parts and arrives at the project.
[0017] Optionally, the step of reordering the tasks to be executed corresponding to the project according to the task margin to obtain a reordered task queue corresponding to the task group includes:
[0018] The task margins are sorted using a four-level sorting network, and the corresponding tasks to be executed are written into a queue in the order of the sorted task margins to obtain the reordered task queue corresponding to the task group.
[0019] Optionally, the step of polling the task group by priority to determine the task to be executed from the corresponding reordered task queue includes:
[0020] The task groups are polled in descending order of their first priority.
[0021] Assign a second priority to the tasks to be executed in the reordered task queue, and determine the tasks to be executed from the corresponding reordered task queue in descending order of the second priority.
[0022] Optionally, the first priority corresponding to the task group is the QoS priority;
[0023] Accordingly, the method further includes:
[0024] The task groups and the corresponding QoS priorities are divided according to the QoS indication or task type when transmitting tasks through the bus task interface.
[0025] A second aspect of this application provides a task execution apparatus, comprising:
[0026] The task allocation module is used to acquire tasks to be executed and allocate the tasks to projects in task groups with corresponding first priorities; wherein each task group has a unique first priority.
[0027] The sorting module is used to determine the task margin of each task to be executed corresponding to each item in the task group, and to reorder the tasks to be executed corresponding to each item according to the task margin to obtain a reordered task queue corresponding to the task group; wherein, the task margin represents the execution urgency of the task to be executed.
[0028] The polling execution module is used to poll the task group in a priority polling manner to determine the task to be executed from the corresponding reordered task queue, and to execute the task to be executed using the working engine.
[0029] A third aspect of this application provides an electronic device including a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the aforementioned task execution method.
[0030] A fourth aspect of this application provides a computer-readable storage medium storing computer-executable instructions, which, when loaded and executed by a processor, implement the aforementioned task execution method.
[0031] In this application, tasks to be executed are first obtained and then assigned to projects within a task group with a corresponding first priority. Each task group has a unique first priority. Next, the task margin of each task corresponding to a project within the task group is determined, and the tasks are reordered according to the task margin to obtain a reordered task queue corresponding to the task group. The task margin represents the urgency of the task. Finally, the task group is polled using a priority round-robin method to determine the tasks to be executed from the reordered task queue, and the task engine executes these tasks. This application employs a task grouping priority architecture to group tasks according to priority and reorders the grouped tasks using task margin calculation logic. This solves the problem of ignoring low-latency tasks due to first-come-first-served processing, improving task execution and task engine scheduling efficiency. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0033] Figure 1 A flowchart of a task execution method provided in this application;
[0034] Figure 2 This application provides a specific task execution logic architecture diagram;
[0035] Figure 3 The execution logic diagram of the reconfigurable sorting network MERGE4 provided in this application;
[0036] Figure 4 A reconfigurable QOS arbitration model diagram is provided for this application;
[0037] Figure 5 This application provides a reconfigurable QOS arbitration mode polling graph;
[0038] Figure 6 A schematic diagram of a task execution device provided in this application;
[0039] Figure 7 This application provides a structural diagram of a task execution electronic device. Detailed Implementation
[0040] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0041] Existing multi-engine collaborative processing methods allocate a work queue to each engine, and tasks are executed in their respective engines on a first-come, first-served basis. However, because the first-come, first-served nature of the task queue ignores the low-latency priority of the tasks themselves, it can lead to system performance degradation or functional errors. To address these shortcomings, this application provides a task execution scheme that employs a task grouping priority architecture to group tasks to be executed according to their priority. Furthermore, it uses task margin calculation logic to reorder the grouped tasks, thus resolving the issue of ignoring low-latency execution in the first-come, first-served approach and improving the efficiency of task execution and work engine scheduling.
[0042] Figure 1 A flowchart illustrating a task execution method provided in an embodiment of this application. See also... Figure 1 As shown, the task execution method includes:
[0043] S11: Obtain the tasks to be executed and assign them to the projects of the corresponding first priority task groups; wherein, each task group has a unique first priority.
[0044] In this embodiment, tasks to be executed are first acquired, and then these tasks are assigned to projects within task groups corresponding to a first priority. Each task group has a unique first priority. Specifically, the task execution method in this embodiment supports QoS (Quality of Service), a technology that leverages various underlying technologies to provide better service capabilities for specified network communications, addressing issues such as network latency and congestion. In this scenario, the first priority corresponding to the task group is the QoS priority. Therefore, prior to this, it is necessary to divide the task groups and their corresponding QoS priorities based on the QoS indication or task type corresponding to the task transmission via the bus task interface.
[0045] The above process corresponds to Figure 2The priority grouping module in it. As an example, in this embodiment, it is divided into 16 task groups. The QOS priority is defined as QOS = 0 < QOS = 1 < QOS = 2 < QOS = 3... < QOS = 15. Each task group can accommodate 16 pending tasks of this priority (accommodated by items). It can be understood that the QOS priority allocation can follow the indication of the corresponding QOS when the task is transmitted on the bus, such as AWQOS (write QOS) and ARQOS (read QOS) in AXI (Advanced eXtensible Interface). AXI is a bus protocol, which is the most important part of the AMBA (Advanced Microcontroller Bus Architecture) 3.0 protocol and is an on-chip bus oriented to high performance, high bandwidth, and low latency. If a mechanism similar to the above is not used, the QOS is assigned according to the task type, and the priority levels are: real-time (such as display tasks) or stream data processing tasks (such as video encoding and decoding) > memory / register read and write access > data block DMA (generally greater than 4096 bytes).
[0046] Specifically, in this embodiment, the pending task is input through the task bus interface and flows through the task buffer, and then parity check is performed on the pending task. If the check passes, a valid pending task is obtained. The interface circuit and the task buffer supporting parity check are as shown in the corresponding part of Figure 2 the figure. The task content read out from the task buffer undergoes parity check. If the parity check fails, a parity check error interrupt warning signal is generated. The tasks that pass the parity check enter 16 task groups through QOS priority grouping. The parity check is a method for verifying the correctness of code transmission. It is verified according to whether the number of "1"s in the digits of a group of binary codes being transmitted is odd or even. The one using odd is called odd parity check, and vice versa is called even parity check. Further, the task enters the task buffer through the bus task interface. The task buffer will generate a buffer almost full interrupt warning signal when the available buffer reaches the preset value, that is, it is necessary to determine whether the available buffer in the task buffer is less than the preset threshold. If so, an interrupt warning signal is triggered and generated to give an interrupt warning for the buffer in the task buffer being almost full.
[0047] S12: Respectively determine the task margins of the pending tasks corresponding to each of the items in the task group, and reorder the pending tasks corresponding to the items according to the task margins to obtain a reordered task queue corresponding to the task group; wherein, the task margin characterizes the execution urgency of the pending task.
[0048] In this embodiment, the task margin of each task to be executed corresponding to each item in the task group is determined. The task margin characterizes the urgency of the task to be executed. Specifically, the expected completion time and the latest completion time of each task to be executed corresponding to each item are first determined, and the difference between the expected completion time and the latest completion time is determined as the task margin of the task to be executed. For example, based on the arrival time Ta (obtainable through a system timer) of tasks 0-15 in this group, the expected completion time Te, and the worst-case completion time (latest completion time) Td, the task margin Tt (Tt = Td - Te) is calculated.
[0049] Based on this, the expected completion time can be dynamically adjusted. This involves determining the completion time of the task to be executed and adjusting the expected completion time based on that completion time and the arrival time of the task after it has been divided and reached the project. The expected completion time is dynamically adjusted using the final task completion time Tf (obtainable through a system timer). The initial value of the expected completion time comes from the static configuration of the registers and is dynamically adjusted after each task completion. The adjustment method is to use the average of the actual completion time and the expected value as the expected value Te' for the next task execution: Te' = 1 / 2 * [(Tf - Ta) + Te]. Alternatively, the expected execution time can be calculated using a weighted average. The weighting coefficient can be statically specified or dynamically configured based on the task type. It can also be calculated using the average execution time of multiple tasks within a time window, such as averaging the execution times of tasks completed within a fixed time window (e.g., 1 millisecond).
[0050] In this embodiment, after determining the task margin, the tasks to be executed corresponding to the project are reordered according to the task margin to obtain a reordered task queue corresponding to the task group. Specifically, a four-level sorting network can be used to sort the task margins, and the corresponding tasks to be executed are written into the queue in the order of the sorted task margins to obtain the reordered task queue corresponding to the task group. Figure 3 The MERGE4 network illustrates the working principle of sorting networks. Suppose we want to sort four values: a1 (value 9), a2 (value 5), a3 (value 2), and a4 (value 6). This sorting network is called MERGE4. In the first clock cycle: a1 and a2 are compared, then a3 and a4 are compared, obtaining a preliminary result. Figure 3 In this context, T1 represents {9, 5, 2, 6} and {5, 9, 2, 6}. In the second clock cycle, the results of T1 are compared between a1 and a3, and between a2 and a4 to obtain a preliminary result. Figure 3In the first clock cycle, T2 represents {5, 9, 2, 6} and {2, 6, 5, 9}. In the third clock cycle, a2 and a3 in the results of T2 are compared to obtain the final result T3, which is {2, 6, 5, 9} and {2, 5, 6, 9}, completing the sorting. It's easy to understand that since each workgroup can accommodate 16 tasks to be executed, sorting up to 16 tasks according to task margin requires a four-level sorting network and MERGE2, MERGE4, MERGE8, and MERGE16, with a working principle similar to MERGE4. The reordering queue receives the task with the smallest task margin output by the sorting network. The sorting network changes the first-come, first-served execution order of the up to 16 tasks with the same priority, instead writing them into the reordering task work queue according to their urgency from smallest to largest task margin.
[0051] S13: Poll the task group by priority polling to determine the task to be executed from the corresponding reordered task queue, and use the work engine to execute the task to be executed.
[0052] In this embodiment, the task groups are polled using a priority-based round-robin method to determine the tasks to be executed from the corresponding reordered task queues, and the task engine is used to execute the tasks to be executed. In addition to the priority of the QoS task groups in the reordered task queues, the priorities of each task to be detected in the reordered task queues can also be reconstructed. Correspondingly, the task groups are first polled according to their first priority, then a second priority is assigned to the tasks to be executed in the reordered task queues, and the tasks to be executed are determined from the corresponding reordered task queues according to their second priority. Furthermore, the task engine is a hardware implementation that performs certain algorithm processing or protocol processing, including but not limited to processors and hardware accelerators. After task execution, the task completion status of task groups and task IDs can be fed back to the task margin calculation module via NOC (Network on Chip). NOC stands for On-Chip Interconnect, used for efficient connection of multiple on-chip processors, acceleration engines, etc.
[0053] It's understandable that the 16 reordered task queues inherit the previous QoS priority; that is, reordered task queue 15, with a QoS of 15, has a higher priority than reordered task queue with a QoS of 0. There is another priority-based round-robin QoS method: the 16 reordered task queues can also be restructured into task queues with only four priority levels (high, second-highest, medium, and low) or only two categories (high and low). This round-robin mode is an improved round-robin arbitration, see [reference]. Figure 4 and Figure 5Taking the current situation where only 8 task groups are valid as an example, access request numbers 7-3 represent input channel requests _HP (high priority access group) access requests 7-3, and access request numbers 2-0 represent input channel requests _LP (low priority access group) access requests 2-0. The access request and access priority for each request number are concatenated using the operation {req, QOS[1:0]}, resulting in a 3-bit value. The corresponding binary arithmetic value serves as the basis for arbitration. An access request of 1 represents a valid request, and 0 represents no access request. The access priority represents the priority of the corresponding request number, and its arbitration process can be summarized as polling and comparison. Its working process involves starting from the high priority access group and proceeding by... Figure 4 The search direction shown (high-priority access group → low-priority access group, searching access numbers 3→4→5→6→7→0→1→2→3) selects the first valid access request with the largest arithmetic value as the output, such as... Figure 4 The binary value of access request number 4 is 5 (binary 101, req=1, QOS=01) in its concatenation operation. Although the binary value of access requests 7 and 6 in their concatenation operations is also 5, from the perspective of the search direction, access request number 4 is the first access request that appears with the largest arithmetic value and is a valid request in the search direction. Therefore, the arbitration result for this round is that access request 4 wins.
[0054] As can be seen, this embodiment first obtains the tasks to be executed and divides them into projects of a corresponding first priority task group; wherein each task group has a unique first priority; then, the task margin of the tasks to be executed corresponding to each project of the task group is determined, and the tasks to be executed corresponding to the projects are reordered according to the task margin to obtain a reordered task queue corresponding to the task group; wherein, the task margin represents the execution urgency of the tasks to be executed; finally, the task group is polled in a priority round-robin manner to determine the tasks to be executed from the corresponding reordered task queue, and the task engine is used to execute the tasks to be executed. This embodiment adopts a task grouping priority architecture to group the tasks to be executed according to priority, and reorders the grouped tasks to be executed through task margin calculation logic, which solves the problem of ignoring low-latency execution due to first-come-first-served tasks, and improves the efficiency of task execution and task engine scheduling.
[0055] See Figure 6 As shown in the embodiments, this application also discloses a task execution device, including:
[0056] The task allocation module 11 is used to acquire tasks to be executed and allocate the tasks to be executed to projects in task groups with corresponding first priorities; wherein, each task group has a unique first priority.
[0057] The sorting module 12 is used to determine the task margin of the tasks to be executed corresponding to each item in the task group, and to reorder the tasks to be executed corresponding to the items according to the task margin to obtain a reordered task queue corresponding to the task group; wherein, the task margin represents the execution urgency of the tasks to be executed.
[0058] The polling execution module 13 is used to poll the task group in a priority polling manner to determine the task to be executed from the corresponding reordered task queue, and to execute the task to be executed using the working engine.
[0059] As can be seen, this embodiment first obtains the tasks to be executed and divides them into projects of a corresponding first priority task group; wherein each task group has a unique first priority; then, the task margin of the tasks to be executed corresponding to each project of the task group is determined, and the tasks to be executed corresponding to the projects are reordered according to the task margin to obtain a reordered task queue corresponding to the task group; wherein, the task margin represents the execution urgency of the tasks to be executed; finally, the task group is polled in a priority round-robin manner to determine the tasks to be executed from the corresponding reordered task queue, and the task engine is used to execute the tasks to be executed. This embodiment adopts a task grouping priority architecture to group the tasks to be executed according to priority, and reorders the grouped tasks to be executed through task margin calculation logic, which solves the problem of ignoring low-latency execution due to first-come-first-served tasks, and improves the efficiency of task execution and task engine scheduling.
[0060] In some specific embodiments, the acquisition and division module 11 is further used to input the task to be executed through the task bus interface and perform parity check on the task to be executed after it flows through the task buffer. If the check passes, a valid task to be executed is obtained.
[0061] Accordingly, in some specific embodiments, the task execution device further includes:
[0062] The early warning module is used to determine whether the available buffer of the task buffer is less than a preset threshold. If so, it triggers the generation of an interruption early warning signal to provide an interruption warning when the task buffer is about to be full.
[0063] In some specific embodiments, the sorting determination module 12 specifically includes:
[0064] The determining unit is used to determine the expected completion time and the latest completion time of the task to be executed corresponding to each of the projects, and to determine the difference between the expected completion time and the latest completion time as the task margin of the task to be executed.
[0065] The correction unit is used to determine the completion time after the task to be executed is completed, and to correct the expected completion time based on the completion time and the arrival time of the task to be executed after it is divided into parts and arrives at the project.
[0066] The sorting unit is used to sort the task margins using a four-level sorting network, and sequentially write the corresponding tasks to be executed into a queue according to the sorted task margins to obtain the reordered task queue corresponding to the task group.
[0067] In some specific embodiments, the polling execution module 13 specifically includes:
[0068] The first polling unit is used to poll the task group according to the first priority order of the task group;
[0069] The second polling unit is used to assign a second priority to the tasks to be executed in the reordered task queue, and to determine the tasks to be executed from the corresponding reordered task queue according to the order of the second priority of the tasks to be executed.
[0070] In some specific embodiments, when the first priority corresponding to the task group is the QoS priority, the task execution device further includes:
[0071] The QoS grouping module is used to divide the task group and the QoS priority corresponding to the task group according to the QoS indication or task type corresponding to the task transmission when the bus task interface transmits the task.
[0072] Furthermore, embodiments of this application also provide an electronic device. Figure 7 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0073] Figure 7 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the task execution method disclosed in any of the foregoing embodiments.
[0074] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0075] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222 and data 223, etc., and the storage method can be temporary storage or permanent storage.
[0076] The operating system 221 manages and controls the various hardware devices and computer programs 222 on the electronic device 20 to enable the processor 21 to perform calculations and processing on the massive amounts of data 223 in the memory 22. The operating system 221 can be Windows Server, Netware, Unix, Linux, etc. In addition to including computer programs capable of performing the task execution methods disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks. The data 223 may include tasks to be executed collected by the electronic device 20.
[0077] Furthermore, this application also discloses a storage medium storing a computer program, which, when loaded and executed by a processor, implements the task execution method steps disclosed in any of the foregoing embodiments.
[0078] 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 the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0079] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0080] The task execution method, apparatus, device, and storage medium provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A task execution method, characterized in that, include: Obtain the tasks to be executed and assign them to projects in task groups with corresponding first priorities; wherein each task group has a unique first priority. The expected completion time and the latest completion time of each task to be executed corresponding to each project are determined respectively, and the difference between the expected completion time and the latest completion time is determined as the task margin of the task to be executed. The tasks to be executed corresponding to each project are reordered according to the task margin to obtain a reordered task queue corresponding to the task group; wherein, the task margin represents the execution urgency of the task to be executed. The task group is polled by priority polling to determine the task to be executed from the corresponding reordered task queue, and the task to be executed is executed by the work engine. After the task to be executed is completed using the work engine, the following is also included: Determine the completion time of the task to be executed, and adjust the expected completion time based on the completion time and the arrival time of the task to be executed after it is divided into parts and arrives at the project; wherein the adjustment method is to use the average of the actual completion time and the expected completion time as the expected completion time for the next task execution.
2. The task execution method according to claim 1, characterized in that, The process of obtaining the task to be executed includes: The task to be executed is input through the task bus interface and flows through the task buffer. Parity checks are performed on the task to be executed. If the check passes, a valid task to be executed is obtained.
3. The task execution method according to claim 2, characterized in that, Also includes: Determine whether the available cache of the task buffer is less than a preset threshold. If so, trigger the generation of an interrupt warning signal to provide an interrupt warning when the task buffer is about to be full.
4. The task execution method according to claim 1, characterized in that, The step of reordering the tasks to be executed corresponding to the project according to the task margin to obtain a reordered task queue corresponding to the task group includes: The task margins are sorted using a four-level sorting network, and the corresponding tasks to be executed are written into a queue in the order of the sorted task margins to obtain the reordered task queue corresponding to the task group.
5. The task execution method according to claim 1, characterized in that, The step of polling the task group by priority to determine the task to be executed from the corresponding reordered task queue includes: The task groups are polled in descending order of their first priority. Assign a second priority to the tasks to be executed in the reordered task queue, and determine the tasks to be executed from the corresponding reordered task queue in descending order of the second priority.
6. The task execution method according to any one of claims 1 to 5, characterized in that, The first priority corresponding to the task group is the QoS priority; Accordingly, the method further includes: The task groups and the corresponding QoS priorities are divided according to the QoS indication or task type when transmitting tasks through the bus task interface.
7. A task execution device, characterized in that, include: The task allocation module is used to acquire tasks to be executed and allocate the tasks to projects in task groups with corresponding first priorities; wherein each task group has a unique first priority. The sorting module is used to determine the expected completion time and the latest completion time of the tasks to be executed corresponding to each project, and to determine the difference between the expected completion time and the latest completion time as the task margin of the task to be executed. The task margin is then used to reorder the tasks to be executed corresponding to the project to obtain a reordered task queue corresponding to the task group. The task margin represents the urgency of the task to be executed. The polling execution module is used to poll the task group using a priority polling method to determine the task to be executed from the corresponding reordered task queue, and to execute the task to be executed using the work engine. After the task to be executed is completed using the work engine, the module further includes: determining the completion time of the task to be executed, and correcting the expected completion time based on the completion time and the arrival time of the task to be executed after it was divided into parts and the arrival time of the task to be executed in the project; wherein the correction method is to use the average of the actual completion time and the expected completion time as the expected completion time for the next task execution.
8. An electronic device, characterized in that, The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the task execution method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Priori knowledge based phase array radar self-adaption task scheduling method
CN103902385A
Elastic telescoping method and system for micro-service system in cloud environment, medium and equipment
CN112084002A