Time delay jitter control method of task chain and related device
By adding a second task after the last task of the task chain, ensuring that the output data is output at a specific point in time, the problem of delay jitter in the task chain is solved and system performance is improved.
Patent Information
- Application Number
- CN202311421115.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-27
- Publication Date
- 2025-04-29
AI Technical Summary
The end-to-end delay jitter of the task chain causes the control system to deviate from expectations and affects the system performance.
Add a second task after the last task of the original task chain to form a new task chain. The second task is used to obtain the data output by the first task and output the data at the target time point to ensure that the time point of output data is fixed.
By ensuring that the output data of the task chain is output at a specific point in time, the end-to-end delay of the task chain is stabilized, avoiding excessive delay jitter affecting system performance.
Smart Images

Figure CN119902866A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method for controlling delay jitter of a task chain and a related device. Background Art
[0002] In software-based control systems, multiple tasks that are executed in sequence are usually used to implement specific control behaviors (such as vehicle acceleration behavior in autonomous driving scenarios). Multiple tasks that are executed in sequence constitute a task chain. Generally speaking, for two adjacent tasks in a task chain, the latter task can only be executed after the previous task is completed and output data is generated.
[0003] In order to ensure the realization of control behavior, the end-to-end delay of a task chain usually has a predetermined design value. Among them, the end-to-end delay of a task chain refers to the total time taken from the start of execution of the first task in the task chain to the end of execution of the last task. When the actual end-to-end delay of the task chain is equal to the predetermined design value, the control system can work according to the expected behavior. If there is jitter in the actual end-to-end delay of the task chain during the operation of the control system (for example, the actual end-to-end delay is less than or greater than the design value), the behavior of the control system may deviate from expectations, resulting in the expected indicators no longer meeting the requirements, causing the degradation of system performance.
[0004] Since there are execution dependencies between multiple tasks in the task chain, and each task in the task chain is susceptible to changes in system load during execution, resulting in jitter in the task completion time, the end-to-end delay of the entire task chain is prone to large jitter, affecting the performance of the system. Summary of the invention
[0005] The present application provides a delay jitter control method for a task chain, which is used to control the end-to-end delay jitter of the task chain.
[0006] The first aspect of the present application provides a method for controlling delay jitter of a task chain, which is applied to adjusting the task chain in a control system. The method includes: obtaining a first task chain and a worst-case execution time (WCET) of the first task chain. The first task chain is an original task chain that needs to control delay jitter, and the first task chain includes multiple tasks that are executed in sequence. In addition, the WCET of the first task chain is used to indicate the maximum value of the time required to execute the first task chain.
[0007] Then, add the second task after the first task in the first task chain to obtain the second task chain. The first task is the last task in the first task chain, and the second task is used to obtain the data output by the first task and output the data at the target time point. The duration between the target time point and the time point when the second task chain starts to execute is a preset threshold, and the preset threshold is related to the WCET of the first task chain. Specifically, the second task is added after the last task (ie, the first task) of the first task chain, and the second task can only be started after the first task is completed, that is, the execution of the second task depends on the first task. Moreover, the second task is not executed immediately after the first task is completed, but needs to be executed at the target time point after the first task is completed.
[0008] Among them, the second task does not perform substantial processing on the data output by the first task, but outputs the data obtained from the first task at the target time point (i.e., re-outputs the original output data of the first task chain), thereby ensuring that the time point at which the second task chain outputs data is fixed, that is, ensuring that the end-to-end delay of the second task chain is fixed.
[0009] In this solution, a task is added after the original task chain, which reads the data output by the original task chain and can output the read data at a specific time point, so that the output data of the original task chain can be output at a specific time point. In this way, no matter how long the actual execution time of the original task chain is, it can ensure that the data obtained by executing the original task chain is output at a specific time point, ensure that the end-to-end delay of the new task chain is stable, and avoid excessive delay jitter of the task chain affecting the normal operation of the system.
[0010] In a possible implementation, the above-mentioned target time point includes multiple time points, and the preset threshold includes multiple thresholds. The durations between the multiple time points and the time point at which the second task chain starts to execute are multiple thresholds. In other words, the execution of the second task can be triggered at multiple time points, and the duration between each of the multiple time points and the time point at which the second task chain starts to execute is a fixed threshold, and the durations between different time points and the time point at which the second task chain starts to execute are not the same.
[0011] Furthermore, after acquiring the data output by the first task, the second task is used to output the data at a time point closest to the first moment among multiple time points, and the first moment is the moment when the second task acquires the data output by the first task.
[0012] In this solution, by setting multiple time points at which the last task in the second task chain can output data, the end-to-end delay of the second task chain can be controlled within a limited number of thresholds, thereby supporting a multi-mode task chain working mode, facilitating the design of other task chains that rely on the second task chain, and ensuring that the output of the second task chain can match the various working modes of other task chains that rely on the second task chain. In addition, based on the design of multiple time points, the end-to-end delay of the second task chain can be controlled at multiple reasonable values, avoiding the end-to-end delay of the second task chain always being a large threshold, thereby improving the execution efficiency of the task chain.
[0013] In a possible implementation, multiple thresholds corresponding to multiple time points are all less than or equal to WCET, and one of the multiple thresholds is equal to WCET. In this way, by setting multiple thresholds to be less than or equal to the WCET of the second task chain, the end-to-end delay of the second task chain can be reduced as much as possible, and if one of the multiple thresholds is equal to WCET, it can be ensured that the second task chain can output data in any execution situation, thereby ensuring the normal execution of the second task chain.
[0014] In a possible implementation, the method further includes: obtaining the number of time points included in the target time point and multiple execution times corresponding to the first task chain, where the multiple execution times are obtained by executing the first task chain under different execution conditions. That is, the first task chain is repeatedly executed multiple times under different execution environments, thereby obtaining multiple execution times of the first task chain, and thus knowing the execution time distribution of the first task chain.
[0015] Then, based on the multiple execution times, the cumulative distribution function (CDF) of the execution time of the first task chain is determined. After obtaining the CDF of the first task chain, the distribution of the execution time of the first task chain can be determined, that is, the probability of various execution times occurring in the first task chain.
[0016] Secondly, based on the number of time points included in the target time point and the CDF, the values of multiple thresholds corresponding to the multiple time points are determined through algorithm iteration to achieve the preset optimization goal.
[0017] There are multiple implementations of the preset optimization goal, which can be determined or adjusted according to the actual application scenario. For example, in one possible implementation, the preset optimization goal includes the average execution time of the second task chain being the minimum value, wherein the average execution time is related to the size of multiple thresholds and CDF.
[0018] In this scheme, after determining the number of multiple time points that trigger the execution of the second task, the specific values of the multiple time points can be obtained with the goal of minimizing the average execution time of the second task chain, so that when the second task execution is triggered based on these multiple time points, the average execution time of the second task chain can be as small as possible.
[0019] In a possible implementation, the algorithm for performing iterative solution includes a particle swarm optimization algorithm, a genetic algorithm, or a simulated annealing algorithm.
[0020] In a possible implementation, the target time point includes only one time point, and the duration between the target time point and the time point when the second task chain starts executing is greater than or equal to the WCET of the first task chain, that is, the above preset threshold is greater than or equal to the WCET of the first task chain.
[0021] That is to say, by designing the target time point to include only one time point, the execution duration of the second task chain can be fixed and have only one value (i.e., the preset threshold), thereby achieving precise control of the end-to-end delay of the second task chain, avoiding excessive delay jitter of the second task chain and affecting the normal operation of the system, and facilitating the design of other task chains that depend on the second task chain.
[0022] In one possible implementation, the above method also includes: changing the identifier of the data output by the first task in the second task chain from the first identifier to the second identifier; configuring the identifier of the data received by the second task in the second task chain as the second identifier, and configuring the identifier of the data output by the second task in the second task chain as the first identifier.
[0023] In this solution, by modifying the identifier of the output data of the last task in the original task chain and configuring the identifier of the output data of the last task in the new task chain to be the original identifier of the output data of the last task in the original task chain, it can ensure that other task chains that depend on the original task chain can obtain the output data of the new task chain without any changes, thereby reducing the changes to other task chains and ensuring the normal execution of the task chain.
[0024] In a possible implementation, the first task communicates with the second task through a publish-subscribe mechanism, the first task is a publisher of data, and the second task is a subscriber of data.
[0025] In one possible implementation, the above method is applied to an autonomous driving scenario, a robot control scenario, or an industrial control scenario.
[0026] In a possible implementation manner, the execution subject of each task in the multiple tasks is a thread or a process.
[0027] A second aspect of the present application provides a delay jitter control device for a task chain, including: an acquisition module, used to acquire a first task chain and a WCET of the first task chain, the first task chain includes multiple tasks executed in sequence, and the WCET is used to indicate the maximum time required to execute the first task chain; a processing module, used to add a second task after the first task of the first task chain to obtain a second task chain, the first task is the last task in the first task chain, the second task is used to acquire data output by the first task and output the data at a target time point, the duration between the target time point and the time point when the second task chain starts to execute is a preset threshold, and the preset threshold is related to the WCET.
[0028] In a possible implementation, the target time point includes multiple time points, the preset threshold includes multiple thresholds, and the durations between the multiple time points and the time point when the second task chain starts to execute are multiple thresholds respectively; the second task is used to output the data at the most recent time point after the first moment among the multiple time points after obtaining the data output by the first task, and the first moment is the moment when the second task obtains the data output by the first task.
[0029] In a possible implementation manner, the multiple thresholds are all less than or equal to the WCET, and one of the multiple thresholds is equal to the WCET.
[0030] In a possible implementation, the acquisition module is also used to obtain the number of time points included in the target time point and multiple execution times corresponding to the first task chain, and the multiple execution times are obtained by executing the first task chain under different execution situations; the processing module is also used to determine the CDF of the execution time of the first task chain based on the multiple execution times; the processing module is also used to determine the sizes of multiple thresholds corresponding to the multiple time points through algorithm iteration based on the number of time points included in the target time point and the CDF, so as to achieve a preset optimization goal.
[0031] In a possible implementation, the optimization goal includes that the average execution time of the second task chain is minimized, and the average execution time is related to the magnitudes of multiple thresholds and the CDF.
[0032] In a possible implementation, the algorithm includes a particle swarm optimization algorithm, a genetic algorithm, or a simulated annealing algorithm.
[0033] In a possible implementation, the target time point includes only one time point, and the preset threshold is greater than or equal to the WCET.
[0034] In one possible implementation, the processing module is also used to: change the identifier of the data output by the first task in the second task chain from the first identifier to the second identifier; configure the identifier of the data received by the second task in the second task chain as the second identifier; and configure the identifier of the data output by the second task in the second task chain as the first identifier.
[0035] In a possible implementation, the first task communicates with the second task through a publish-subscribe mechanism, the first task is a publisher of data, and the second task is a subscriber of data.
[0036] In one possible implementation, the device is applied to an autonomous driving scenario, a robot control scenario, or an industrial control scenario.
[0037] In a possible implementation manner, the execution subject of each task in the multiple tasks is a thread or a process.
[0038] The third aspect of the present application provides a delay jitter control device for a task chain, which may include a processor, the processor and a memory are coupled, the memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the method of the first aspect or any implementation of the first aspect is implemented. For the steps in each possible implementation of the first aspect executed by the processor, the details can be referred to the first aspect, and will not be repeated here.
[0039] The fourth aspect of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the method of any implementation manner of the first aspect.
[0040] A fifth aspect of the present application provides a circuit system, the circuit system includes a processing circuit, and the processing circuit is configured to execute a method in any implementation manner of the above-mentioned first aspect.
[0041] The sixth aspect of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute a method implemented in any one of the first aspects.
[0042] The seventh aspect of the present application provides a chip system, which includes a processor for supporting an electronic device to implement the functions involved in any implementation of the first aspect, for example, processing the data and / or information involved in the above method. In one possible design, the chip system also includes a memory, which is used to store program instructions and data necessary for the electronic device. The chip system can be composed of chips, or it can include chips and other discrete devices.
[0043] The beneficial effects of the second to seventh aspects mentioned above can be referred to the introduction of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of executing a task chain provided in an embodiment of the present application;
[0045] Figure 2 A schematic diagram of the effect of end-to-end delay jitter of a task chain on the vehicle acceleration process in an autonomous driving scenario provided in an embodiment of the present application;
[0046] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0047] Figure 4 A flowchart of a method for controlling delay jitter of a task chain provided in an embodiment of the present application;
[0048] Figure 5 A schematic diagram of generating a second task chain based on a first task chain provided in an embodiment of the present application;
[0049] Figure 6 A schematic diagram of the execution of a task chain in different situations provided in an embodiment of the present application;
[0050] Figure 7 A schematic diagram of a task chain in an autonomous driving scenario provided by an embodiment of the present application;
[0051] Figure 8 A schematic diagram of a new task chain design process provided in an embodiment of the present application;
[0052] Fig. 9 A schematic diagram of the execution process of a task provided in an embodiment of the present application;
[0053] Fig.10 A schematic diagram of setting a tracking point to read task execution information provided by an embodiment of the present application;
[0054] Fig.11 A schematic diagram of a process for creating a directed acyclic graph describing tasks and dependencies between tasks provided in an embodiment of the present application;
[0055] Fig.12 A schematic diagram comparing the delay of the original task chain and the delay of the new task chain provided in an embodiment of the present application;
[0056] Fig.13 A schematic diagram of the structure of a delay jitter control device for a task chain provided in an embodiment of the present application;
[0057] Fig.14 A schematic diagram of the structure of an execution device provided in an embodiment of the present application;
[0058] Fig.15 A schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0060] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0061] To facilitate understanding, some technical terms involved in the embodiments of the present application are introduced below.
[0062] (1) Mission
[0063] In the embodiments of the present application, a task refers to a section of code or a software function, which is usually the smallest schedulable unit of a system, such as a thread in an operating system.
[0064] (2) Task response time
[0065] Task response time refers to the time it takes for a task to start and end execution.
[0066] (3) Task dependency (Precedence constraint)
[0067] Task dependency means that the execution of one task depends on the execution of another task. Specifically, suppose there are tasks T1 and T2. Task T2 can only be executed after task T1 is completed and generates output data. Then task T2 is said to be dependent on task T1, which is recorded as T1→T2.
[0068] (4) Task Chain
[0069] A task chain is a chain of multiple tasks. Specifically, a task chain is a chain that connects multiple different tasks in series and executes them in a certain order. In a task chain, when the current task is completed, the next task will be automatically triggered for execution, and so on, until all tasks are completed.
[0070] (5) Dispatch period of a chain
[0071] In many control systems (such as autonomous driving and industrial control), task chains are usually triggered periodically, and this triggering period is called the task chain triggering period.
[0072] (6) End-to-end latency of a chain
[0073] The time from the start of execution of the first task in the task chain to the end of execution of the last task is called the end-to-end latency of the task chain, denoted by L. The end-to-end latency of the task chain depends on the scheduling behavior of the system and the task load, and is not a fixed amount. Therefore, there is latency jitter, denoted by J.
[0074] (7) Publish / subscribe (pub / sub) mechanism
[0075] The publish-subscribe mechanism is a message communication mode: the publisher (publish, pub) sends messages and the subscriber (subscribe, sub) receives messages.
[0076] (8) Worst-case Execution Time (WCET)
[0077] WCET is a computer term. Generally speaking, the WCET of a computer task is the maximum length of time required for the task to execute on a specific hardware platform.
[0078] (9) Cumulative Distribution Function (CDF)
[0079] The cumulative distribution function, also called the distribution function, is the integral of the probability density function and can fully describe the probability distribution of a random variable X.
[0080] Since there are execution dependencies between multiple tasks in the task chain, and each task in the task chain is susceptible to changes in system load during execution, resulting in jitter in the task completion time, the end-to-end delay of the entire task chain is prone to large jitter, affecting the performance of the system.
[0081] For example, see Figure 1 , Figure 1 The following is a schematic diagram of the execution of a task chain provided in an embodiment of the present application. Figure 1 As shown, it is assumed that the task chain includes three tasks, namely, task 1 to task 3 (i.e. Figure 1 Task1-Task3 in the task chain). Moreover, the tasks in the task chain are executed in an event-triggered manner, that is, the next task can be scheduled for execution only when the previous task is completed and generates the data required by the next task. This event-triggered task chain execution method will introduce higher end-to-end latency jitter for two reasons: (1) Tasks executed in different task chains may affect each other, causing changes in task response time; (2) The end-to-end latency of the task chain is the superposition of the response times of all tasks in the task chain, which may cause significant changes in the end-to-end latency and cause higher latency jitter. Figure 1 As shown in the figure, in the i-th execution process of the task chain, the response time of tasks 1-3 is relatively small, so the end-to-end delay of the task chain is relatively small; in the j-th execution process of the task chain, the response time of tasks 1-3 is relatively large, so the end-to-end delay of the task chain is relatively large. In this way, the end-to-end delay difference between the i-th execution process and the j-th execution process will be relatively large, resulting in a large jitter in the end-to-end delay of the task chain.
[0082] For example, see Figure 2 , Figure 2 A schematic diagram of the effect of end-to-end delay jitter of a task chain on the vehicle acceleration process in an autonomous driving scenario provided in an embodiment of the present application. Figure 2 As shown, the middle curve is the acceleration behavior expected when designing the vehicle acceleration scenario. When the end-to-end delay jitter (hereinafter referred to as delay jitter) of the task chain controlling vehicle acceleration is a small constant, the acceleration process will quickly converge to the target speed. The curve below shows the scenario when the delay jitter is greater than the preset value and is still a constant. At this time, the vehicle acceleration process has a certain delay deviation compared to the preset process. More seriously, if the delay jitter is sometimes greater than the design value and sometimes less than the design value during the acceleration process, it may cause the vehicle acceleration process to appear "oscillation" as shown in the upper curve, that is, the vehicle sometimes accelerates fast and sometimes slow, causing a significant degradation of system performance (driving experience).
[0083] For another example, in the assembly line operation of industrial control, the operations between different assembly lines can be controlled by different task chains, and different assembly lines may also have execution dependencies. If the end-to-end delay jitter of the task chain that controls a certain assembly line varies greatly, it may cause the speed of the assembly line operation to be sometimes fast and sometimes slow, that is, the speed at which the assembly line processes items is sometimes fast and sometimes slow. In this way, for the next assembly line connected to the current assembly line, since the speed at which the previous assembly line processes items is sometimes fast and sometimes slow, it is difficult for the next assembly line to reasonably arrange its own processing flow according to the previous assembly line, resulting in low overall efficiency of the assembly line.
[0084] Specifically, if the end-to-end delay jitter of the task chain of the previous assembly line varies greatly, it is easy for the next assembly line to be difficult to effectively match the previous assembly line, which in turn affects the coordination between the assembly lines. For example, when the end-to-end delay of the previous assembly line is small, the speed at which the previous assembly line processes items is fast, and the processing efficiency of the next assembly line cannot keep up with the efficiency of the previous assembly line, resulting in a backlog of items processed by the previous assembly line, and further need to set up places or institutions to stockpile items that have been processed by the previous assembly line but have not been processed by the next assembly line in time; for example, when the end-to-end delay of the previous assembly line is large, the speed at which the previous assembly line processes items is slow, and the next assembly line is likely to have no items to process, resulting in a waste of resources.
[0085] In general, for most control systems such as autonomous driving and industrial control, in some application scenarios, the end-to-end delay of the task chain is not the smaller the better. The design goal of the control system is to keep the end-to-end delay of the task chain as close to the design value as possible (that is, to make the delay jitter as small as possible and the end-to-end delay can be stabilized at a set value). Only in this way can the control system work in the expected design behavior as much as possible.
[0086] Based on this, the embodiment of the present application provides a method for controlling the delay jitter of a task chain, by adding a task behind the original task chain, the task reads the data output by the original task chain, and can output the read data at a specific time point, so that the output data of the original task chain can be output at a specific time point. In this way, no matter how long the actual execution time of the original task chain is, it can ensure that the data obtained by executing the original task chain is output at a specific time point, ensure that the end-to-end delay of the new task chain is stable, and avoid excessive delay jitter of the task chain affecting the normal operation of the system.
[0087] For ease of understanding, the device to which the delay jitter control method of the task chain provided in the embodiment of the present application is applied will be introduced below.
[0088] See also Figure 3, Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 3 As shown, the electronic device 101 used in the delay jitter control method of the task chain provided in the embodiment of the present application includes a processor 103, and the processor 103 is coupled to the system bus 105. The processor 103 can be one or more processors, each of which can include one or more processor cores. Display adapter (video adapter) 107, the display adapter can drive the display 109, and the display 109 is coupled to the system bus 105. The system bus 105 is coupled to the input and output (I / O) bus through the bus bridge 111. The I / O interface 115 is coupled to the I / O bus. The I / O interface 115 communicates with a variety of I / O devices, such as input devices 117 (such as: touch screen, etc.), external memory 121, (for example, hard disk, floppy disk, optical disk or USB flash drive), multimedia interface, etc.). Transceiver 123 (can send and / or receive radio communication signals), camera 155 (can capture static and dynamic digital video images) and external USB port 125. Among them, optionally, the interface connected to the I / O interface 115 can be a USB interface.
[0089] The processor 103 may be any conventional processor, including a reduced instruction set computing (RISC) processor, a complex instruction set computing (CISC) processor, or a combination thereof. Alternatively, the processor may be a dedicated device such as an ASIC.
[0090] The electronic device 101 can communicate with the software deployment server 149 through the network interface 129. Exemplarily, the network interface 129 is a hardware network interface, such as a network card. The network 127 can be an external network, such as the Internet, or an internal network, such as Ethernet or a virtual private network (VPN). Optionally, the network 127 can also be a wireless network, such as a WiFi network, a cellular network, etc.
[0091] The hard disk drive interface 131 is coupled to the system bus 105. The hardware drive interface is connected to the hard disk drive 133. The internal memory 135 is coupled to the system bus 105. The data running in the internal memory 135 may include the operating system (OS) 137 of the electronic device 101, the application program 143 and the schedule table.
[0092] The operating system includes a shell 139 and a kernel 141. Shell 139 is an interface between the user and the kernel of the operating system. The shell is the outermost layer of the operating system. The shell manages the interaction between the user and the operating system: waiting for user input, interpreting user input to the operating system, and processing various operating system output results.
[0093] The kernel 141 consists of those parts of the operating system that manage memory, files, peripherals, and system resources. The kernel 141 interacts directly with the hardware. The operating system kernel usually runs processes and provides communication between processes, central processing unit (CPU) time slice management, interrupts, memory management, input / output (IO) management, etc.
[0094] See also Figure 4 , Figure 4 The present invention provides a flowchart of a method for controlling delay jitter of a task chain according to an embodiment of the present invention. Figure 4 As shown, the delay jitter control method of the task chain includes the following steps 401-402.
[0095] Step 401 : obtaining a first task chain and a worst-case execution time WCET of the first task chain. The first task chain includes a plurality of tasks executed sequentially. The WCET is used to indicate a maximum value of the time required to execute the first task chain.
[0096] In this embodiment, the first task chain is the original task chain that needs to control the delay jitter, and is a complete task chain. Specifically, the first task chain includes multiple tasks that are executed in sequence. Optionally, the execution subject of each of the multiple tasks is a thread or a process, that is, each task is actually a piece of code or a software function executed by computer hardware. In addition, there is a task dependency relationship between the multiple tasks, that is, after the previous task is executed and outputs data, the next task can continue to execute based on the data output by the previous one.
[0097] Exemplarily, the method provided in this embodiment can be applied to control scenarios such as autonomous driving scenarios, robot control scenarios, or industrial control scenarios. For example, when the method provided in this embodiment is applied to an autonomous driving scenario, the above-mentioned first task chain can be, for example, a task chain for identifying obstacles in an autonomous driving scenario, or a task chain for determining a driving strategy. For another example, when the method provided in this embodiment is applied to a robot controller scenario, the above-mentioned first task chain can be, for example, a task chain for building a map, or a task chain for performing path planning. For another example, when the method provided in this embodiment is applied to an industrial control scenario, the above-mentioned first task chain can be, for example, a task chain for controlling the operation of a machine claw.
[0098] When the first task chain is obtained, each task in the first task chain can be identified, and then the WCET of the first task chain can be obtained. The WCET of the first task chain is used to indicate the maximum time required to execute the first task chain. Generally speaking, the WCET of the first task chain is related to the running status of each task in the first task chain and the running system of the first task chain. In actual applications, the WCET of the first task chain can be obtained through testing and other methods. This embodiment does not specifically limit the method of obtaining the WCET of the first task chain.
[0099] Step 402, add the second task after the first task of the first task chain to obtain the second task chain, the first task is the last task in the first task chain, the second task is used to obtain the data output by the first task and output the data at the target time point, the duration between the target time point and the time point when the second task chain starts to execute is a preset threshold, and the preset threshold is related to the WCET.
[0100] In this embodiment, after obtaining the first task chain, by adding a second task triggered by an event and time after the first task chain, a second task chain that can be used to implement delay jitter control can be obtained. Specifically, the second task is added after the last task (i.e., the first task) of the first task chain, and the second task can only be started after the first task is completed, that is, the execution of the second task depends on the first task. Moreover, the second task is not executed immediately after the first task is completed, but needs to be executed at the target time point after the first task is completed. Therefore, the conditions for triggering the execution of the second task actually include the conditions on the event dimension and the conditions on the time dimension, that is, the execution of the second task can only be triggered when the conditions on the event dimension and the conditions on the time dimension are met at the same time. Among them, the condition on the event dimension refers to the completion of the first task, and the condition on the time dimension refers to the current arrival of the target time point.
[0101] For the second task added after the first task, the second task does not perform substantial processing on the data output by the first task, but outputs the data obtained from the first task at the target time point (i.e., re-outputs the output data of the original first task chain), thereby ensuring that the time point at which the second task chain outputs data is fixed, i.e., ensuring that the end-to-end delay of the second task chain is fixed.
[0102] During the actual execution of the second task chain, the target time point of the second task output data can be determined based on the time point when the second task chain starts to execute. Specifically, the duration between the target time point and the time point when the second task chain starts to execute is a preset threshold, that is, the second task chain reaches the target time point after a certain duration of execution. In this way, by limiting the duration between the target time point and the time point when the second task chain starts to execute to the preset threshold, it can be ensured that no matter at what time node the second task chain is started to execute, the target time point can be quickly determined. For example, when the second task chain starts to execute, a timer with a timing duration of the preset threshold can be started, so as to determine the target time point based on the timer. In addition, in order to ensure that the execution of the second task can be smoothly triggered under various execution situations of the second task chain, the above-mentioned preset threshold is related to WCET. For example, when the preset threshold is a value, the preset threshold is set to be greater than or equal to WCET.
[0103] For example, see Figure 5 , Figure 5 A schematic diagram of generating a second task chain based on a first task chain is provided in an embodiment of the present application. Figure 5 As shown, the first task chain includes tasks T1, T2 and T3 executed in sequence, wherein task T1 is the first task in the first task chain, and task T3 is the last task in the first task chain, i.e., task T3 is, for example, the first task mentioned above. The second task chain is obtained by adding a task TS after the last task (i.e., task T3) of the first task chain, i.e., task TS is, for example, the second task mentioned above. The second task chain includes T1, T2, T3 and TS executed in sequence. In the second task chain, the input of the newly added task TS is the data output by task T3, and the data output by task TS is still the data received by task TS from task T3.
[0104] In general, compared with the first task chain, the data output by the second task chain does not change. It only controls the time point of the second task chain outputting the data to ensure that the end-to-end delay of the second task chain is stable, so that other task chains that subsequently rely on the output data of the second task chain can clearly know the time point of the second task chain outputting the data, thereby avoiding excessive delay jitter of the second task chain affecting the normal operation of the system.
[0105] In this embodiment, there are multiple ways to determine the target time point for triggering the execution of the second task.
[0106] In a possible implementation, the target time point for triggering the execution of the second task includes multiple time points, and the above-mentioned preset threshold includes multiple thresholds, and the durations between the multiple time points and the time point at which the second task chain starts to execute are multiple thresholds. In other words, the execution of the second task can be triggered at multiple time points, and the duration between each of the multiple time points and the time point at which the second task chain starts to execute is a fixed threshold, and the durations between different time points and the time point at which the second task chain starts to execute are not the same.
[0107] Furthermore, after acquiring the data output by the first task, the second task is used to output the data at a time point closest to the first moment among multiple time points, and the first moment is the moment when the second task acquires the data output by the first task.
[0108] In this way, during the execution of the second task chain, after the first task is executed and the second task obtains the data output by the first task, the second task chooses to output the data at the closest time point to the time when the second task obtains the data. Since the time required for the second task chain to execute is different under different circumstances, by setting multiple time points, the second task chain can output data at one of the multiple time points based on the actual execution situation. In other words, the time point at which the second task chain outputs data will only fall among multiple time points, that is, the possible value of the end-to-end delay of the second task chain is actually multiple thresholds corresponding to multiple time points. Then, during any execution of the second task chain, the end-to-end delay of the second task chain will only be one of the multiple thresholds.
[0109] Optionally, multiple thresholds corresponding to multiple time points are all less than or equal to the WCET of the second task chain, and one of the multiple thresholds is equal to the WCET. In this way, by setting multiple thresholds to be less than or equal to the WCET of the second task chain, the end-to-end delay of the second task chain can be reduced as much as possible, and if one of the multiple thresholds is equal to the WCET, it can be ensured that the second task chain can output data in any execution situation, thereby ensuring the normal execution of the second task chain.
[0110] In this solution, by setting multiple time points at which the last task in the second task chain can output data, the end-to-end delay of the second task chain can be controlled within a limited number of thresholds, thereby supporting a multi-mode task chain working mode, facilitating the design of other task chains that rely on the second task chain, and ensuring that the output of the second task chain can match the various working modes of other task chains that rely on the second task chain. In addition, based on the design of multiple time points, the end-to-end delay of the second task chain can be controlled at multiple reasonable values, avoiding the end-to-end delay of the second task chain always being a large threshold, thereby improving the execution efficiency of the task chain.
[0111] For example, see Figure 6 , Figure 6 A schematic diagram of the execution of a task chain in different situations provided in an embodiment of the present application. Figure 6 In the example, a new task chain (i.e., the second task chain) is formed by adding task TS after the last task of the original task chain (i.e., the first task chain mentioned above). In addition, in the new task chain, there are multiple time points for triggering task TS, namely, time point 1, time point 2, and time point 3, and the durations between time point 1, time point 2, and time point 3 and the time point when the new task chain starts to execute correspond to three different thresholds.
[0112] During the first execution of the new task chain, the time point at which all tasks in the original task chain are completed is before time point 1, so task TS can obtain the data output by the last task in the original task chain before time point 1, and task TS outputs the obtained data at time point 1. In this way, during the first execution of the new task chain, the end-to-end delay of the new task chain is actually delay 1, corresponding to working mode 1.
[0113] During the second execution of the new task chain, the time point at which all tasks in the original task chain are completed is between time point 1 and time point 2, so task TS can obtain the data output by the last task in the original task chain before time point 2, and task TS outputs the obtained data at time point 2. In this way, during the second execution of the new task chain, the end-to-end delay of the new task chain is actually delay 2, corresponding to working mode 2.
[0114] During the third execution of the new task chain, the time point at which all tasks in the original task chain are completed is between time point 2 and time point 3, so task TS can obtain the data output by the last task in the original task chain before time point 3, and task TS outputs the obtained data at time point 3. In this way, during the third execution of the new task chain, the end-to-end delay of the new task chain is actually delay 3, corresponding to working mode 3.
[0115] In this embodiment, there may be multiple ways to determine the multiple time points for triggering the execution of the second task.
[0116] In a possible example, after determining the number of multiple time points that trigger the execution of the second task, multiple time points can be evenly set between the shortest execution time of the first task chain and the WCET of the first task chain. For example, assuming that the shortest execution time of the first task chain is 30 milliseconds (ms), the WCET of the first task chain is 60ms, and the number of time points that trigger the execution of the second task is 3; then, the first time point that triggers the execution of the second task can be set to be the time point corresponding to 40ms after the start of the execution of the second task chain, the second time point that triggers the execution of the second task can be set to be the time point corresponding to 50ms after the start of the execution of the second task chain, and the third time point that triggers the execution of the second task can be set to be the time point corresponding to 60ms after the start of the execution of the second task chain.
[0117] In another possible example, after determining the number of multiple time points that trigger the execution of the second task, the specific values of the multiple time points can be obtained with the goal of minimizing the average execution time of the second task chain, so that when the execution of the second task is triggered based on these multiple time points, the average execution time of the second task chain can be as small as possible.
[0118] For example, in the process of designing multiple time points for triggering the execution of the second task, the number of time points included in the target time point and the multiple execution times corresponding to the first task chain can be obtained first. Among them, the number of time points included in the target time point can be determined according to the first task chain and / or the actual situation of the first task chain, and this embodiment does not specifically limit this. For example, when other task chains that rely on the first task chain support three working modes with different delays, the number of time points included in the target time point can be set to 3, that is, there are 3 time points that can trigger the execution of the second task in the second task chain. In addition, the multiple execution times of the first task chain are obtained by executing the first task chain under different execution conditions. That is, under different execution environments, the first task chain is repeatedly executed multiple times to obtain multiple execution times of the first task chain, so as to know the distribution of the execution time of the first task chain. For example, in an autonomous driving scenario, by repeatedly executing a task chain for identifying the location of an obstacle under different traffic scenarios, multiple execution times of the task chain can be obtained.
[0119] Then, based on the multiple execution times of the first task chain, the CDF of the execution time of the first task chain is determined, that is, the probability of the execution time of the first task chain being distributed at various time points is obtained.
[0120] Based on the number of time points included in the target time point and the CDF, the sizes of multiple thresholds corresponding to the multiple time points are determined through algorithm iteration so that the average execution time of the second task chain is the minimum, wherein the average execution time of the second task chain is related to the sizes of the multiple thresholds and the CDF.
[0121] Specifically, after obtaining the CDF of the first task chain, the distribution of the execution time of the first task chain can be determined, that is, the probability of various execution times appearing in the first task chain. Moreover, for any execution time that appears in the first task chain, the actual execution time of the second task chain will be greater than the execution time that appears in the first task chain, that is, the actual execution time of the second task chain is the execution time corresponding to the most recent time point after the first task chain is executed. In this way, based on the multiple time points that trigger the execution of the second task, the actual execution time of the second task chain when various execution times appear in the first task chain can be determined, and then the probability of various execution times appearing in the execution of the first task chain is multiplied and summed with the actual execution of the second task chain, so as to obtain the average execution time of the second task chain. Simply put, the average execution time of the second task chain refers to the average value of the execution time of the second task chain under multiple execution conditions.
[0122] Optionally, the algorithm for performing iterative solution includes, for example, a particle swarm optimization algorithm, a genetic algorithm, or a simulated annealing algorithm, which is not specifically limited in this embodiment.
[0123] In addition, in addition to minimizing the average execution time of the second task chain as the optimization goal, other optimization goals can also be set, so as to obtain specific values of multiple time points based on the set optimization goals. Specifically, the optimization goal can be implemented in a variety of ways, which can be determined or adjusted according to the actual application scenario, and this embodiment does not specifically limit this.
[0124] In another possible implementation, the target time point includes only one time point, and the duration between the target time point and the time point when the second task chain starts executing is greater than or equal to the WCET of the first task chain, that is, the above-mentioned preset threshold is greater than or equal to the WCET of the first task chain.
[0125] That is to say, by designing the target time point to include only one time point, the execution duration of the second task chain can be fixed and have only one value (i.e., the preset threshold), thereby achieving precise control of the end-to-end delay of the second task chain, avoiding excessive delay jitter of the second task chain and affecting the normal operation of the system, and facilitating the design of other task chains that depend on the second task chain.
[0126] Optionally, in the second task chain, the first task and the second task can communicate through a publish-subscribe mechanism. Furthermore, the first task is the publisher of data, and the second task is the subscriber of data. That is, the second task subscribes to the data published by the first task, and after the first task is executed, it will publish the data obtained after the execution is completed; thus, since the second task subscribes to the data published by the first task, the data published by the first task will be delivered to the second task in a timely manner.
[0127] For example, on the platform where the second task chain runs, such as the Robot Operating System (ROS) platform, a publish-subscribe mechanism can be deployed to complete the communication between tasks through a process specifically used to implement the publish-subscribe mechanism. Specifically, when the first task is executed and the data is published, the process used to implement the publish-subscribe mechanism can pass the data published by the first task to other tasks that have subscribed to the data published by the first task, such as the second task in the second task chain, so as to realize data transmission between tasks.
[0128] When using the publish-subscribe mechanism to implement data transmission between tasks, in order to avoid changes to other tasks that depend on the original first task chain, in this embodiment, the first task and the second task in the second task chain can also be adjusted in configuration, thereby ensuring that other tasks that depend on the original first task chain can obtain the output data of the second task chain without any changes.
[0129] Exemplarily, after obtaining the second task chain, the identifier of the data output by the first task in the second task chain is modified from the first identifier to the second identifier. Generally speaking, for each task in the task chain, in order to facilitate data transfer between tasks, the data output by each task has a unique identifier to indicate which task the currently output data belongs to. In this way, for other tasks that depend on a certain target task, it is only necessary to determine the identifier of the data output by the target task on which it depends to achieve the subscription to the data output by the target task. In this way, by modifying the identifier of the data output by the first task from the original first identifier to the second identifier, the tasks that originally subscribed to the output data of the first task in other task chains can no longer obtain the data output by the first task.
[0130] Then, the identifier of the data received by the second task in the second task chain is configured as the second identifier, and the identifier of the data output by the second task in the second task chain is configured as the first identifier. In this way, after the first task outputs the data, the data output by the first task can be passed to the second task in real time. And, after the second task outputs the data, since the identifier of the data output by the second task is configured as the first identifier used by the output data of the original first task, the data output by the second task will be passed to other tasks in other task chains that have subscribed to the output data of the first task in the original first task chain, thereby ensuring that the task chains can be executed normally.
[0131] In this solution, by modifying the identifier of the output data of the last task in the original task chain and configuring the identifier of the output data of the last task in the new task chain to be the original identifier of the output data of the last task in the original task chain, it can ensure that other task chains that depend on the original task chain can obtain the output data of the new task chain without any changes, thereby reducing the changes to other task chains and ensuring the normal execution of the task chain.
[0132] The above describes the execution flow of the delay jitter control method for the task chain provided in this embodiment. For ease of understanding, the following will describe in detail how to implement the delay jitter control for the task chain with reference to specific examples.
[0133] For example, see Figure 7 , Figure 7 This is a schematic diagram of a task chain in an autonomous driving scenario provided by an embodiment of the present application. Figure 7 As shown, the following will take the autonomous driving scenario as an example to introduce how to adjust the task chain in the autonomous driving scenario to achieve delay jitter control of the task chain.
[0134] exist Figure 7The task chain in the autonomous driving scenario includes the following tasks: data provision task, front data filtering task, rear data filtering task, data fusion task, downsampling task and position estimation task.
[0135] The data provision task is used to provide the raw point cloud data collected by the lidar on the autonomous driving vehicle.
[0136] The front data filtering task is used to obtain the original point cloud data output by the data providing task and filter the original point cloud data collected by the front lidar.
[0137] The rear data filtering task is used to obtain the original point cloud data output by the data providing task and filter the original point cloud data collected by the rear lidar.
[0138] The data fusion task is used to obtain the filtered point cloud data output by the front data filtering task and the rear data filtering task, and to fuse the filtered point cloud data from the front lidar and the filtered point cloud data from the rear lidar.
[0139] The downsampling task is used to obtain the fused point cloud data output by the data fusion task, and downsample the fused point cloud data to obtain downsampled point cloud data.
[0140] The position estimation task is used to obtain the downsampled point cloud data output by the downsampling task, and use the normal distribution transformation algorithm based on the downsampled point cloud data to estimate the position of the autonomous driving vehicle.
[0141] For Figure 7 The original task chain in the autonomous driving scenario shown in Figure 8 Design a new task chain according to the process shown. Figure 8 A schematic diagram of a new task chain design process provided in the embodiment of the present application. Figure 8 As shown, for the original task chain in which the end-to-end delay has large jitter and causes oscillation in the vehicle control process, the following steps can be used to improve it to obtain a new task chain.
[0142] 1. For the original task chain, each task information of the original task chain, the data flow information between tasks and the execution time information of the tasks can be collected.
[0143] 2. Based on the collected original task chain information, create a directed acyclic graph (DAG) that describes the tasks and the dependencies between tasks. The nodes in the DAG represent tasks, and the directed edges in the DAG represent the dependencies between tasks.
[0144] 3. Create a list of the time points required to design a new task chain and the data required for the design time points. The list can record, for example, the end-to-end delay of each execution in the original task chain obtained through tracer analysis, the number of time points required to design the new task chain, and the end-to-end delay requirements of the new task chain entered by the user (for example, the average end-to-end delay of the new task chain must be less than a certain threshold).
[0145] 4. Design the time point for triggering the execution of the last task in the new task chain based on the list created in step 3, and analyze the feasibility of the design based on the designed time point (i.e., whether it meets the user's requirements). If the design is not feasible, output a design feasibility report to indicate the difference between the average end-to-end delay required by the user and the actual average end-to-end delay, so that the user can adjust the number of time points required to be designed.
[0146] 5. When the design is feasible, the original task chain is automatically adjusted based on the designed time point to obtain a new task chain, and then a control system after the task chain is adjusted.
[0147] The key implementation processes in the above steps will be introduced in detail below.
[0148] First, in the process of collecting the original task chain information, common tracing means may be used, such as adding a trace point to the software platform to collect the relevant information of the original task chain.
[0149] For example, see Fig. 9 and Fig.10 , Fig. 9 A schematic diagram of the execution process of a task provided in an embodiment of the present application, Fig.10 A schematic diagram of setting a tracking point to read task execution information provided by an embodiment of the present application. Fig. 9 As shown in , the process of executing a task usually includes reading input data, starting calculation, executing calculation logic, writing output data, and calculating results. Based on this, Fig.10 As shown, multiple tracking points can be added based on the execution characteristics of the task to realize the reading of task execution information. For example, the "data read" tracking point, "data write" tracking point, "computation start" tracking point and "computation end" tracking point are added to obtain information such as the time point of reading input data, the identifier of the read input data, the time point of writing output data, the identifier of the written output data, the time point of starting to execute the calculation and the time point of ending the calculation during the task execution process.
[0150] Secondly, based on the collected original task chain information, the process of creating a DAG can be as follows Fig.11 shown. Fig.11 A schematic diagram of a process for creating a directed acyclic graph describing tasks and dependencies between tasks is provided in an embodiment of the present application.
[0151] like Fig.11 As shown, after collecting all the tracking points designed for the tasks in the original task chain, these tracking points are analyzed to identify all the tasks included in the original task chain. Then, a corresponding node is added to the DAG for each task in the original task chain. In addition, by analyzing the tracking points, the unique data identifier used by each task in the original task chain to send or receive data is identified, that is, the identifier of the data received by each task and the identifier of the data output by each task. For each identifier used to uniquely identify data, the sender task and all the receiving tasks corresponding to the identifier are identified. Finally, the edge from the sender task to the receiving task is drawn in the DAG with the nodes drawn to obtain the final DAG.
[0152] Furthermore, after obtaining the number of time points of the required design and the end-to-end delay of the original task chain at each execution during multiple executions, the design at each time point can be implemented.
[0153] For example, when the end-to-end delay of the original task chain during each execution of multiple executions is obtained, the CDF of the execution time of the original task chain can be obtained, that is, the occurrence probability of various execution times corresponding to the original task chain can be obtained. In addition, assuming that the number of time points to be designed is n, then the goal of designing the time points can be to minimize the average execution time of the new task chain by designing n time points.
[0154] For n time points, assume that the duration between the n time points and the time point when the new task chain starts executing is X1, X2, X3…X respectively. n , the worst-case execution time of the original task chain is L wc And, set X n =L wc , that is, the duration between the last time point among the n time points and the time point when the new task chain starts to execute is the worst-case execution time of the original task chain. In this way, the average execution time of the new task chain can be expressed by the following formula.
[0155]
[0156] Among them, L avg represents the average execution time of the new task chain; CDF(X i ) indicates that the execution time of the original task chain is X iThe distribution probability before the corresponding time point.
[0157] After constructing the above formula for calculating the average execution time of the new task chain, the algorithm can be iterated to determine how to design the duration corresponding to each time point so that the average execution time of the new task chain can be minimized, and finally multiple designed time points can be obtained.
[0158] For example, see Fig.12 , Fig.12 A schematic diagram comparing the latency of the original task chain and the latency of the new task chain provided in an embodiment of the present application.
[0159] Fig.12 (a) in FIG. 1 shows the distribution of various end-to-end delays of the original task chain during the test. It can be seen that the end-to-end delay distribution of the original task chain is very distributed, which means that the delay jitter is very large.
[0160] Fig.12 (b) in the figure shows the distribution of the end-to-end delay during the test for a new task chain with a designed time point. It can be seen that when only one time point is designed to trigger the execution of the last task for the new task chain, the end-to-end delay of the new task chain is only distributed at the designed time point.
[0161] Fig.12 (c) in FIG. 5 shows the distribution of the end-to-end delay of a new task chain designed at three time points during the test, and the three time points are evenly distributed.
[0162] Fig.12 (d) in FIG. 5 shows the distribution of the end-to-end delay of a new task chain designed at three time points during the test, and the design of the three time points can minimize the average end-to-end delay of the new task chain.
[0163] It can be seen that based on Fig.12 (c) and Fig.12 (d) in the figure can control the end-to-end delay of the new task chain within a limited number of three possible values, thus achieving precise control of the end-to-end delay jitter.
[0164] The method provided in the embodiment of the present application is described in detail above. Next, the device provided in the embodiment of the present application for executing the above method will be introduced.
[0165] See also Fig.13 , Fig.13 The structure diagram of a delay jitter control device for a task chain provided in an embodiment of the present application is shown in FIG. Fig.13As shown, the delay jitter control device of the task chain includes: an acquisition module 1301, used to obtain a first task chain and a WCET of the first task chain, the first task chain includes a plurality of tasks executed in sequence, and the WCET is used to indicate the maximum time required to execute the first task chain; a processing module 1302, used to add a second task after the first task of the first task chain to obtain a second task chain, the first task is the last task in the first task chain, the second task is used to obtain data output by the first task and output the data at a target time point, the duration between the target time point and the time point when the second task chain starts to execute is a preset threshold, and the preset threshold is related to the WCET.
[0166] In a possible implementation, the target time point includes multiple time points, the preset threshold includes multiple thresholds, and the durations between the multiple time points and the time point when the second task chain starts to execute are multiple thresholds respectively; the second task is used to output the data at the most recent time point after the first moment among the multiple time points after obtaining the data output by the first task, and the first moment is the moment when the second task obtains the data output by the first task.
[0167] In a possible implementation manner, the multiple thresholds are all less than or equal to the WCET, and one of the multiple thresholds is equal to the WCET.
[0168] In one possible implementation, the acquisition module 1301 is also used to obtain the number of time points included in the target time point and multiple execution times corresponding to the first task chain, where the multiple execution times are obtained by executing the first task chain under different execution conditions; the processing module 1302 is also used to determine the CDF of the execution time of the first task chain based on the multiple execution times; the processing module 1302 is also used to determine the sizes of multiple thresholds corresponding to the multiple time points through algorithm iteration based on the number of time points included in the target time point and the CDF, so as to achieve a preset optimization goal.
[0169] In a possible implementation, the optimization goal includes that the average execution time of the second task chain is minimized, and the average execution time is related to the magnitudes of multiple thresholds and the CDF.
[0170] In a possible implementation, the algorithm includes a particle swarm optimization algorithm, a genetic algorithm, or a simulated annealing algorithm.
[0171] In a possible implementation, the target time point includes only one time point, and the preset threshold is greater than or equal to the WCET.
[0172] In one possible implementation, the processing module 1302 is also used to: change the identifier of the data output by the first task in the second task chain from the first identifier to the second identifier; configure the identifier of the data received by the second task in the second task chain as the second identifier; and configure the identifier of the data output by the second task in the second task chain as the first identifier.
[0173] In a possible implementation, the first task communicates with the second task through a publish-subscribe mechanism, the first task is a publisher of data, and the second task is a subscriber of data.
[0174] In one possible implementation, the device is applied to an autonomous driving scenario, a robot control scenario, or an industrial control scenario.
[0175] In a possible implementation manner, the execution subject of each task in the multiple tasks is a thread or a process.
[0176] See also Fig.14 , Fig.14 This is a schematic diagram of the structure of an execution device provided in an embodiment of the present application. The execution device 1400 can be specifically a mobile phone, a tablet, a laptop, a smart wearable device, a server, etc., which is not limited here. Specifically, the execution device 1400 includes: a receiver 1401, a transmitter 1402, a processor 1403 and a memory 1404 (wherein the number of processors 1403 in the execution device 1400 can be one or more, Fig.14 In the example of FIG. 1403 , the processor 1403 may include an application processor 14031 and a communication processor 14032. In some embodiments of the present application, the receiver 1401, the transmitter 1402, the processor 1403 and the memory 1404 may be connected via a bus or other means.
[0177] The memory 1404 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1403. A portion of the memory 1404 may also include a non-volatile random access memory (NVRAM). The memory 1404 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
[0178] The processor 1403 controls the operation of the execution device. In a specific application, the various components of the execution device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are referred to as bus systems in the figure.
[0179] The method disclosed in the above embodiment of the present application can be applied to the processor 1403, or implemented by the processor 1403. The processor 1403 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 1403 or an instruction in the form of software. The above processor 1403 can be a general-purpose processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0180] The processor 1403 can implement or execute the methods, steps and logic diagrams disclosed in the embodiments of the present application. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1404, and the processor 1403 reads the information in the memory 1404 and completes the steps of the above method in combination with its hardware.
[0181] The receiver 1401 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device. The transmitter 1402 can be used to output digital or character information through the first interface; the transmitter 1402 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1402 can also include a display device such as a display screen.
[0182] The electronic device provided in the embodiment of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit, etc. The processing unit may execute the computer execution instructions stored in the storage unit so that the chip in the execution device executes the method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit may also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
[0183] See also Fig.15 , Fig.15 This is a schematic diagram of a computer-readable storage medium provided in an embodiment of the present application. The present application also provides a computer-readable storage medium. In some embodiments, the above Figure 4 The disclosed methods may be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of manufacture.
[0184] Fig.15 Schematically illustrates a conceptual partial view of an example computer-readable storage medium including a computer program for executing a computer process on a computing device, arranged in accordance with at least some embodiments presented herein.
[0185] In one embodiment, computer readable storage medium 1500 is provided using signal bearing medium 1501. Signal bearing medium 1501 may include one or more program instructions 1502, which when executed by one or more processors may provide the above-mentioned Figure 4 Describes the functionality or part of the functionality.
[0186] In some examples, the signal bearing medium 1501 may include a computer readable medium 1503 such as, but not limited to, a hard drive, a compact disk (CD), a digital video disk (DVD), a digital tape, a memory, a ROM or RAM, and the like.
[0187] In some embodiments, the signal bearing medium 1501 may include a computer recordable medium 1504, such as, but not limited to, a memory, a read / write (R / W) CD, a R / W DVD, etc. In some embodiments, the signal bearing medium 1501 may include a communication medium 1505, such as, but not limited to, a digital and / or analog communication medium (e.g., a fiber optic cable, a waveguide, a wired communication link, a wireless communication link, etc.). Thus, for example, the signal bearing medium 1501 may be communicated by a wireless form of the communication medium 1505 (e.g., a wireless communication medium that complies with the IEEE 802.X standard or other transmission protocol).
[0188] The one or more program instructions 1502 may be, for example, computer executable instructions or logic implementation instructions. In some examples, the computing device of the computing device may be configured to provide various operations, functions, or actions in response to the program instructions 1502 communicated to the computing device via one or more of the computer readable medium 1503, the computer recordable medium 1504, and / or the communication medium 1505.
[0189] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0190] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the method of each embodiment of the present application.
[0191] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0192] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device or data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that contains one or more available media integration. Available media can be magnetic media, (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., solid-state hard disk (SSD)), etc.
Claims
1. A method for controlling delay jitter of a task chain, characterized in that: include: Obtaining a first task chain and a worst-case execution time WCET of the first task chain, wherein the first task chain includes a plurality of tasks executed sequentially, and the WCET is used to indicate a maximum value of a time required to execute the first task chain; A second task is added after the first task of the first task chain to obtain a second task chain, where the first task is the last task in the first task chain, and the second task is used to obtain data output by the first task and output the data at a target time point, and the duration between the target time point and the time point when the second task chain starts to execute is a preset threshold, and the preset threshold is related to the WCET.
2. The method according to claim 1, characterized in that The target time point includes multiple time points, the preset threshold includes multiple thresholds, and the durations between the multiple time points and the time point when the second task chain starts to execute are the multiple thresholds respectively; The second task is used to output the data output by the first task at a most recent time point after a first moment among the multiple time points after obtaining the data output by the first task. The first moment is the moment when the second task obtains the data output by the first task.
3. The method according to claim 2, characterized in that The multiple thresholds are all less than or equal to the WCET, and one of the multiple thresholds is equal to the WCET.
4. The method according to claim 3, characterized in that The method further comprises: Acquire the number of time points included in the target time point and multiple execution times corresponding to the first task chain, where the multiple execution times are obtained by executing the first task chain under different execution conditions; Based on the multiple execution times, determine a cumulative distribution function CDF of the execution time of the first task chain; Based on the number of time points included in the target time point and the CDF, the sizes of the multiple thresholds corresponding to the multiple time points are determined through algorithm iteration to achieve a preset optimization goal.
5. The method according to claim 4, characterized in that The optimization goal includes that the average execution time of the second task chain is minimized, and the average execution time is related to the sizes of the multiple thresholds and the CDF.
6. The method according to claim 1, characterized in that The target time point includes only one time point, and the preset threshold is greater than or equal to the WCET.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Modify the identifier of the data output by the first task in the second task chain from a first identifier to a second identifier; The identifier of the data received by the second task in the second task chain is configured as the second identifier, and the identifier of the data output by the second task in the second task chain is configured as the first identifier.
8. The method according to any one of claims 1 to 7, characterized in that: The first task and the second task communicate with each other through a publish-subscribe mechanism, the first task is a publisher of the data, and the second task is a subscriber of the data.
9. The method according to any one of claims 1 to 8, characterized in that: The method is applied to autonomous driving scenarios, robot control scenarios or industrial control scenarios.
10. The method according to any one of claims 1 to 9, characterized in that: The execution subject of each task in the multiple tasks is a thread or a process.
11. A delay jitter control device for a task chain, characterized in that: include: an acquisition module, configured to acquire a first task chain and a WCET of the first task chain, wherein the first task chain includes a plurality of tasks executed in sequence, and the WCET is used to indicate a maximum value of a time required to execute the first task chain; A processing module is used to add a second task after the first task of the first task chain to obtain a second task chain, wherein the first task is the last task in the first task chain, and the second task is used to obtain data output by the first task and output the data at a target time point, and the duration between the target time point and the time point when the second task chain starts to execute is a preset threshold, and the preset threshold is related to the WCET.
12. The device according to claim 11, characterized in that The target time point includes multiple time points, the preset threshold includes multiple thresholds, and the durations between the multiple time points and the time point when the second task chain starts to execute are the multiple thresholds respectively; The second task is used to output the data output by the first task at a most recent time point after a first moment among the multiple time points after obtaining the data output by the first task. The first moment is the moment when the second task obtains the data output by the first task.
13. The device according to claim 12, characterized in that The multiple thresholds are all less than or equal to the WCET, and one of the multiple thresholds is equal to the WCET.
14. The device according to claim 13, characterized in that The acquisition module is further used to acquire the number of time points included in the target time point and multiple execution times corresponding to the first task chain, where the multiple execution times are obtained by executing the first task chain under different execution conditions; The processing module is further configured to determine a CDF of the execution time of the first task chain based on the multiple execution times; The processing module is further used to determine the sizes of the multiple thresholds corresponding to the multiple time points through algorithm iteration based on the number of time points included in the target time point and the CDF, so as to achieve a preset optimization goal.
15. The device according to claim 14, characterized in that The optimization goal includes that the average execution time of the second task chain is minimized, and the average execution time is related to the sizes of the multiple thresholds and the CDF.
16. The device according to claim 11, characterized in that The target time point includes only one time point, and the preset threshold is greater than or equal to the WCET.
17. The device according to any one of claims 11 to 16, characterized in that: The processing module is further used for: Modify the identifier of the data output by the first task in the second task chain from a first identifier to a second identifier; The identifier of the data received by the second task in the second task chain is configured as the second identifier, and the identifier of the data output by the second task in the second task chain is configured as the first identifier.
18. The device according to any one of claims 11 to 17, characterized in that: The first task and the second task communicate with each other through a publish-subscribe mechanism, the first task is a publisher of the data, and the second task is a subscriber of the data.
19. The device according to any one of claims 11 to 18, characterized in that: The device is applied to an autonomous driving scenario, a robot control scenario or an industrial control scenario.
20. The device according to any one of claims 11 to 19, characterized in that: The execution subject of each task in the multiple tasks is a thread or a process.
21. A delay jitter control device for a task chain, characterized in that: The device comprises a memory and a processor; the memory stores codes, the processor is configured to execute the codes, and when the codes are executed, the device executes the method according to any one of claims 1 to 10.
22. A computer storage medium, characterized in that The computer storage medium stores instructions, which, when executed by a computer, cause the computer to implement the method of any one of claims 1 to 10.