CN118672743A - Deterministic task scheduling method, system and readable storage medium - Google Patents
Deterministic task scheduling method, system and readable storage medium Download PDFInfo
- Publication number
- CN118672743A CN118672743A CN202410356003.2A CN202410356003A CN118672743A CN 118672743 A CN118672743 A CN 118672743A CN 202410356003 A CN202410356003 A CN 202410356003A CN 118672743 A CN118672743 A CN 118672743A
- Authority
- CN
- China
- Prior art keywords
- task
- scheduling
- processor
- time
- tasks
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 61
- 230000003068 static effect Effects 0.000 claims abstract description 105
- 238000004891 communication Methods 0.000 claims abstract description 26
- 230000008569 process Effects 0.000 claims abstract description 22
- 238000004590 computer program Methods 0.000 claims description 13
- 238000012545 processing Methods 0.000 claims description 4
- 238000006243 chemical reaction Methods 0.000 claims description 3
- 230000002618 waking effect Effects 0.000 abstract 1
- 230000006870 function Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 230000002159 abnormal effect Effects 0.000 description 5
- 230000004044 response Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000004043 responsiveness Effects 0.000 description 2
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 1
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000002068 genetic effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 238000002922 simulated annealing Methods 0.000 description 1
- 238000013517 stratification Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Multi Processors (AREA)
Abstract
本发明提供了一种确定性任务调度方法、系统及可读存储介质,包括获取处理器信息和任务信息,所述任务信息至少包括任务周期、任务间依赖度、任务间通信极限值和任务最坏执行时间;基于所述处理器信息和所述任务信息,按照编排算法对多个任务进行静态编排,得到静态编排结果,基于所述静态编排结果获取对应所述多个任务的标准运行起始时间;基于所述静态编排结果、所述标准运行起始时间、所述统一时间基准点和所述任务周期,定时唤醒调度多个处理器处理对应的任务。本发明可以解决传统任务调度方法不确定性的问题,对于实时系统的性能和可靠性具有积极意义。
The present invention provides a deterministic task scheduling method, system and readable storage medium, including obtaining processor information and task information, wherein the task information at least includes task cycle, inter-task dependency, inter-task communication limit value and task worst execution time; based on the processor information and the task information, statically scheduling multiple tasks according to the scheduling algorithm to obtain static scheduling results, and obtaining standard running start times corresponding to the multiple tasks based on the static scheduling results; based on the static scheduling results, the standard running start time, the unified time reference point and the task cycle, regularly waking up and scheduling multiple processors to process corresponding tasks. The present invention can solve the problem of uncertainty in traditional task scheduling methods, and has positive significance for the performance and reliability of real-time systems.
Description
技术领域Technical Field
本发明涉及任务调度技术领域,尤其涉及一种确定性任务调度方法、系统及可读存储介质。The present invention relates to the technical field of task scheduling, and in particular to a deterministic task scheduling method, system and readable storage medium.
背景技术Background Art
任务调度是指系统为了自动完成特定任务,在约定的特定时刻去执行任务的过程,有了任务调度即可解放更多的人力由系统自动去执行任务,节省人力。Task scheduling refers to the process in which the system executes tasks at a specific agreed time in order to automatically complete specific tasks. Task scheduling can free up more manpower and allow the system to automatically execute tasks, saving manpower.
在实时系统中,任务的调度对于系统的可靠性和响应性具有至关重要的作用,不同的任务调度策略会相应地影响任务的性能和可靠性。传统的任务调度方法往往存在一定的不确定性,例如无法保证任务的执行时间,会导致系统的稳定性和响应性受到影响。In real-time systems, task scheduling plays a vital role in the reliability and responsiveness of the system. Different task scheduling strategies will affect the performance and reliability of tasks accordingly. Traditional task scheduling methods often have certain uncertainties. For example, the execution time of tasks cannot be guaranteed, which will affect the stability and responsiveness of the system.
发明内容Summary of the invention
针对上述技术问题,本发明提供了一种确定性任务调度方法、系统及可读存储介质,可以解决传统任务调度方法不确定性的问题。In response to the above technical problems, the present invention provides a deterministic task scheduling method, system and readable storage medium, which can solve the problem of uncertainty in traditional task scheduling methods.
本发明第一方面提供一种确定性任务调度方法,包括:A first aspect of the present invention provides a deterministic task scheduling method, comprising:
获取处理器信息和任务信息,所述任务信息至少包括任务周期、任务间依赖度、任务间通信极限值和任务最坏执行时间;Acquire processor information and task information, wherein the task information at least includes task cycle, inter-task dependency, inter-task communication limit value and task worst execution time;
基于所述处理器信息和所述任务信息,按照编排算法对多个任务进行静态编排,得到静态编排结果,基于所述静态编排结果获取对应所述多个任务的标准运行起始时间,所述静态编排结果至少包括任务运行起始时间,所述标准运行起始时间是所述多个任务基于统一时间基准点的任务运行起始时间;Based on the processor information and the task information, statically schedule the multiple tasks according to the scheduling algorithm to obtain static scheduling results, and obtain standard running start times corresponding to the multiple tasks based on the static scheduling results, wherein the static scheduling results at least include task running start times, and the standard running start times are task running start times of the multiple tasks based on a unified time reference point;
基于所述静态编排结果、所述标准运行起始时间、所述统一时间基准点和所述任务周期,定时唤醒调度多个处理器处理对应的任务。Based on the static scheduling result, the standard running start time, the unified time reference point and the task cycle, multiple processors are regularly woken up and scheduled to process corresponding tasks.
作为一种可选的实施方式,所述任务间依赖度为任务间的运行依赖程度;和/或所述任务间通信极限值为任务间数据通信所需要的最大时间;和/或所述任务最坏执行时间为在可运行状况下能够执行任务的最长时间。As an optional implementation, the inter-task dependency is the degree of operational dependency between tasks; and/or the inter-task communication limit is the maximum time required for inter-task data communication; and/or the worst task execution time is the longest time that the task can be executed under an operational condition.
作为一种可选的实施方式,所述基于所述处理器信息和所述任务信息,按照编排算法对多个任务进行静态编排,得到静态编排结果,包括:As an optional implementation manner, the statically scheduling the multiple tasks according to the scheduling algorithm based on the processor information and the task information to obtain the static scheduling result includes:
基于所述处理器信息确定各处理器的核心数;Determine the number of cores of each processor based on the processor information;
基于所述任务间依赖度和所述任务间通信极限值确定任务链路最小时延;Determine the minimum delay of the task link based on the inter-task dependency and the inter-task communication limit value;
基于所述任务周期和所述任务最坏执行时间确定CPU最大负载;Determine the maximum CPU load based on the task cycle and the worst execution time of the task;
基于所述处理器信息和所述CPU最大负载确定所述任务运行起始时间,所述任务运行起始时间至少用于确定处理器负载均衡;Determine the task running start time based on the processor information and the CPU maximum load, wherein the task running start time is at least used to determine processor load balancing;
当任务链路时延最小且处理器负载均衡时,基于各处理器的核心数对各处理器对应的任务进行静态编排,获得静态编排表。When the task link delay is minimal and the processor load is balanced, the tasks corresponding to each processor are statically scheduled based on the core number of each processor to obtain a static scheduling table.
作为一种可选的实施方式,基于静态编排结果还可以配置对应各任务的CPU号,以进行任务绑核。As an optional implementation, the CPU number corresponding to each task may also be configured based on the static orchestration result to perform task core binding.
作为一种可选的实施方式,所述确定性任务调度方法还包括当存在至少一个任务出现运行时长超过对应的任务最坏执行时间时,动态调低所述任务在静态编排结果中的优先级顺序,优先调度所述优先级高的任务。As an optional implementation, the deterministic task scheduling method further includes dynamically lowering the priority order of the task in the static scheduling result and giving priority to scheduling the task with a high priority when there is at least one task whose running time exceeds the corresponding task worst execution time.
本发明第二方面提供一种确定性任务调度方法,应用在多处理器之间,包括:A second aspect of the present invention provides a deterministic task scheduling method, which is applied between multiple processors, comprising:
配置各处理器之间采用主从模式且通信,以及各处理器中分别具有对应的主调度Server或从调度Server;Configure the processors to communicate in master-slave mode, and each processor has a corresponding master scheduling server or slave scheduling server;
配置处理器内部采用Server/Client模式且通信,以及处理器内部具有调度Server和调度Client,所述调度Client集成有静态编排结果;The processor is configured to adopt the Server/Client mode and communicate internally, and the processor has a scheduling Server and a scheduling Client internally, and the scheduling Client integrates the static orchestration results;
其中,所述静态编排结果根据处理器信息、任务信息按照编排算法对多个任务进行静态编排生成,所述任务信息包括任务周期、任务间依赖度、任务间通信极限值和任务最坏执行时间,且基于所述静态编排结果获取对应多个任务的标准运行起始时间,所述标准运行起始时间是所述多个任务基于统一时间基准点的任务运行起始时间;The static scheduling result is generated by statically scheduling multiple tasks according to the processor information and the task information according to the scheduling algorithm, wherein the task information includes the task cycle, the inter-task dependency, the inter-task communication limit value and the worst task execution time, and based on the static scheduling result, the standard running start time corresponding to the multiple tasks is obtained, and the standard running start time is the task running start time of the multiple tasks based on a unified time reference point;
主调度Server计算统一时间基准点,并同步给所有从调度Server;The master scheduling server calculates a unified time reference point and synchronizes it to all slave scheduling servers;
从调度Server将所述统一时间基准点同步给所有调度Client;The scheduling server synchronizes the unified time reference point to all scheduling clients;
所述调度Client基于所述静态编排结果、所述标准运行起始时间、所述统一时间基准点和所述任务周期,定时唤醒调度多个处理器处理对应任务。The scheduling Client periodically wakes up and schedules multiple processors to process corresponding tasks based on the static scheduling result, the standard running start time, the unified time reference point and the task cycle.
作为一种可选的实施方式,所述静态编排结果为静态编排表;As an optional implementation, the static arrangement result is a static arrangement table;
所述静态编排表能够对应生成包含任务CPU号、任务周期、任务最坏执行时间和标准运行起始时间的配置文件;The static scheduling table can generate a configuration file including the task CPU number, task cycle, task worst execution time and standard running start time;
定时唤醒调度多个处理器处理对应任务时,按照预设调度规则定时唤醒调度多个处理器处理对应任务。When multiple processors are woken up and scheduled to process corresponding tasks at a scheduled time, multiple processors are woken up and scheduled to process corresponding tasks at a scheduled time according to a preset scheduling rule.
本发明第三方面提供一种确定性任务调度系统,包括:A third aspect of the present invention provides a deterministic task scheduling system, comprising:
获取单元,至少用于获取处理器信息和任务信息,所述任务信息至少包括任务周期、任务间依赖度、任务间通信极限值和任务最坏执行时间;An acquisition unit, at least used to acquire processor information and task information, wherein the task information at least includes a task cycle, inter-task dependency, an inter-task communication limit value, and a worst-case execution time of a task;
编排单元,至少用于基于所述处理器信息和所述任务信息,按照编排算法对多个任务进行静态编排,得到静态编排结果,基于所述静态编排结果获取对应所述多个任务的标准运行起始时间,所述静态编排结果至少包括任务运行起始时间,所述标准运行起始时间是所述多个任务基于统一时间基准点的任务运行起始时间;a scheduling unit, at least configured to perform static scheduling on the plurality of tasks according to a scheduling algorithm based on the processor information and the task information to obtain a static scheduling result, and to obtain standard running start times corresponding to the plurality of tasks based on the static scheduling result, wherein the static scheduling result at least includes a task running start time, and the standard running start time is the task running start time of the plurality of tasks based on a unified time reference point;
调度单元,至少用于基于所述静态编排结果、所述标准运行起始时间、所述统一时间基准点和所述任务周期,定时唤醒调度多个处理器处理对应的任务。The scheduling unit is at least used to regularly wake up and schedule multiple processors to process corresponding tasks based on the static scheduling result, the standard operation start time, the unified time reference point and the task cycle.
本发明第四方面提供一种确定性任务调度系统,应用在多处理器之间,包括:A fourth aspect of the present invention provides a deterministic task scheduling system, which is applied between multiple processors and includes:
处理器间配置单元,至少用于配置各处理器之间采用主从模式且通信,以及各处理器中分别具有对应的主调度Server或从调度Serve;The inter-processor configuration unit is at least used to configure the processors to adopt a master-slave mode and communicate with each other, and each processor has a corresponding master scheduling Server or slave scheduling Server;
处理器内配置单元,至少用于配置处理器内部采用Server/Client模式且通信,以及处理器内部具有调度Server和调度Client,所述调度Client集成有静态编排结果;The processor configuration unit is at least used to configure the processor to adopt the Server/Client mode and communicate, and the processor has a scheduling Server and a scheduling Client, and the scheduling Client integrates the static orchestration result;
静态编排单元,至少用于生成所述处理器内配置单元需要的静态编排结果,所述静态编排结果根据处理器信息、任务信息按照编排算法对多个任务进行静态编排生成,所述任务信息包括任务周期、任务间依赖度、任务间通信极限值和任务最坏执行时间,且基于所述静态编排结果获取对应多个任务的标准运行起始时间,所述标准运行起始时间是所述多个任务基于统一时间基准点的任务运行起始时间;A static scheduling unit, at least used to generate a static scheduling result required by the configuration unit in the processor, wherein the static scheduling result is generated by statically scheduling multiple tasks according to the processor information and the task information in accordance with the scheduling algorithm, wherein the task information includes a task cycle, a dependency between tasks, a communication limit value between tasks, and a worst-case execution time of tasks, and based on the static scheduling result, a standard running start time corresponding to the multiple tasks is obtained, wherein the standard running start time is the task running start time of the multiple tasks based on a unified time reference point;
时间同步单元,至少用于主调度Server计算统一时间基准点,并同步给所有从调度Server;The time synchronization unit is used at least by the master scheduling server to calculate a unified time reference point and synchronize it to all slave scheduling servers;
时间换算单元,至少用于从调度Server将所述统一时间基准点同步给所有调度Client;A time conversion unit, at least used to synchronize the unified time reference point from the scheduling server to all scheduling clients;
调度唤醒单元,至少用于所述调度Client基于所述静态编排结果、所述标准运行起始时间、所述统一时间基准点和所述任务周期,定时唤醒调度多个处理器处理对应任务。The scheduling wake-up unit is at least used for the scheduling Client to regularly wake up and schedule multiple processors to process corresponding tasks based on the static scheduling result, the standard operation start time, the unified time reference point and the task cycle.
本发明第五方面提供一种电子设备,包括:A fifth aspect of the present invention provides an electronic device, comprising:
至少一个处理器;以及与所述处理器通信连接的至少一个存储器,其中:所述存储器存储有可被所述处理器执行的程序指令,所述处理器调用所述程序指令能够执行如本发明第一方面或本发明第二方面所述的确定性任务调度方法。At least one processor; and at least one memory communicatively connected to the processor, wherein: the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the deterministic task scheduling method as described in the first aspect of the present invention or the second aspect of the present invention.
本发明第六方面提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被计算机运行时,执行如本发明第一方面或本发明第二方面所述的确定性任务调度方法。A sixth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computer, the deterministic task scheduling method as described in the first aspect of the present invention or the second aspect of the present invention is executed.
本发明第七方面提供一种计算机程序产品,所述计算机程序产品包括计算机指令,所述计算机指令被处理器执行时实现如本发明第一方面或本发明第二方面所述的确定性任务调度方法。A seventh aspect of the present invention provides a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, they implement the deterministic task scheduling method as described in the first aspect of the present invention or the second aspect of the present invention.
本发明通过获取静态编排结果和标准运行起始时间,保证了任务具有统一时间基准的任务执行时间,可以提高任务调度时的稳定性和可靠性,且本发明可广泛应用于各种实时系统,可以在保证调度确定性的同时,整体任务链路的响应时间也能做到最优,使得系统可以更加快速地做出响应动作。The present invention ensures that the tasks have a unified time base for task execution time by obtaining static scheduling results and standard running start time, which can improve the stability and reliability of task scheduling. The present invention can be widely applied to various real-time systems, and can optimize the response time of the overall task link while ensuring scheduling certainty, so that the system can respond more quickly.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本发明实施例中一种确定性任务调度方法的流程示意图。FIG1 is a schematic flow chart of a deterministic task scheduling method according to an embodiment of the present invention.
图2为本发明实施例中又一种确定性任务调度方法的流程示意图。FIG. 2 is a schematic flow chart of another deterministic task scheduling method according to an embodiment of the present invention.
图3为本发明实施例中一种静态编排表的界面示意图。FIG. 3 is a schematic diagram of an interface of a static scheduling table according to an embodiment of the present invention.
图4为本发明实施例中又一种确定性任务调度方法的流程示意图。FIG. 4 is a schematic flow chart of another deterministic task scheduling method according to an embodiment of the present invention.
图5为本发明实施例中一种确定性任务调度方法的运行原理图。FIG5 is a diagram showing the operating principle of a deterministic task scheduling method according to an embodiment of the present invention.
图6为本发明实施例中一种确定性任务调度系统的框图。FIG6 is a block diagram of a deterministic task scheduling system according to an embodiment of the present invention.
图7为本发明实施例中又一种确定性任务调度系统的框图。FIG. 7 is a block diagram of yet another deterministic task scheduling system according to an embodiment of the present invention.
图8为根据本发明的实施例中的电子设备的结构示意图。FIG. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
具体实施方式DETAILED DESCRIPTION
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
应当理解,本披露的权利要求、说明书及附图中的术语“第一”、“第二”和“第三”等是用于区别不同对象,而不是用于描述特定顺序。本披露的说明书和权利要求书中使用的术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。还应当理解,在此本披露说明书中所使用的术语仅仅是出于描述特定实施例的目的,而并不意在限定本披露。It should be understood that the terms "first", "second", and "third" etc. in the claims, specifications, and drawings of the present disclosure are used to distinguish different objects rather than to describe a specific order. The terms "include" and "comprise" used in the specification and claims of the present disclosure indicate the presence of the described features, wholes, steps, operations, elements, and/or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and/or their collections. It should also be understood that the terms used in this disclosure specification are only for the purpose of describing specific embodiments and are not intended to limit the present disclosure.
以汽车自动驾驶技术为例,随着自动驾驶技术的发展,汽车性能的提升,在为用户带来便利的同时,其对实时性的要求较高,由于在系统中存在大量的异步任务,如果没有合适的调度策略,而导致CPU资源被不良占用,会影响用户的行车安全。Take the automobile autonomous driving technology as an example. With the development of autonomous driving technology and the improvement of automobile performance, while it brings convenience to users, it has higher requirements for real-time performance. Since there are a large number of asynchronous tasks in the system, if there is no appropriate scheduling strategy, the CPU resources will be improperly occupied, which will affect the user's driving safety.
本发明提供的确定性任务调度方法,应用于多处理器实时系统,可以保证各任务按照预定的策略准时执行,消除传统调度方法的不确定性。The deterministic task scheduling method provided by the present invention is applied to a multi-processor real-time system, which can ensure that each task is executed on time according to a predetermined strategy and eliminate the uncertainty of traditional scheduling methods.
请参阅图1-3,本发明提供一种确定性任务调度方法,包括以下步骤:Referring to FIGS. 1-3 , the present invention provides a deterministic task scheduling method, comprising the following steps:
步骤110:获取处理器信息和任务信息。Step 110: Obtain processor information and task information.
具体的,处理器信息具体包括处理器数,即各处理器的核心数,如果数量固定,处理器越多可以编排的方式是更加充裕的,静态编排时需要考虑处理器数并参与编排,理想情况下,处理器大于或等于任务数;Specifically, the processor information includes the number of processors, that is, the number of cores of each processor. If the number is fixed, the more processors there are, the more scheduling methods can be sufficient. The number of processors needs to be considered and involved in the scheduling during static scheduling. Ideally, the number of processors is greater than or equal to the number of tasks;
具体的,任务信息包括任务数、任务周期Period、任务间依赖度、任务间通信极限值和任务最坏执行时间。Specifically, the task information includes the number of tasks, the task period, the inter-task dependency, the inter-task communication limit, and the worst task execution time.
其中,所述任务间依赖度为任务间的运行依赖程度,可以量化表示任务间的运行依赖关系,例如任务A和任务B之间的依赖度为1,任务B和任务C之间的依赖度为0,表示任务A和任务B存在运行依赖关系,而任务B和任务C之间不存在运行依赖关系,在实际的确定性调度环节,会优先考虑存在运行依赖关系的两个任务在时间上连续编排,以达到最小时延的目的;The inter-task dependency is the degree of operational dependency between tasks, which can be used to quantify the operational dependency between tasks. For example, the dependency between task A and task B is 1, and the dependency between task B and task C is 0, indicating that there is an operational dependency between task A and task B, but there is no operational dependency between task B and task C. In the actual deterministic scheduling link, priority will be given to scheduling two tasks with operational dependencies in a continuous manner in time to achieve the purpose of minimum delay.
此外,所述任务间通信极限值又称任务间的数据通信所需要的最大时间(Worst-Case Communication Time,WCCT);所述任务最坏执行时间(Worst-Case Execution Time,WCET)为在可运行状况下能够执行任务的最长时间,其中,根据WCET与Period的比值可大致推算出该任务的最大CPU负载,为后续静态编排时确定处理器负载均衡做参考。In addition, the inter-task communication limit is also called the maximum time required for data communication between tasks (Worst-Case Communication Time, WCCT); the worst-case execution time (Worst-Case Execution Time, WCET) of the task is the longest time that the task can be executed under an operational condition, wherein the maximum CPU load of the task can be roughly calculated based on the ratio of WCET to Period, which serves as a reference for determining processor load balancing during subsequent static scheduling.
步骤S120:基于所述处理器信息和所述任务信息,按照编排算法对多个任务进行静态编排,得到静态编排结果,基于所述静态编排结果获取所述多个任务的标准运行起始时间,所述静态编排结果至少包括任务运行起始时间,所述标准运行起始时间是所述多个任务基于统一时间基准点的任务运行起始时间。Step S120: Based on the processor information and the task information, statically schedule the multiple tasks according to the scheduling algorithm to obtain static scheduling results, and obtain standard running start times of the multiple tasks based on the static scheduling results. The static scheduling results at least include task running start times, and the standard running start time is the task running start time of the multiple tasks based on a unified time reference point.
具体的,所述编排算法可以参考遍历全组合的思想实现,即遍历所有任务在不同CPU及不同起始时间的所有组合情况,得到全局最优解,也可以参考现有的静态编排算法规则实现,如模拟退火算法或遗传算法等,在此不再赘述。Specifically, the scheduling algorithm can be implemented by referring to the idea of traversing all combinations, that is, traversing all combinations of all tasks on different CPUs and different start times to obtain the global optimal solution. It can also be implemented by referring to existing static scheduling algorithm rules, such as simulated annealing algorithm or genetic algorithm, etc., which will not be repeated here.
具体的,所述静态编排结果可以以静态编排表的形式呈现。针对多处理器的静态编排表,是将多个处理器上的多个任务一同进行编排。Specifically, the static scheduling result can be presented in the form of a static scheduling table. The static scheduling table for multiple processors schedules multiple tasks on multiple processors together.
具体的,所述标准运行起始时间简称Eerliest,是通过GPTP将各任务基于统一时间基准点(或称同一个时间基准点)进行调度。由于存在运行依赖关系的两个任务部署在不同处理器上,所以这些任务的唤醒时间点需要基于GPTP下的统一时间基准点T0来计算,这时两个任务之间起始时间的时间差就可以体现出这种运行依赖关系。使用GPTP同步多个处理器上任务的时间的目的是为了保证一个系统内多处理器上的任务都基于统一时间基准点T0。此外,如果有达到本发明目的的其他协议或者方法可以对GPTP进行替换,也不影响本发明所要保护的技术构思。Specifically, the standard operation start time is referred to as Eerliest, and each task is scheduled based on a unified time reference point (or the same time reference point) through GPTP. Since two tasks with operation dependencies are deployed on different processors, the wake-up time points of these tasks need to be calculated based on the unified time reference point T0 under GPTP. At this time, the time difference between the start times of the two tasks can reflect this operation dependency. The purpose of using GPTP to synchronize the time of tasks on multiple processors is to ensure that tasks on multiple processors in a system are based on a unified time reference point T0. In addition, if there are other protocols or methods that achieve the purpose of the present invention, GPTP can be replaced, and the technical concept to be protected by the present invention will not be affected.
如图2所示,本发明一实施例中,针对步骤S200:所述基于所述处理器信息和所述任务信息,按照编排算法对多个任务进行静态编排,得到静态编排结果,包括:As shown in FIG. 2 , in one embodiment of the present invention, with respect to step S200: the static scheduling of multiple tasks according to the scheduling algorithm based on the processor information and the task information to obtain a static scheduling result includes:
步骤S121:基于所述处理器信息确定各处理器的核心数;Step S121: determining the number of cores of each processor based on the processor information;
步骤S122:基于所述任务间依赖度和所述任务间通信极限值确定任务链路最小时延;Step S122: determining a minimum delay of a task link based on the inter-task dependency and the inter-task communication limit value;
步骤S123:基于所述任务周期和所述任务最坏执行时间确定CPU最大负载;Step S123: determining the maximum CPU load based on the task cycle and the worst execution time of the task;
步骤S124:基于所述处理器信息和所述CPU最大负载确定所述任务运行起始时间,所述任务运行起始时间至少用于确定处理器负载均衡;Step S124: determining the task running start time based on the processor information and the CPU maximum load, wherein the task running start time is at least used to determine processor load balancing;
步骤S125:当任务链路时延最小且处理器负载均衡时,基于各处理器的核心数对各处理器对应的任务进行静态编排,获得静态编排表,静态编排表规定了每个任务的CPU号和标准运行起始时间,CPU号跟绑核有关,标准运行起始时间和唤醒时间点(或称调度时间点)有关。Step S125: When the task link delay is minimized and the processor load is balanced, the tasks corresponding to each processor are statically scheduled based on the core number of each processor to obtain a static scheduling table. The static scheduling table specifies the CPU number and standard running start time of each task. The CPU number is related to the bound core, and the standard running start time is related to the wake-up time point (or scheduling time point).
具体的,本发明中静态编排的原则是需要任务整体链路时延最小,以及CPU负载均衡,以保证实时性及可靠性的目的;其中,任务整体链路时延最小,需要要求存在运行依赖关系的两个任务需要在时间上连续编排,任务之间尽量只保留WCCT的时间间隙。而保证CPU负载均衡,需要从以下两个方面考虑:Specifically, the principle of static scheduling in the present invention is to minimize the overall link delay of the task and balance the CPU load to ensure real-time and reliability. Among them, the overall link delay of the task is minimized, and two tasks with running dependencies need to be scheduled continuously in time, and only the WCCT time gap is reserved between tasks as much as possible. To ensure CPU load balance, the following two aspects need to be considered:
第一方面,从CPU核心的维度:各CPU核心上的任务的CPU负载总和需要均衡,即需要将任务均衡地分配到所有CPU;First, from the perspective of CPU cores: the total CPU load of tasks on each CPU core needs to be balanced, that is, tasks need to be evenly distributed to all CPUs;
第二方面,从时间的维度:在任意时刻,处于运行状态的CPU核心数是均衡的,即在任意时刻需要留出更多的CPU资源给到非确定性的任务,防止非确定性任务因为无法及时获得CPU资源导致任务无法继续,从而产生BUG,因此,在时间的维度上需要考虑各任务运行起始时间。Secondly, from the dimension of time: at any time, the number of CPU cores in operation is balanced, that is, more CPU resources need to be reserved for non-deterministic tasks at any time to prevent non-deterministic tasks from being unable to continue due to failure to obtain CPU resources in time, thereby causing BUGs. Therefore, the start time of each task needs to be considered in the dimension of time.
此外,在评价复杂均衡的基础上,可以进行局部寻优算法等实现,在此不再赘述。In addition, based on the evaluation of complex equilibrium, local optimization algorithms and the like can be implemented, which will not be elaborated here.
本发明在考虑如何保证任务链路具有最小时延和以及如何保证CPU负载均衡的问题的基础上,获取到静态编排结果及标准运行起始时间的,且通过将静态编排结构通过可视化的静态编排表的形式呈现出来,保证了任务调度的确定性,特别是非确定任务正常运行。The present invention obtains static scheduling results and standard operation start time based on the consideration of how to ensure that the task link has minimum delay and how to ensure CPU load balancing, and presents the static scheduling structure in the form of a visual static scheduling table to ensure the determinism of task scheduling, especially the normal operation of non-deterministic tasks.
步骤S130:基于所述静态编排结果、所述标准运行起始时间、所述统一时间基准点和所述任务周期,定时唤醒调度多个处理器处理对应的任务。Step S130: based on the static scheduling result, the standard operation start time, the unified time reference point and the task cycle, regularly wake up and schedule multiple processors to process corresponding tasks.
示例性的,基于处理器信息和任务信息获得的静态编排表中包含了与各任务实际运行时间相关的具体信息,如各任务周期,此外,基于静态编排表还可以获取任务运行起始时间和各任务相对于统一时间基准点T0的任务运行起始时间即Eerliest,由于任务的调度具有周期性,则可以按照如下公式计算出该任务的所有唤醒时间点:Ta=T0+N*Period+Earliest,其中N≥0,且N为唤醒次数。Exemplarily, the static scheduling table obtained based on the processor information and the task information includes specific information related to the actual running time of each task, such as each task period. In addition, based on the static scheduling table, the task running start time and the task running start time of each task relative to the unified time reference point T0, i.e., the Eerliest, can also be obtained. Since the scheduling of tasks is periodic, all wake-up time points of the task can be calculated according to the following formula: Ta=T0+N*Period+Earliest, where N≥0, and N is the number of wake-ups.
在此,本发明所提供的确定性调度方法可广泛应用于各种实时系统,可以在保证调度确定性的同时,整体任务链路的响应时间也能做到最优,使得系统可以更加快速地做出响应动作。Here, the deterministic scheduling method provided by the present invention can be widely applied to various real-time systems. While ensuring the scheduling determinism, the response time of the overall task link can also be optimized, so that the system can respond more quickly.
本发明一实施例中,基于所述静态编排结果还可以用于配置对应各任务的CPU号,以进行任务绑核,防止确定性任务收到其他非确定性任务的影响。In one embodiment of the present invention, the static scheduling result can also be used to configure the CPU number corresponding to each task to perform task core binding to prevent deterministic tasks from being affected by other non-deterministic tasks.
一般来说,确定性任务一般是处于用户层的,用户层线程的优先级一般也不被推荐高于内核中的某些特殊线程,如硬中断线程(打上Linux RT补丁后,中断被强制线程化),为了避免类似的更高优先级的线程对确认性任务产生影响,一方面可以将优先级更高的线程的执行时间降到最低(优先级不高的处理可以放在优先级低的线程中运行);另一方面也可以使能对确定性调度任务的绑核策略,将某一个或多个确定性任务独占某一个或某几个CPU核,以此来规避高优先级线程带来的影响。Generally speaking, deterministic tasks are usually at the user level, and the priority of user-level threads is generally not recommended to be higher than certain special threads in the kernel, such as hard interrupt threads (after the Linux RT patch is applied, interrupts are forced to be threaded). In order to avoid the impact of similar higher-priority threads on confirmatory tasks, on the one hand, the execution time of higher-priority threads can be minimized (low-priority processing can be run in low-priority threads); on the other hand, the core binding strategy for deterministic scheduling tasks can be enabled to monopolize one or more deterministic tasks on one or several CPU cores to avoid the impact of high-priority threads.
确定性调度要求确定性任务的最坏情况执行时间是可预测的,但这种情况开发者无法完全进行保证,所以需要针对异常情况做特殊处理,主要包括以下两种异常情况:Deterministic scheduling requires that the worst-case execution time of deterministic tasks is predictable, but developers cannot fully guarantee this, so special handling is required for abnormal situations, mainly including the following two abnormal situations:
第一种异常情况:认为确定性任务之间存在优先级的高低,因此需要给高优先级的任务设置一个相对更高的有调度优先级,当该高优先级任务由于出现异常情况导致运行时间超过了WCET时,此时可能会挤占其他低优先级的确定性任务。此时又分为两种结果,第一种结果是此时仍然有空闲的CPU资源,那么低优先级任务仍然能够抢到CPU资源进行运行,此时影响较小;第二种结果是此时没有空闲的CPU资源,那么就会造成低优先级任务较大的调度延迟。The first abnormal situation: It is believed that there are different priorities among deterministic tasks, so a relatively higher scheduling priority needs to be set for high-priority tasks. When the running time of the high-priority task exceeds the WCET due to an abnormal situation, it may squeeze out other low-priority deterministic tasks. There are two results at this time. The first result is that there are still idle CPU resources at this time, so the low-priority task can still grab the CPU resources to run, and the impact is small at this time; the second result is that there are no idle CPU resources at this time, which will cause a large scheduling delay for the low-priority task.
第二种异常情况:认为所有的确定性任务是平权的,那么这些确定性任务会设置一个初始的较高的调度优先级。The second exception is that all deterministic tasks are considered equal, so these deterministic tasks will be set with an initial higher scheduling priority.
为了解决上述问题,本发明提出当存在至少一个任务出现运行时长超过对应的任务最坏执行时间时,动态调低所述任务在静态编排结果中的优先级顺序,优先调度所述优先级高的任务。In order to solve the above problem, the present invention proposes that when there is at least one task whose running time exceeds the corresponding task worst execution time, the priority order of the task in the static scheduling result is dynamically lowered, and the task with high priority is scheduled first.
具体的,当任务出现运行时长超过对应的任务WCET时,表示该任务出现了异常情况,那么该任务如果继续运行势必会挤占其他确定性任务的运行时间,此时可以使能动态调整任务优先级策略,在该任务运行时间超过任务WCET时,将该任务的优先级调低,使得该任务可以让出CPU资源给其他确定性任务。当CPU资源空闲的时候,被调低优先级的任务仍然能够抢占到CPU资源继续运行完成,若此时抢占到CPU资源继续运行的任务也出现类似情况,可以顺延或告警。Specifically, when the running time of a task exceeds the corresponding task WCET, it means that the task has an abnormal situation. If the task continues to run, it will inevitably occupy the running time of other deterministic tasks. At this time, the task priority strategy can be dynamically adjusted. When the running time of the task exceeds the task WCET, the priority of the task is lowered so that the task can give up CPU resources to other deterministic tasks. When the CPU resources are idle, the task with a lowered priority can still seize the CPU resources to continue to run and complete. If the task that seizes the CPU resources to continue to run at this time also encounters a similar situation, it can be postponed or an alarm can be issued.
本发明所提出的优先级策略是基于实际的确定性任务运行场景提出的,通过优先级分层策略,可以优先保证高优先级任务的CPU资源;通过动态调整任务优先级策略,当单个任务发生异常时,调低该任务的优先级让出CPU资源,防止对其他确定性任务产生影响。The priority strategy proposed in the present invention is proposed based on the actual deterministic task running scenario. Through the priority stratification strategy, the CPU resources of high-priority tasks can be guaranteed first. By dynamically adjusting the task priority strategy, when a single task has an exception, the priority of the task is lowered to give up CPU resources to prevent affecting other deterministic tasks.
为了更好地表达本发明所要保护的技术方案,如图4和图5所示,本发明第二方面提出一种确定性任务调度方法,应用在多处理器之间,主要包括以下步骤:In order to better express the technical solution to be protected by the present invention, as shown in FIG. 4 and FIG. 5 , the second aspect of the present invention proposes a deterministic task scheduling method, which is applied between multiple processors and mainly includes the following steps:
步骤S210:配置各处理器之间采用主从模式且通信,以及各处理器中分别具有对应的主调度Server或从调度Server。Step S210: configure the processors to communicate in master-slave mode, and each processor has a corresponding master scheduling server or slave scheduling server.
步骤S220:配置处理器内部采用Server/Client模式且通信,以及处理器内部具有调度Server和调度Client,所述调度Client集成有静态编排结果。Step S220: The processor is configured to adopt the Server/Client mode and communicate internally, and the processor has a scheduling Server and a scheduling Client internally, and the scheduling Client integrates the static orchestration result.
具体的,所述静态编排结果根据处理器信息、任务信息按照编排算法对多个任务进行静态编排生成,所述任务信息包括任务周期、任务间依赖度、任务间通信极限值和任务最坏执行时间,且基于所述静态编排结果获取对应多个任务的标准运行起始时间,所述标准运行起始时间是所述多个任务基于统一时间基准点的任务运行起始时间。Specifically, the static scheduling result is generated by statically scheduling multiple tasks according to the processor information and the task information according to the scheduling algorithm, the task information includes the task cycle, the dependency between tasks, the communication limit value between tasks and the worst execution time of the task, and based on the static scheduling result, the standard running start time corresponding to the multiple tasks is obtained, and the standard running start time is the task running start time of the multiple tasks based on the unified time reference point.
步骤S230:主调度Server计算统一时间基准点,并同步给所有从调度Server;Step S230: The master scheduling server calculates a unified time reference point and synchronizes it to all slave scheduling servers;
步骤S240:从调度Server将所述统一时间基准点换算成单调时间基准点,并同步给所有调度Client;具体的,同时,为了避免时间回退或者时间跳变带来的影响,实际的调度时钟使用单调时钟。Step S240: The scheduling server converts the unified time reference point into a monotonic time reference point, and synchronizes it to all scheduling clients; specifically, in order to avoid the impact of time rollback or time jump, the actual scheduling clock uses a monotonic clock.
步骤S250:所述调度Client基于所述静态编排结果、所述标准运行起始时间、所述统一时间基准点和所述任务周期,定时唤醒调度多个处理器处理对应任务。Step S250: the scheduling Client periodically wakes up and schedules multiple processors to process corresponding tasks based on the static scheduling result, the standard operation start time, the unified time reference point and the task cycle.
具体的,所述静态编排结果的表现形式至少为静态编排表;静态编排算法的输入的任务信息Peroid和WCET,静态编排算法的输出的任务CPU号和Earliest,这4个参数包含在配置文件里。Specifically, the static scheduling result is expressed in at least a static scheduling table; the input task information Peroid and WCET of the static scheduling algorithm, the output task CPU number and Earliest of the static scheduling algorithm, these four parameters are included in the configuration file.
在步骤S250中,所述调度Client基于所述静态编排结果、所述标准运行起始时间、所述统一时间基准点和所述任务周期,定时唤醒调度多个处理器处理对应任务,包括:In step S250, the scheduling Client periodically wakes up and schedules multiple processors to process corresponding tasks based on the static scheduling result, the standard operation start time, the unified time reference point and the task cycle, including:
步骤S251:定时唤醒调度多个处理器处理对应任务,具体的,预设调度规则参考调度时间点公式:Ta=T0+N*Period+Earliest,所述配置文件用于存放静态编排结果和基于静态编排结果获取的任务CPU号和Earliest。Step S251: Timely wake up and schedule multiple processors to process corresponding tasks. Specifically, the preset scheduling rule refers to the scheduling time point formula: Ta=T0+N*Period+Earliest. The configuration file is used to store the static scheduling results and the task CPU number and Earliest obtained based on the static scheduling results.
具体的,请继续参阅图3和图5,示出了处理器A和处理器B之间的具体的确定性任务调度工作原理图,现进行如下的步骤描述:Specifically, please continue to refer to FIG. 3 and FIG. 5 , which show a specific deterministic task scheduling working principle diagram between processor A and processor B. The following steps are now described:
步骤①,当处理器A和处理器B内部的Client(调度Client)和Server(调度Server)均对应建立通信,且调度Client集成有配置文件,对应步骤S220;Step ①, when the Client (scheduling Client) and Server (scheduling Server) inside processor A and processor B establish communication accordingly, and the scheduling Client is integrated with a configuration file, it corresponds to step S220;
步骤②:处理器A和处理器B之间建立通信,对应步骤S210;Step ②: Establishing communication between processor A and processor B, corresponding to step S210;
步骤③:主调度Server确认T0并广播,计算调度统一时间基准点T0,并同步给所有从调度Server,对应步骤S230;Step 3: The master scheduling server confirms T0 and broadcasts it, calculates the unified scheduling time reference point T0, and synchronizes it to all slave scheduling servers, corresponding to step S230;
步骤④:调度Server将统一时间基准点T0从GPTP时间基准点换算成单调时间基准点,并广播给所有调度Client,对应步骤S240;Step ④: The scheduling server converts the unified time reference point T0 from the GPTP time reference point into a monotonic time reference point, and broadcasts it to all scheduling clients, corresponding to step S240;
步骤⑤:调度Client得到单调时间基准点后,读取配置文件中的Period、Earliest等参数,结合配置文件和统一时间基准点信息,按照调度时间点公式:Ta=T0+N*Period+Earliest定时唤醒调度任务,对应步骤S250,并通过调度Client执行任务编排调度。Step ⑤: After the scheduling Client obtains the monotonic time reference point, it reads the parameters such as Period and Earliest in the configuration file, combines the configuration file and the unified time reference point information, and wakes up the scheduling task regularly according to the scheduling time point formula: Ta=T0+N*Period+Earliest, corresponding to step S250, and executes task scheduling through the scheduling Client.
其中,图3示出了处理器A和处理器B各自的任务号(例如task_a,task_b,task_c,task_d,task_e,task_f,task_g,task_h和task_i,),以处理器B的任务task_e为例,基于调度时间点公式Ta=T0+N*Period+Earliest,其中,N为唤醒次数,计算获得,其在N=0时,表示之前未被唤醒,其第一次被唤醒时机是Ta=T0+N*Period+Earliest=T0+0*20ms+3ms=3ms;N=1时,表示其第二次被唤醒时机是Ta=T0+N*Period+Earliest=T0+2*20ms+3ms=23ms。Among them, Figure 3 shows the task numbers of processor A and processor B respectively (for example, task_a, task_b, task_c, task_d, task_e, task_f, task_g, task_h and task_i). Taking task task_e of processor B as an example, based on the scheduling time point formula Ta=T0+N*Period+Earliest, where N is the number of wake-ups, it is calculated. When N=0, it means that it has not been awakened before, and its first awakening time is Ta=T0+N*Period+Earliest=T0+0*20ms+3ms=3ms; when N=1, it means that its second awakening time is Ta=T0+N*Period+Earliest=T0+2*20ms+3ms=23ms.
在此,通过该方式,可以实现处理器间及处理器内部的任务调度,保证实时系统的性能和可靠性。Here, in this way, task scheduling between processors and within processors can be achieved to ensure the performance and reliability of the real-time system.
如图6所示,本发明第三方面提供一种确定性任务调度系统,包括:As shown in FIG6 , the third aspect of the present invention provides a deterministic task scheduling system, including:
获取单元310,至少用于获取处理器信息和任务信息,所述任务信息至少包括任务周期、任务间依赖度、任务间通信极限值和任务最坏执行时间;The acquisition unit 310 is at least used to acquire processor information and task information, wherein the task information at least includes task cycle, inter-task dependency, inter-task communication limit value and task worst execution time;
编排单元320,至少用于基于所述处理器信息和所述任务信息,按照编排算法对多个任务进行静态编排,得到静态编排结果,基于所述静态编排结果获取对应所述多个任务的标准运行起始时间,所述静态编排结果至少包括任务运行起始时间,所述标准运行起始时间是所述多个任务基于统一时间基准点的任务运行起始时间;The scheduling unit 320 is at least used to perform static scheduling on the multiple tasks according to the scheduling algorithm based on the processor information and the task information to obtain a static scheduling result, and obtain standard running start times corresponding to the multiple tasks based on the static scheduling result, wherein the static scheduling result at least includes a task running start time, and the standard running start time is the task running start time of the multiple tasks based on a unified time reference point;
调度单元330,至少用于基于所述静态编排结果、所述标准运行起始时间、所述统一时间基准点和所述任务周期,定时唤醒调度多个处理器处理对应的任务。The scheduling unit 330 is at least used to regularly wake up and schedule multiple processors to process corresponding tasks based on the static scheduling result, the standard operation start time, the unified time reference point and the task cycle.
如图7所示,本发明第四方面提供一种确定性任务调度系统,应用在多处理器之间,包括:As shown in FIG. 7 , a fourth aspect of the present invention provides a deterministic task scheduling system, which is applied between multiple processors and includes:
处理器间配置单元410,至少用于配置各处理器之间采用主从模式且通信,以及配置各处理器中分别具有对应的主调度Server或从调度Server;The inter-processor configuration unit 410 is at least used to configure the processors to adopt a master-slave mode and communicate with each other, and to configure each processor to have a corresponding master scheduling server or slave scheduling server;
处理器内配置单元420,至少用于配置处理器内部采用Server/Client模式且通信,以及处理器内部具有调度Server和调度Client,所述调度Client集成有静态编排结果;The processor configuration unit 420 is at least used to configure the processor to adopt the Server/Client mode and communicate, and the processor has a scheduling Server and a scheduling Client, and the scheduling Client integrates the static orchestration result;
静态编排单元430,至少用于生成所述处理器内配置单元需要的静态编排结果,所述静态编排结果根据处理器信息、任务信息按照编排算法对多个任务进行静态编排生成,所述任务信息包括任务周期、任务间依赖度、任务间通信极限值和任务最坏执行时间,且基于所述静态编排结果获取对应多个任务的标准运行起始时间,所述标准运行起始时间是所述多个任务基于统一时间基准点的任务运行起始时间;The static scheduling unit 430 is at least used to generate a static scheduling result required by the configuration unit in the processor, wherein the static scheduling result is generated by statically scheduling multiple tasks according to the processor information and the task information according to the scheduling algorithm, wherein the task information includes a task cycle, a task dependency, a task communication limit value, and a task worst execution time, and based on the static scheduling result, a standard running start time corresponding to the multiple tasks is obtained, wherein the standard running start time is the task running start time of the multiple tasks based on a unified time reference point;
时间同步单元440,至少用于主调度Server计算统一时间基准点,并同步给所有从调度Server;The time synchronization unit 440 is at least used for the master scheduling server to calculate a unified time reference point and synchronize it to all slave scheduling servers;
时间换算单元450,至少用于从调度Server将所述统一时间基准点换算成单调时间基准点,并同步给所有调度Client;The time conversion unit 450 is at least used to convert the unified time reference point into a monotonic time reference point from the scheduling server, and synchronize it to all scheduling clients;
调度唤醒单元460,至少用于所述调度Client基于所述静态编排结果、所述标准运行起始时间、所述统一时间基准点和所述任务周期,定时唤醒调度多个处理器处理对应任务。The scheduling wake-up unit 460 is at least used for the scheduling Client to regularly wake up and schedule multiple processors to process corresponding tasks based on the static scheduling result, the standard operation start time, the unified time reference point and the task cycle.
如图8所示,本发明第五方面提供一种电子设备,包括:As shown in FIG8 , the fifth aspect of the present invention provides an electronic device, including:
至少一个处理器;以及与所述处理器通信连接的至少一个存储器,其中:所述存储器存储有可被所述处理器执行的程序指令,所述处理器调用所述程序指令能够执行如上述任一项实施例所述的确定性任务调度方法。At least one processor; and at least one memory communicatively connected to the processor, wherein: the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the deterministic task scheduling method as described in any of the above embodiments.
本发明第六方面提供一种计算机程序产品,所述计算机程序产品包括计算机指令,所述计算机指令被处理器执行时实现如上述任一项实施例所述的确定性任务调度方法。A sixth aspect of the present invention provides a computer program product, which includes computer instructions, and when the computer instructions are executed by a processor, the deterministic task scheduling method as described in any of the above embodiments is implemented.
本发明第七方面提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被计算机运行时,执行如上述任一项实施例所述的确定性任务调度方法。A seventh aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computer, the deterministic task scheduling method as described in any one of the above embodiments is executed.
可以理解,计算机可读存储介质可以包括:能够携带计算机程序的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器 (ROM ,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、以及软件分发介质等。计算机程序包括计算机程序代码。计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。计算机可读存储介质可以包括:能够携带计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、以及软件分发介质等。It can be understood that the computer-readable storage medium may include: any entity or device capable of carrying a computer program, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), and a software distribution medium, etc. The computer program includes a computer program code. The computer program code may be in source code form, object code form, an executable file, or some intermediate form, etc. The computer-readable storage medium may include: any entity or device capable of carrying a computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), and a software distribution medium, etc.
在本发明的某些实施方式中,电子设备可以包括控制器或处理器,控制器是一个单片机芯片,集成了处理器、存储器,通信模块等。处理器可以是指控制器包含的处理器。处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application SpecificIntegrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。In certain embodiments of the present invention, the electronic device may include a controller or a processor, and the controller is a single-chip microcomputer chip that integrates a processor, a memory, a communication module, etc. The processor may refer to a processor included in the controller. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本发明地优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本发明的实施例所属技术领域的技术人员所理解。Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present invention belong.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各实例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410356003.2A CN118672743A (en) | 2024-03-27 | 2024-03-27 | Deterministic task scheduling method, system and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410356003.2A CN118672743A (en) | 2024-03-27 | 2024-03-27 | Deterministic task scheduling method, system and readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118672743A true CN118672743A (en) | 2024-09-20 |
Family
ID=92727873
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410356003.2A Pending CN118672743A (en) | 2024-03-27 | 2024-03-27 | Deterministic task scheduling method, system and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118672743A (en) |
-
2024
- 2024-03-27 CN CN202410356003.2A patent/CN118672743A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10649935B2 (en) | Deferred inter-processor interrupts | |
US7925869B2 (en) | Instruction-level multithreading according to a predetermined fixed schedule in an embedded processor using zero-time context switching | |
US8775838B2 (en) | Limiting the number of unexpected wakeups in a computer system implementing a power-saving preemptive wakeup method from historical data | |
US8776079B2 (en) | Task processor | |
JP5809366B2 (en) | Method and system for scheduling requests in portable computing devices | |
US20030187907A1 (en) | Distributed control method and apparatus | |
TWI739345B (en) | A system and a method for handling an interrupt | |
CN101887383A (en) | A real-time process scheduling method | |
US7043729B2 (en) | Reducing interrupt latency while polling | |
CN104321747A (en) | Time slack application pipeline balancing for multi/many-core plcs | |
WO2017080276A1 (en) | Resource management method and system, and computer storage medium | |
CN109039929A (en) | Business scheduling method and device | |
KR102776397B1 (en) | Embedded system execution method and device, embedded system and chip | |
Roy et al. | Energy-aware primary/backup scheduling of periodic real-time tasks on heterogeneous multicore systems | |
US20030177163A1 (en) | Microprocessor comprising load monitoring function | |
Arora et al. | Bus-contention aware schedulability analysis for the 3-phase task model with partitioned scheduling | |
CN111597044A (en) | Task scheduling method and device, storage medium and electronic equipment | |
CN118672743A (en) | Deterministic task scheduling method, system and readable storage medium | |
CN118295778A (en) | Task scheduling method and device, electronic equipment and storage medium | |
Parikh et al. | Performance parameters of RTOSs; comparison of open source RTOSs and benchmarking techniques | |
JP2016184315A (en) | Electronic controller | |
US20230305872A1 (en) | Efficient central processing unit overcommit for virtual machines with symmetric multi-processing | |
Schade et al. | Using Trace Data for Run-Time Optimization of Parallel Execution in Real-Time Multi-Core Systems | |
CN118170520A (en) | DAG task scheduling method, computer program product, storage medium and terminal based on embedded multi-core real-time operating system | |
Deshmukh et al. | Comparison of Open Source RTOSs Using Various Performance Parameters |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |