[go: up one dir, main page]

CN111831406A - A kind of multitask scheduling method and device based on vehicle embedded system - Google Patents

A kind of multitask scheduling method and device based on vehicle embedded system Download PDF

Info

Publication number
CN111831406A
CN111831406A CN202010464254.4A CN202010464254A CN111831406A CN 111831406 A CN111831406 A CN 111831406A CN 202010464254 A CN202010464254 A CN 202010464254A CN 111831406 A CN111831406 A CN 111831406A
Authority
CN
China
Prior art keywords
task
tasks
event
priority
embedded system
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
Application number
CN202010464254.4A
Other languages
Chinese (zh)
Inventor
颜悌君
李腾飞
石伟
郑定军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Hazens Automotive Electronics Co ltd
Original Assignee
Shenzhen Hazens Automotive Electronics Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shenzhen Hazens Automotive Electronics Co ltd filed Critical Shenzhen Hazens Automotive Electronics Co ltd
Priority to CN202010464254.4A priority Critical patent/CN111831406A/en
Publication of CN111831406A publication Critical patent/CN111831406A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

本发明公开了一种基于车载嵌入式系统的多任务调度方法及装置,方法包括预先对任务进行分类,根据任务的类型分配对应RAM资源,并对分类后的任务设置优先级,将所有任务指定为相同的接口函数;监控事件信号,根据事件信号获取事件的任务类型;根据事件的任务类型对应的优先级执行对应的调度操作。本发明实施例提供的多任务调度方法及装置减少了多任务运行时对系统RAM资源的损耗,大大降低了RAM资源对系统设计的限制;并且提升了任务运行的实时性。

Figure 202010464254

The invention discloses a multi-task scheduling method and device based on a vehicle-mounted embedded system. The method includes classifying tasks in advance, allocating corresponding RAM resources according to the types of tasks, setting priorities for the classified tasks, and assigning all tasks to It is the same interface function; monitors the event signal, and obtains the task type of the event according to the event signal; executes the corresponding scheduling operation according to the priority corresponding to the task type of the event. The multi-task scheduling method and device provided by the embodiments of the present invention reduce the consumption of system RAM resources during multi-task operation, greatly reduce the limitation of RAM resources on system design, and improve the real-time performance of task operation.

Figure 202010464254

Description

一种基于车载嵌入式系统的多任务调度方法及装置A kind of multitask scheduling method and device based on vehicle embedded system

技术领域technical field

本发明涉及汽车控制系统技术领域,尤其涉及一种基于车载嵌入式系统的多任务调度方法及装置。The invention relates to the technical field of automobile control systems, in particular to a multi-task scheduling method and device based on a vehicle-mounted embedded system.

背景技术Background technique

目前,汽车电子产品中绝大部分ECU(Electronic Control Unit,电子控制单元)都是基于MCU(Microcontroller Unit,微控制单元)平台实现的,如车身网关,空调控制单元,多媒体导航等。由于功能模块多,会嵌入实时系统进行多任务管理,如Free RTOS(FreeReal Time multi-tasking Operation System,小型实时多任务操作系统)、uCOS(uControl Operation System,微型嵌入式实时系统)等。在现有技术中,对于多任务管理,通常是根据系统对功能模块的需要,采用一个功能模块对应创建一个任务的方式,对任务进行唤醒和挂起。每个功能模块对应创建一个任务的目的是为了方便模块管理,实现模块间的低耦合高内聚的要求,从而实现软件系统的模块化管理。At present, most ECUs (Electronic Control Unit, electronic control unit) in automotive electronic products are implemented based on MCU (Microcontroller Unit, micro control unit) platform, such as body gateway, air conditioning control unit, multimedia navigation and so on. Because there are many functional modules, they will be embedded in real-time systems for multi-task management, such as Free RTOS (FreeReal Time multi-tasking Operation System, small real-time multi-tasking operating system), uCOS (uControl Operation System, micro-embedded real-time system) and so on. In the prior art, for multi-task management, the task is usually awakened and suspended in a manner of creating a task corresponding to one functional module according to the system's requirements for the functional modules. The purpose of creating a task corresponding to each functional module is to facilitate module management and achieve the requirements of low coupling and high cohesion between modules, thereby realizing the modular management of the software system.

如图1所示,现有技术中多任务管理系统在创建任务时,会针对每个任务单独分配一个任务堆栈空间;每个任务在创建时会为其指定任务接口函数,在接口函数内为对应的任务配置优先级,形成包括所有任务在内的优先级向量表;系统基于优先级向量表对所有任务进行调度管理。任务创建完成后,多任务管理系统启动任务调度。多任务管理系统判断MCU中是否存在空闲RAM资源,并且判断空闲RAM资源是否满足任务执行需求。在保证MCU中存在能够满足任务执行需求的空闲RAM资源后,多任务管理系统对比判断各任务的优先级,调度执行所有任务中优先级最高的任务。As shown in Figure 1, when creating a task in the prior art, the multitasking management system will allocate a task stack space for each task separately; each task will be assigned a task interface function when it is created, and the interface function is The corresponding tasks are configured with priorities, and a priority vector table including all tasks is formed; the system schedules and manages all tasks based on the priority vector table. After the task is created, the multitasking management system starts task scheduling. The multitasking management system judges whether there are idle RAM resources in the MCU, and judges whether the idle RAM resources meet the task execution requirements. After ensuring that there are idle RAM resources in the MCU that can meet the task execution requirements, the multitasking management system compares and judges the priorities of each task, and schedules and executes the task with the highest priority among all tasks.

在实际应用过程中,现有的多任务管理系统通常存在部分任务过度占用MCU的RAM资源,导致RAM资源分配不合理,系统运行效率低的缺点。当系统内功能模块增多,对应的任务增多,此时需要有大量的RAM资源分配给各个任务。由于MCU的RAM资源有限,而部分较复杂的功能模块需要的RAM资源较多,这就导致了没有足够的RAM资源分配给其它任务,使得其它任务停止运行,影响系统运行效率。In the actual application process, the existing multi-task management system usually has the shortcomings that some tasks occupy the RAM resources of the MCU excessively, resulting in unreasonable allocation of RAM resources and low system operation efficiency. When the number of functional modules in the system increases and the corresponding tasks increase, a large amount of RAM resources need to be allocated to each task. Since the RAM resources of the MCU are limited, some more complex functional modules require more RAM resources, which results in insufficient RAM resources to be allocated to other tasks, causing other tasks to stop running, affecting the operating efficiency of the system.

因此,现有技术还有待于改进和发展。Therefore, the existing technology still needs to be improved and developed.

发明内容SUMMARY OF THE INVENTION

鉴于上述现有技术的不足,本发明的目的在于提供一种基于车载嵌入式系统的多任务调度方法及装置,旨在解决现有技术中系统内RAM资源分配不合理,影响系统运行效率的问题。In view of the above-mentioned deficiencies of the prior art, the purpose of the present invention is to provide a multi-task scheduling method and device based on a vehicle-mounted embedded system, aiming to solve the problem of unreasonable allocation of RAM resources in the system in the prior art and affecting the operating efficiency of the system .

本发明的技术方案如下:The technical scheme of the present invention is as follows:

一种基于车载嵌入式系统的多任务调度方法,所述方法包括:A multi-task scheduling method based on a vehicle-mounted embedded system, the method comprising:

预先对任务进行分类,根据任务的类型分配对应RAM资源,并对分类后的任务设置优先级,将所有任务指定为相同的接口函数;Classify tasks in advance, allocate corresponding RAM resources according to the type of tasks, set priorities for classified tasks, and assign all tasks to the same interface function;

监控事件信号,根据事件信号获取事件的任务类型;Monitor the event signal, and obtain the task type of the event according to the event signal;

根据事件的任务类型对应的优先级执行对应的调度操作。The corresponding scheduling operation is performed according to the priority corresponding to the task type of the event.

进一步的,所述预先对任务进行分类,包括:Further, classifying the tasks in advance includes:

预先将任务分成启动类任务、请求类任务、周期类任务和空闲类任务。Tasks are divided into startup tasks, request tasks, periodic tasks and idle tasks in advance.

进一步的,所述根据任务的类型设置优先级,包括:Further, the setting of the priority according to the type of the task includes:

预先将请求类任务和周期类任务的优先级级别设置为最高优先级,启动类任务的优先级级别设置为次高优先级,空闲类任务的优先级级别设置为最低优先级。In advance, the priority levels of request tasks and periodic tasks are set to the highest priority, the priority level of startup tasks is set to the next highest priority, and the priority level of idle tasks is set to the lowest priority.

进一步的,所述监控事件信号,根据事件信号获取事件的任务类型,包括:Further, the monitoring event signal obtains the task type of the event according to the event signal, including:

通过接口函数监控事件信号,判断是否存在有效的事件信号;Monitor the event signal through the interface function to determine whether there is a valid event signal;

若存在有效的事件信号,根据事件信号获取事件的任务类型。If there is a valid event signal, obtain the task type of the event according to the event signal.

进一步的,所述根据事件的任务类型对应的优先级执行对应的调度操作,包括:Further, performing the corresponding scheduling operation according to the priority corresponding to the task type of the event includes:

若事件的任务类型为最高优先级的任务,则运行最高优先级的任务;If the task type of the event is the highest priority task, run the highest priority task;

检测到最高优先级的任务运行结束后,释放信号,等待下次事件信号。After detecting that the task with the highest priority has finished running, release the signal and wait for the next event signal.

进一步的,所述根据事件的任务类型对应的优先级执行对应的调度操作,包括:Further, performing the corresponding scheduling operation according to the priority corresponding to the task type of the event includes:

若事件的任务类型为次高优先级的任务,则运行次高优先级的任务;If the task type of the event is the next highest priority task, run the next highest priority task;

检测到次高优先级的任务运行结束后,释放信号。Release the signal after detecting that the task with the next highest priority has finished running.

进一步的,所述根据事件的任务类型执行对应的调度操作,还包括:Further, performing the corresponding scheduling operation according to the task type of the event further includes:

若事件的任务类型为最低优先级的任务,则运行最低优先级的任务,获取最低优先级的任务中的子任务;If the task type of the event is the lowest priority task, run the lowest priority task and obtain the subtasks in the lowest priority task;

对子任务进行状态监控;Status monitoring of subtasks;

若检测到所有子任务已执行完毕,则控制系统进入低功耗模式。If it is detected that all subtasks have been executed, the control system enters a low power consumption mode.

本发明的另一实施例提供了一种基于车载嵌入式系统的多任务调度装置,所述装置包括至少一个处理器;以及,Another embodiment of the present invention provides a multi-task scheduling device based on an in-vehicle embedded system, the device includes at least one processor; and,

与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,

所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行上述的基于车载嵌入式系统的多任务调度方法。The memory stores instructions executable by the at least one processor, the instructions are executed by the at least one processor, so that the at least one processor can perform the above-mentioned multitasking scheduling based on the in-vehicle embedded system method.

本发明的另一实施例还提供了一种非易失性计算机可读存储介质,所述非易失性计算机可读存储介质存储有计算机可执行指令,该计算机可执行指令被一个或多个处理器执行时,可使得所述一个或多个处理器执行上述的基于车载嵌入式系统的多任务调度方法。Another embodiment of the present invention also provides a non-volatile computer-readable storage medium storing computer-executable instructions, the computer-executable instructions being stored by one or more When the processor executes, the one or more processors can be made to execute the above-mentioned multi-task scheduling method based on the in-vehicle embedded system.

本发明的另一种实施例提供了一种计算机程序产品,所述计算机程序产品包括存储在非易失性计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被处理器执行时,使所述处理器执行上述的基于车载嵌入式系统的多任务调度方法。Another embodiment of the present invention provides a computer program product, the computer program product including a computer program stored on a non-volatile computer-readable storage medium, the computer program including program instructions, when the program is When the instruction is executed by the processor, the processor is made to execute the above-mentioned multi-task scheduling method based on the in-vehicle embedded system.

有益效果:本发明公开了一种基于车载嵌入式系统的多任务调度方法及装置,相比于现有技术,本发明提供的多任务调度方法及装置减少了多任务运行时对系统RAM资源的损耗,合理分配系统RAM资源,大大降低了RAM资源对系统设计的限制RAM;并且提升了任务运行的实时性。Beneficial effects: The present invention discloses a multi-task scheduling method and device based on an in-vehicle embedded system. Compared with the prior art, the multi-task scheduling method and device provided by the present invention reduce the amount of time spent on system RAM resources during multi-task operation. Loss, reasonable allocation of system RAM resources, greatly reducing the RAM resource constraints on system design RAM; and improve the real-time performance of task operation.

附图说明Description of drawings

下面将结合附图及实施例对本发明作进一步说明,附图中:The present invention will be further described below in conjunction with the accompanying drawings and embodiments, in which:

图1为现有技术中多任务管理系统的运行流程示意图;Fig. 1 is the operation flow schematic diagram of the multi-task management system in the prior art;

图2为根据本发明实施例的基于车载嵌入式系统的多任务调度方法流程示意图;2 is a schematic flowchart of a multi-task scheduling method based on an in-vehicle embedded system according to an embodiment of the present invention;

图3为根据本发明实施例的多任务创建流程示意图;3 is a schematic diagram of a multi-task creation flow according to an embodiment of the present invention;

图4为根据本发明实施例的多类型任务调度流程示意图;4 is a schematic diagram of a multi-type task scheduling process according to an embodiment of the present invention;

图5为根据本发明实施例的子任务管理系统的运行流程示意图;FIG. 5 is a schematic diagram of an operation flow of a subtask management system according to an embodiment of the present invention;

图6为根据本发明实施例的基于车载嵌入式系统的多任务调度装置的结构示意图。FIG. 6 is a schematic structural diagram of a multi-task scheduling device based on an in-vehicle embedded system according to an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案及效果更加清楚、明确,以下对本发明进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the objectives, technical solutions and effects of the present invention clearer and clearer, the present invention will be described in further detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.

以下结合附图对本发明实施例进行详细的说明。The embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

本发明实施例提供了一种基于车载嵌入式系统的多任务调度方法。请参阅图2,图2为本发明一种基于车载嵌入式系统的多任务调度方法较佳实施例的流程图。如图2所示,所述方法包括:The embodiments of the present invention provide a multi-task scheduling method based on a vehicle-mounted embedded system. Please refer to FIG. 2 . FIG. 2 is a flowchart of a preferred embodiment of a multi-task scheduling method based on an in-vehicle embedded system of the present invention. As shown in Figure 2, the method includes:

步骤S100、预先对任务进行分类,根据任务的类型分配对应RAM资源,并对分类后的任务设置优先级,将所有任务指定为相同的接口函数;Step S100, classifying tasks in advance, allocating corresponding RAM resources according to the types of tasks, setting priorities for the classified tasks, and assigning all tasks to the same interface function;

步骤S200、监控事件信号,根据事件信号获取事件的任务类型;Step S200, monitoring the event signal, and obtaining the task type of the event according to the event signal;

步骤S300、根据事件的任务类型对应的优先级执行对应的调度操作。Step S300: Execute the corresponding scheduling operation according to the priority corresponding to the task type of the event.

具体实施时,本发明实施例中的系统是车载嵌入式实时系统,车载嵌入式实时系统一般是基于MCU构建的系统。系统对其创建的任务进行分类,并为每个任务类别划分一个独立的RAM资源,任务对应的RAM资源也叫任务堆栈空间,各任务在对应类别的任务堆栈空间中进行执行;并且不同类别的任务定义的优先级不同。系统为所有任务指定相同的接口函数,即通过该接口函数,可对所有任务对应的事件信号进行监控。During specific implementation, the system in the embodiment of the present invention is an in-vehicle embedded real-time system, and the in-vehicle embedded real-time system is generally a system constructed based on an MCU. The system classifies the tasks it creates, and divides an independent RAM resource for each task category. The RAM resource corresponding to the task is also called the task stack space, and each task is executed in the task stack space of the corresponding category; Tasks are defined with different priorities. The system specifies the same interface function for all tasks, that is, through this interface function, the event signals corresponding to all tasks can be monitored.

接口函数监控事件信号,在接受到有效事件信号后,获取所有有效事件信号对应的任务优先级,根据有效事件信号对应的任务的优先级执行操作。一般的在同时存在多个任务时,优先执行优先级别高的任务。The interface function monitors event signals, and after receiving valid event signals, obtains the task priorities corresponding to all valid event signals, and performs operations according to the priorities of the tasks corresponding to valid event signals. Generally, when there are multiple tasks at the same time, the task with higher priority is executed first.

本发明实施例的调度方法减少了多任务运行时对系统RAM资源的损耗,系统RAM资源分配合理,大大降低了RAM资源对系统设计的限制;各类别任务独立执行,互不干扰,提高了系统内RAM资源利用率和系统运行效率。The scheduling method of the embodiment of the present invention reduces the consumption of system RAM resources during multi-task operation, the system RAM resources are allocated reasonably, and the restriction of RAM resources on system design is greatly reduced; various types of tasks are executed independently without interfering with each other, which improves the system performance. Internal RAM resource utilization and system operating efficiency.

进一步的,所述预先对任务进行分类,包括:预先将任务分成启动类任务、请求类任务、周期类任务和空闲类任务。Further, the pre-classifying the tasks includes: pre-dividing the tasks into startup tasks, request tasks, periodic tasks and idle tasks.

具体的,现有技术的多任务调度系统是基于优先级进行调度的,无法做到在确定的时间去调度某一特定任务。而在汽车电子产品设计的规范中,有很多设计(如车身网络管理任务)是基于毫秒级定时误差来要求的。因此现有的多任务管理系统在任务调度间存在的时差无法满足上述精准定时调度的要求。为克服上述缺陷,本发明实施例将对多个任务分成启动类、请求类、周期类和空闲类,可根据不同的类别执行对应的任务。Specifically, the multi-task scheduling system in the prior art performs scheduling based on priorities, and cannot schedule a specific task at a certain time. In the specification of automotive electronic product design, there are many designs (such as body network management tasks) that are required based on millisecond-level timing errors. Therefore, the time difference existing between task scheduling in the existing multi-task management system cannot meet the above-mentioned requirement of precise timing scheduling. In order to overcome the above-mentioned defects, the embodiments of the present invention divide multiple tasks into a startup class, a request class, a period class, and an idle class, and corresponding tasks can be executed according to different classes.

所述启动类任务包括但不限于初始化任务,对于该类型任务,系统启动后只执行一次。所述请求类任务包括但不限于主动请求任务和被动请求任务,系统实时响应该类任务的请求。例如,与车载设备交互通信的接口(如CAN物理层)任务,该类任务实时性要求较高,具有中断接收和主动发送两种状态。所述周期类任务包括但不限于对周期和误差要求较高的任务,例如车身网络管理、车身诊断服务的各层级功能的实现,均可定义为周期类任务进行执行。所述空闲类任务包括但不限于对任务实时性和误差要求不高的任务,根据任务的执行要求,对任务划分类型,定义相应优先级,确保最高优先级任务及时执行,提高系统的准确率和实时性。The startup tasks include, but are not limited to, initialization tasks, and for this type of tasks, the system is only executed once after startup. The request tasks include but are not limited to active request tasks and passive request tasks, and the system responds to requests of such tasks in real time. For example, the task of the interface (such as the CAN physical layer) that communicates with the on-board equipment has high real-time requirements and has two states of interrupted reception and active transmission. The periodic tasks include, but are not limited to, tasks with high requirements on cycle and error, such as vehicle body network management and realization of functions at various levels of vehicle body diagnostic services, which can be defined as periodic tasks for execution. The idle tasks include, but are not limited to, tasks that do not have high requirements for task real-time and error. According to the execution requirements of the tasks, the tasks are divided into types, and corresponding priorities are defined to ensure that the highest priority tasks are executed in time and improve the accuracy of the system. and real-time.

进一步的,所述根据任务的类型设置优先级,包括:Further, the setting of the priority according to the type of the task includes:

预先将请求类任务和周期类任务的优先级级别设置为最高优先级,启动类任务的优先级级别设置为次高优先级,空闲类任务的优先级级别设置为最低优先级。In advance, the priority levels of request tasks and periodic tasks are set to the highest priority, the priority level of startup tasks is set to the next highest priority, and the priority level of idle tasks is set to the lowest priority.

具体实施时,各任务堆栈空间划分完成后,为各任务类型定义任务优先级。例如,将空闲类任务的任务优先级定义为最低优先级,当系统空闲时才会切换到空闲任务;将请求类任务和周期类任务均定义为最高优先级,确保系统最快速的响应请求类任务或者执行周期任务;将启动类任务定义为次高优先级,是因为任务调度首先会调用该类任务,执行完成后该启动任务将会被释放,不影响其它任务的调度。通过将周期类等任务需要实时执行的任务设置为最高优先级,在保证系统运行正常的基础上,提高了任务调度的实时性,满足了在汽车电子产品开发中针对软件系统实时性设计的规范。During specific implementation, after the division of the stack space of each task is completed, a task priority is defined for each task type. For example, define the task priority of idle tasks as the lowest priority, and switch to idle tasks when the system is idle; define both request tasks and periodic tasks as the highest priority to ensure that the system responds to the request class the fastest The task or execution cycle task; the startup task is defined as the second highest priority, because the task scheduling will call this type of task first, and the startup task will be released after the execution is completed, without affecting the scheduling of other tasks. By setting the tasks that need to be executed in real time, such as periodic tasks, as the highest priority, on the basis of ensuring the normal operation of the system, the real-time performance of task scheduling is improved, and the specifications for real-time design of software systems in the development of automotive electronic products are met. .

进一步的,所述监控事件信号,根据事件信号获取事件的任务类型,包括:Further, the monitoring event signal obtains the task type of the event according to the event signal, including:

通过接口函数监控事件信号,判断是否存在有效的事件信号;Monitor the event signal through the interface function to determine whether there is a valid event signal;

若存在有效的事件信号,根据事件信号获取事件的任务类型。If there is a valid event signal, obtain the task type of the event according to the event signal.

具体实施时,多任务创建完成后,启动系统调度,由于各个任务的接口函数为同一个接口函数,所以在统一的接口函数中我们通过监控各任务的事件信号,进行再管理。启动类任务对应启动事件信号,请求类任务对应请求事件信号,周期类任务对应周期事件信号,空闲类任务对应空闲事件信号,当检测到有效的事件信号,获取事件的任务类型,若存在多个有效的事件信号,优先执行高优先级的任务,任何任务接收到有效事件信号将进入执行模式,确保高优先级的任务实时响应。In the specific implementation, after the multi-task creation is completed, the system scheduling is started. Since the interface functions of each task are the same interface function, in the unified interface function, we monitor the event signals of each task for re-management. The startup task corresponds to the startup event signal, the request task corresponds to the request event signal, the periodic task corresponds to the periodic event signal, and the idle task corresponds to the idle event signal. When a valid event signal is detected, the task type of the event is obtained. Valid event signals give priority to high-priority tasks, and any task that receives a valid event signal will enter execution mode to ensure real-time response to high-priority tasks.

进一步的,所述根据事件的任务类型对应的优先级执行对应的调度操作,包括:Further, performing the corresponding scheduling operation according to the priority corresponding to the task type of the event includes:

若事件的任务类型为最高优先级的任务,则运行最高优先级的任务;检测到最高优先级的任务运行结束后,释放信号,等待下次事件信号。If the task type of the event is the task with the highest priority, the task with the highest priority will be run; after detecting that the task with the highest priority has finished running, release the signal and wait for the next event signal.

具体的,若事件的任务类型为请求类任务和周期类任务,基于对应的事件信号状态,各任务的事件信号只会被触发一次,当该事件信号有效,则运行该任务;当前任务运行结束后,该事件信号被释放,等待下一次有效事件信号发生。例如,接口函数监控请求类任务的事件信号;当获取的请求事件信号有效,则运行该请求事件信号对应的请求类任务;任务运行结束,则释放所述请求事件信号;接口函数等待获取下次请求事件信号。Specifically, if the task type of the event is a request task and a periodic task, based on the corresponding event signal state, the event signal of each task will only be triggered once, and when the event signal is valid, the task will be run; the current task is completed. After that, the event signal is released, waiting for the next valid event signal to occur. For example, the interface function monitors the event signal of the request class task; when the obtained request event signal is valid, the request class task corresponding to the request event signal is run; when the task finishes running, the request event signal is released; the interface function waits for the next time to obtain the request event signal. Request event signal.

进一步的,所述根据事件的任务类型对应的优先级执行对应的调度操作,包括:Further, performing the corresponding scheduling operation according to the priority corresponding to the task type of the event includes:

若事件的任务类型为次高优先级的任务,则运行次高优先级的任务;检测到次高优先级的任务运行结束后,释放信号。If the task type of the event is the task of the second highest priority, the task of the second highest priority is run; after it is detected that the task of the second highest priority has finished running, the signal is released.

具体的,若事件的任务类型为启动类任务,和空闲类任务在系统调度启动时,均被给予有效事件信号,即接口函数获取到的启动事件信号有效时,则运行启动类任务。Specifically, if the task type of the event is a startup task, and an idle task is given a valid event signal when the system is scheduled to start, that is, when the startup event signal obtained by the interface function is valid, the startup task is executed.

进一步的,所述根据事件的任务类型对应的优先级执行对应的调度操作,还包括:Further, performing the corresponding scheduling operation according to the priority corresponding to the task type of the event further includes:

若事件的任务类型为最低优先级的任务,则运行最低优先级的任务,获取最低优先级的任务中的子任务;If the task type of the event is the lowest priority task, run the lowest priority task and obtain the subtasks in the lowest priority task;

对子任务进行状态监控;Status monitoring of subtasks;

若检测到所有子任务已执行完毕,则控制系统进入低功耗模式。If it is detected that all subtasks have been executed, the control system enters a low power consumption mode.

具体实施时,当该启动类任务运行结束后,则释放该启动事件信号。在系统执行任务过程中,启动类任务被最先执行。而子任务管理系统将在空闲类任务中被启动初始化,进入循环运行状态。需要确认所有子任务均执行完成后,以此作为系统停止(低功耗模式)的前提条件。由于空闲类任务处于空闲任务堆栈空间中,设置为循环运行状态时,只要该空闲任务堆栈空间中存在空闲RAM资源,即可执行满足资源条件的空闲类任务。提高了任务执行效率和资源利用率。In a specific implementation, when the start-up task finishes running, the start-up event signal is released. When the system executes the task, the startup task is executed first. The sub-task management system will be initiated and initialized in the idle class task and enter the cyclic operation state. It is necessary to confirm that all subtasks are executed as a precondition for system stop (low power consumption mode). Since the idle task is in the idle task stack space, when the cyclic running state is set, as long as there is an idle RAM resource in the idle task stack space, the idle task that meets the resource conditions can be executed. Improve task execution efficiency and resource utilization.

本发明实施例还提供了一种基于车载嵌入式系统的多任务调度方法的多任务创建的具体实施例,示例性的,如图3所示,多任务创建方法包括:The embodiment of the present invention also provides a specific embodiment of multi-task creation based on the multi-task scheduling method of the vehicle-mounted embedded system. Exemplarily, as shown in FIG. 3 , the multi-task creation method includes:

步骤S10、多任务创建开始,之后执行步骤S20、步骤S30、步骤S40和步骤S50;Step S10, multi-task creation starts, and then steps S20, S30, S40 and S50 are executed;

步骤S20、定义启动类任务,之后执行步骤S21;Step S20, define a startup task, and then perform step S21;

步骤S21、创建任务堆栈空间1,之后执行步骤S22;Step S21, create a task stack space 1, and then execute step S22;

步骤S22、将启动类任务定义为次高优先级,之后执行步骤S60;Step S22, define the startup task as the second highest priority, and then perform step S60;

步骤S30、定义请求类任务,之后执行步骤S31;Step S30, define a request class task, and then execute step S31;

步骤S31、创建任务堆栈空间2,之后执行步骤S32;Step S31, create a task stack space 2, and then execute step S32;

步骤S32、将请求类任务定义为最高优先级,之后执行步骤S60;Step S32, define the request task as the highest priority, and then perform step S60;

步骤S40、定义周期类任务,之后执行步骤S41;Step S40, define a periodic task, and then execute step S41;

步骤S41、创建任务堆栈空间3,之后执行步骤S42;Step S41, create a task stack space 3, and then execute step S42;

步骤S42、将周期类任务定义为最高优先级,之后执行步骤S60;Step S42, define the periodic task as the highest priority, and then perform step S60;

步骤S50、定义空闲类任务,之后执行步骤S51;Step S50, define an idle class task, and then execute step S51;

步骤S51、创建任务堆栈空间4,之后执行步骤S52;Step S51, create a task stack space 4, and then execute step S52;

步骤S52、将空闲类任务定义为最低优先级,之后执行步骤S60;Step S52, define the idle task as the lowest priority, and then perform step S60;

步骤S60、为所有任务指定一个相同的接口函数,之后执行步骤S60;Step S60, specify an identical interface function for all tasks, and then perform step S60;

步骤S70、多任务创建完成,启动系统调度。In step S70, the multi-task creation is completed, and the system scheduling is started.

在基于图3的多任务创建完成后,启动系统调度,本发明实施例还提供了多任务调度的具体实施例,示例性的,如图4所示,多任务调度方法包括:After the creation of the multitasking based on FIG. 3 is completed, the system scheduling is started. The embodiment of the present invention also provides a specific embodiment of the multitasking scheduling. Exemplarily, as shown in FIG. 4 , the multitasking scheduling method includes:

步骤S70、多任务创建完成,启动系统调度,之后执行步骤S80;Step S70, the multi-task creation is completed, the system scheduling is started, and then step S80 is performed;

步骤S80、接口函数监控所有任务对应的事件信号,判断是否获取到有效事件信号;若获取到有效事件信号,则执行步骤S81和/或步骤S82/或步骤S83/或步骤S84;若未获取到有效事件信号,则重复执行步骤S80;Step S80, the interface function monitors the event signals corresponding to all tasks, and judges whether a valid event signal is obtained; if a valid event signal is obtained, then perform step S81 and/or step S82/or step S83/or step S84; if not obtained If the event signal is valid, repeat step S80;

步骤S81、接口函数获取到的事件信号为有效启动事件信号,之后执行步骤S811;Step S81, the event signal obtained by the interface function is a valid startup event signal, and then step S811 is performed;

步骤S811、运行有效启动事件信号对应的启动类任务,之后执行步骤S812;Step S811, run the startup task corresponding to the valid startup event signal, and then perform step S812;

步骤S812、该任务运行结束,释放该任务对应的事件信号;Step S812, the operation of the task ends, and the event signal corresponding to the task is released;

步骤S82、接口函数获取到的事件信号为有效请求事件信号,之后执行步骤S821;Step S82, the event signal obtained by the interface function is a valid request event signal, and then step S821 is performed;

步骤S821、运行有效请求事件信号对应的请求类任务,之后执行步骤S822;Step S821, run the request task corresponding to the valid request event signal, and then perform step S822;

步骤S822、该任务运行结束,释放该任务对应的事件信号,之后执行步骤S823;Step S822, the task operation ends, release the event signal corresponding to the task, and then perform step S823;

步骤S823、等待获取下次请求事件信号,之后返回执行步骤S80;Step S823, waiting to obtain the next request event signal, and then returning to step S80;

步骤S83、接口函数获取到的事件信号为有效周期事件信号,之后执行步骤S831;Step S83, the event signal obtained by the interface function is a valid period event signal, and then step S831 is performed;

步骤S831、运行有效周期事件信号对应的周期类任务,之后执行步骤S832;Step S831, run the periodic task corresponding to the valid periodic event signal, and then execute step S832;

步骤S832、运行结束,释放信号,之后返回执行步骤S833;Step S832, the operation ends, release the signal, and then return to step S833;

步骤S833、等待获取下次周期事件信号,之后返回执行步骤S80;Step S833, waiting for the acquisition of the next periodic event signal, and then returning to step S80;

步骤S84、接口函数获取到的事件信号为有效空闲事件信号,之后执行步骤S841;Step S84, the event signal obtained by the interface function is a valid idle event signal, and then step S841 is performed;

步骤S841、运行有效空闲事件信号对应的空闲类任务,之后执行步骤S842;Step S841, run the idle task corresponding to the valid idle event signal, and then execute step S842;

步骤S842、该任务运行结束,释放该任务对应的事件信号,之后执行步骤S843;Step S842, the task operation ends, release the event signal corresponding to the task, and then perform step S843;

步骤S843、启动子任务管理系统,之后循环执行步骤S843。Step S843: Start the subtask management system, and then execute step S843 cyclically.

本发明实施例提供了一种基于车载嵌入式系统的多任务调度方法的子任务管理系统运行流程的具体实施例,示例性的,如图5所示,子任务管理系统根据功能模块需求,创建n个子任务;若系统未获得有效事件信号,子任务管理系统则循环执行上述n个子任务。其中n为大于等于1的正整数。每个子任务的执行步骤相同,以其中子任务1为例进行示例性说明。子任务1的执行步骤包括:The embodiment of the present invention provides a specific embodiment of the operation process of the sub-task management system based on the multi-task scheduling method of the in-vehicle embedded system. Exemplarily, as shown in FIG. 5 , the sub-task management system creates a n subtasks; if the system does not obtain a valid event signal, the subtask management system cyclically executes the above n subtasks. where n is a positive integer greater than or equal to 1. The execution steps of each subtask are the same, and subtask 1 is used as an example for illustration. The execution steps of subtask 1 include:

步骤S8431、创建子任务1,之后执行步骤S8432;Step S8431, create subtask 1, and then execute step S8432;

步骤S8431、对子任务1进行初始化处理,之后执行步骤S8433;Step S8431, initialize subtask 1, and then execute step S8433;

步骤S8433、启动子任务1,之后执行步骤S8434;Step S8433, start subtask 1, and then execute step S8434;

步骤S8434、运行子任务1,之后执行步骤S8435;Step S8434, run subtask 1, and then execute step S8435;

步骤S8435、子任务1进入预备停止状态,之后执行步骤S8436;In step S8435, subtask 1 enters the preparatory stop state, and then executes step S8436;

步骤S8436、子任务1停止运行,之后返回执行步骤S8433。In step S8436, the subtask 1 stops running, and then returns to step S8433.

具体的,子任务管理系统用于对低优先级的空闲类任务进行管理。在空闲类任务中,各功能模块对应的任务均被定义为子任务,被子任务管理系统统一管理,循环调度。每个子任务包含初始化、启动、运行、预备停止和停止五个状态,且被各自子任务的状态机管理。各子任务相互独立,但又相互协调。子任务管理系统被启动初始化时,各子任务被统一初始化;初始化完成后,各子任务根据需要进入启动状态。需要说明的是,子任务管理系统将所有子任务同时进行初始化操作后,仅对有启动运行需求的子任务,进行启动运行操作,没有启动运行需求的子任务,则不进行启动运行操作。Specifically, the subtask management system is used to manage low-priority idle tasks. In the idle task, the tasks corresponding to each functional module are defined as subtasks, which are uniformly managed and cyclically scheduled by the subtask management system. Each subtask contains five states: initialize, start, run, prepare to stop, and stop, and is managed by the state machine of the respective subtask. Each subtask is independent of each other, but coordinated with each other. When the subtask management system is started and initialized, each subtask is uniformly initialized; after the initialization is completed, each subtask enters the startup state as required. It should be noted that after initializing all subtasks at the same time, the subtask management system only performs the startup operation for the subtasks that have startup requirements, and does not perform startup operations for the subtasks without startup requirements.

处于启动状态的子任务进入各子任务对状态机管理;所述子任务管理系统运行停止前,需要确认所有子任务均进入预备停止状态后,所有子任务才可同时进入停止状态,以此作为子任务管理系统停止运行的前提条件。通过设置预备停止状态,在子任务管理系统停止运行前,确保各子任务均处于停止状态。避免了部分子任务完成和部分子任务完成时,任务管理系统需要重复启动运行而降低了系统运行功耗。The subtasks in the starting state enter the state machine management of each subtask; before the subtask management system stops running, it is necessary to confirm that all the subtasks have entered the preparatory stop state, and then all the subtasks can enter the stop state at the same time, as a The prerequisite for the subtask management system to stop running. By setting the preparatory stop state, ensure that each subtask is in the stopped state before the subtask management system stops running. It is avoided that when some subtasks are completed and some subtasks are completed, the task management system needs to start and run repeatedly, thereby reducing the power consumption of system operation.

需要说明的是,在上述各个实施例中,上述各步骤之间并不必然存在一定的先后顺序,本领域普通技术人员,根据本发明实施例的描述可以理解,不同实施例中,上述各步骤可以有不同的执行顺序,亦即,可以并行执行,也可以交换执行等等。It should be noted that, in the above embodiments, the above steps do not necessarily have a certain sequence. Those of ordinary skill in the art can understand from the description of the embodiments of the present invention that in different embodiments, the above steps There can be different execution orders, that is, parallel execution, alternate execution, and so on.

本发明另一实施例提供一种基于车载嵌入式系统的多任务调度装置,如图6所示,装置10包括:Another embodiment of the present invention provides a multi-task scheduling device based on an in-vehicle embedded system. As shown in FIG. 6 , the device 10 includes:

一个或多个处理器110以及存储器120,图中以一个处理器110为例进行介绍,处理器110和存储器120可以通过总线或者其他方式连接,图中以通过总线连接为例。One or more processors 110 and the memory 120 are described in the figure by taking one processor 110 as an example. The processor 110 and the memory 120 may be connected by a bus or in other ways, and the connection by a bus is taken as an example in the figure.

处理器110用于完成装置10的各种控制逻辑,其可以为通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)、单片机、ARM(Acorn RISCMachine)或其它可编程逻辑器件、分立门或晶体管逻辑、分立的硬件组件或者这些部件的任何组合。还有,处理器110还可以是任何传统处理器、微处理器或状态机。处理器110也可以被实现为计算设备的组合,例如,DSP和微处理器的组合、多个微处理器、一个或多个微处理器结合DSP核、或任何其它这种配置。The processor 110 is used to complete various control logics of the device 10, which can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISCMachine) or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination of these components. Also, the processor 110 may be any conventional processor, microprocessor or state machine. The processor 110 may also be implemented as a combination of computing devices, eg, a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors combined with a DSP core, or any other such configuration.

存储器120作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本发明实施例中的基于车载嵌入式系统的多任务调度方法对应的程序指令。处理器110通过运行存储在存储器120中的非易失性软件程序、指令以及单元,从而执行装置10的各种功能应用以及数据处理,即实现上述方法实施例中的基于车载嵌入式系统的多任务调度方法。As a non-volatile computer-readable storage medium, the memory 120 can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the multi-device based on the in-vehicle embedded system in the embodiment of the present invention. The program instruction corresponding to the task scheduling method. The processor 110 executes various functional applications and data processing of the device 10 by running the non-volatile software programs, instructions and units stored in the memory 120, that is, to realize the multi-function based on the in-vehicle embedded system in the above method embodiments. Task scheduling method.

存储器120可以包括存储程序区和存储数据区,其中,存储程序区可存储操作装置、至少一个功能所需要的应用程序;存储数据区可存储根据装置10使用所创建的数据等。此外,存储器120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器120可选包括相对于处理器110远程设置的存储器,这些远程存储器可以通过网络连接至装置10。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 120 may include a storage program area and a storage data area, wherein the storage program area may store an application program required for operating the device, at least one function; the storage data area may store data created according to the use of the device 10, and the like. Additionally, memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 120 may optionally include memory located remotely from processor 110, which may be connected to device 10 via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

一个或者多个单元存储在存储器120中,当被一个或者多个处理器110执行时,执行上述任意方法实施例中的基于车载嵌入式系统的多任务调度方法,例如,执行步骤S100至步骤S300。One or more units are stored in the memory 120, and when executed by one or more processors 110, execute the multi-task scheduling method based on the in-vehicle embedded system in any of the above method embodiments, for example, execute steps S100 to S300 .

本发明实施例提供了一种非易失性计算机可读存储介质,计算机可读存储介质存储有计算机可执行指令,该计算机可执行指令被一个或多个处理器执行,例如,执行步骤S100至步骤S300。Embodiments of the present invention provide a non-volatile computer-readable storage medium, where the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors. For example, by performing steps S100 to Step S300.

作为示例,非易失性存储介质能够包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦ROM(EEPROM)或闪速存储器。易失性存储器能够包括作为外部高速缓存存储器的随机存取存储器(RAM)。通过说明丽非限制,RAM可以以诸如同步RAM(SRAM)、动态RAM、(DRAM)、同步DRAM(SDRAM)、双数据速率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、Synchlink DRAM(SLDRAM)以及直接Rambus(兰巴斯)RAM(DRRAM)之类的许多形式得到。本文中所描述的操作环境的所公开的存储器组件或存储器旨在包括这些和/或任何其他适合类型的存储器中的一个或多个。As examples, non-volatile storage media can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of illustration, and not limitation, RAM can be configured in formats such as Synchronous RAM (SRAM), Dynamic RAM, (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus (Lambas) RAM (DRRAM) and many other forms. The disclosed memory components or memories of the operating environments described herein are intended to include one or more of these and/or any other suitable types of memory.

本发明的另一种实施例提供了一种计算机程序产品,计算机程序产品包括存储在非易失性计算机可读存储介质上的计算机程序,计算机程序包括程序指令,当程序指令被处理器执行时,使所述处理器执行上述方法实施例的基于车载嵌入式系统的多任务调度方法。例如,执行上述图2中的步骤S100至步骤S300。Another embodiment of the present invention provides a computer program product comprising a computer program stored on a non-volatile computer-readable storage medium, the computer program comprising program instructions that when executed by a processor , causing the processor to execute the multi-task scheduling method based on the in-vehicle embedded system of the above method embodiments. For example, steps S100 to S300 in FIG. 2 described above are performed.

以上所描述的实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际需要选择其中的部分或者全部模块来实现本实施例方案的目的。The above-described embodiments are only illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, Alternatively, it can be distributed over multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

通过以上的实施例的描述,本领域的技术人员可以清楚地了解到各实施例可借助软件加通用硬件平台的方式来实现,当然也可以通过硬件实现。基于这样的理解,上述技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存在于计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机装置(可以是个人计算机,服务器,或者网络装置等)执行各个实施例或者实施例的某些部分的方法。From the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, and certainly can also be implemented by hardware. Based on this understanding, the above-mentioned technical solutions can be embodied in the form of software products in essence, or the parts that make contributions to related technologies. The computer software products can exist in computer-readable storage media, such as ROM/RAM, magnetic disks , optical disc, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform the methods of various embodiments or portions of embodiments.

除了其他之外,诸如"能够'、"能"、"可能"或"可以"之类的条件语言除非另外具体地陈述或者在如所使用的上下文内以其他方式理解,否则一般地旨在传达特定实施方式能包括(然而其他实施方式不包括)特定特征、元件和/或操作。因此,这样的条件语言一般地还旨在暗示特征、元件和/或操作对于一个或多个实施方式无论如何都是需要的或者一个或多个实施方式必须包括用于在有或没有输入或提示的情况下判定这些特征、元件和/或操作是否被包括或者将在任何特定实施方式中被执行的逻辑。Conditional language such as "could," "could," "may," or "could," among others, is generally intended to convey unless specifically stated otherwise or otherwise understood within the context as used Particular embodiments can include (while other embodiments do not include) particular features, elements, and/or operations. Thus, such conditional language is also generally intended to imply that the features, elements, and/or operations are irrelevant for one or more embodiments. All are required or one or more implementations must include logic to determine, with or without input or prompting, whether these features, elements and/or operations are included or to be performed in any particular implementation.

已经在本文中在本说明书和附图中描述的内容包括能够提供基于车载嵌入式系统的多任务调度方法及装置的示例。当然,不能够出于描述本公开的各种特征的目的来描述元件和/或方法的每个可以想象的组合,但是可以认识到,所公开的特征的许多另外的组合和置换是可能的。因此,显而易见的是,在不脱离本公开的范围或精神的情况下能够对本公开做出各种修改。此外,或在替代方案中,本公开的其他实施例从对本说明书和附图的考虑以及如本文中所呈现的本公开的实践中可能是显而易见的。意图是,本说明书和附图中所提出的示例在所有方面被认为是说明性的而非限制性的。尽管在本文中采用了特定术语,但是它们在通用和描述性意义上被使用并且不用于限制的目的。What has been described in this specification and the accompanying drawings herein includes examples that can provide a multitask scheduling method and apparatus based on an in-vehicle embedded system. Of course, not every conceivable combination of elements and/or methods has been described for the purpose of describing the various features of the present disclosure, but it will be appreciated that many additional combinations and permutations of the disclosed features are possible. Therefore, it will be apparent that various modifications can be made in the present disclosure without departing from the scope or spirit of the disclosure. In addition, or in the alternative, other embodiments of the present disclosure may be apparent from consideration of this specification and drawings, and from practice of the present disclosure as presented herein. It is intended that the examples presented in this specification and drawings are to be regarded in all respects as illustrative and not restrictive. Although specific terms are employed herein, they are used in a generic and descriptive sense and not for purposes of limitation.

Claims (10)

1.一种基于车载嵌入式系统的多任务调度方法,其特征在于,所述方法包括:1. a multi-task scheduling method based on vehicle-mounted embedded system, is characterized in that, described method comprises: 预先对任务进行分类,根据任务的类型分配对应RAM资源,并对分类后的任务设置优先级,将所有任务指定为相同的接口函数;Classify tasks in advance, allocate corresponding RAM resources according to the type of tasks, set priorities for classified tasks, and assign all tasks to the same interface function; 监控事件信号,根据事件信号获取事件的任务类型;Monitor the event signal, and obtain the task type of the event according to the event signal; 根据事件的任务类型对应的优先级执行对应的调度操作。The corresponding scheduling operation is performed according to the priority corresponding to the task type of the event. 2.根据权利要求1所述的基于车载嵌入式系统的多任务调度方法,其特征在于,所述预先对任务进行分类,包括:2. The multi-task scheduling method based on the in-vehicle embedded system according to claim 1, wherein the classification of the tasks in advance comprises: 预先将任务分成启动类任务、请求类任务、周期类任务和空闲类任务。Tasks are divided into startup tasks, request tasks, periodic tasks and idle tasks in advance. 3.根据权利要求2所述的基于车载嵌入式系统的多任务调度方法,其特征在于,所述根据任务的类型设置优先级,包括:3. The multi-task scheduling method based on the in-vehicle embedded system according to claim 2, wherein the priority is set according to the type of the task, comprising: 预先将请求类任务和周期类任务的优先级级别设置为最高优先级,启动类任务的优先级级别设置为次高优先级,空闲类任务的优先级级别设置为最低优先级。In advance, the priority levels of request tasks and periodic tasks are set to the highest priority, the priority level of startup tasks is set to the next highest priority, and the priority level of idle tasks is set to the lowest priority. 4.根据权利要求3所述的基于车载嵌入式系统的多任务调度方法,其特征在于,所述监控事件信号,根据事件信号获取事件的任务类型,包括:4. The multi-task scheduling method based on a vehicle-mounted embedded system according to claim 3, wherein the monitoring event signal obtains the task type of the event according to the event signal, comprising: 通过接口函数监控事件信号,判断是否存在有效的事件信号;Monitor the event signal through the interface function to determine whether there is a valid event signal; 若存在有效的事件信号,根据事件信号获取事件的任务类型。If there is a valid event signal, obtain the task type of the event according to the event signal. 5.根据权利要求4所述的基于车载嵌入式系统的多任务调度方法,其特征在于,所述根据事件的任务类型对应的优先级执行对应的调度操作,包括:5. The multi-task scheduling method based on the in-vehicle embedded system according to claim 4, wherein the performing the corresponding scheduling operation according to the priority corresponding to the task type of the event, comprising: 若事件的任务类型为最高优先级的任务,则运行最高优先级的任务;If the task type of the event is the highest priority task, run the highest priority task; 检测到最高优先级的任务运行结束后,释放信号,等待下次事件信号。After detecting that the task with the highest priority has finished running, release the signal and wait for the next event signal. 6.根据权利要求4所述的基于车载嵌入式系统的多任务调度方法,其特征在于,所述根据事件的任务类型对应的优先级执行对应的调度操作,包括:6. The multi-task scheduling method based on an in-vehicle embedded system according to claim 4, wherein the execution of the corresponding scheduling operation according to the priority corresponding to the task type of the event, comprises: 若事件的任务类型为次高优先级的任务,则运行次高优先级的任务;If the task type of the event is the next highest priority task, run the next highest priority task; 检测到次高优先级的任务运行结束后,释放信号。Release the signal after detecting that the task with the next highest priority has finished running. 7.根据权利要求4所述的基于车载嵌入式系统的多任务调度方法,其特征在于,所述根据事件的任务类型对应的优先级执行对应的调度操作,还包括:7. The multi-task scheduling method based on the in-vehicle embedded system according to claim 4, characterized in that, performing the corresponding scheduling operation according to the priority corresponding to the task type of the event, further comprising: 若事件的任务类型为最低优先级的任务,则运行最低优先级的任务,获取最低优先级的任务中的子任务;If the task type of the event is the lowest priority task, run the lowest priority task and obtain the subtasks in the lowest priority task; 对子任务进行状态监控;Status monitoring of subtasks; 若检测到所有子任务已执行完毕,则控制系统进入低功耗模式。If it is detected that all subtasks have been executed, the control system enters a low power consumption mode. 8.一种基于车载嵌入式系统的多任务调度装置,其特征在于,所述装置包括至少一个处理器;以及,8. A multi-task scheduling device based on a vehicle-mounted embedded system, wherein the device comprises at least one processor; and, 与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein, 所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-7任一项所述的基于车载嵌入式系统的多任务调度方法。The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the process of any one of claims 1-7 Multitask scheduling method based on vehicle embedded system. 9.一种非易失性计算机可读存储介质,其特征在于,所述非易失性计算机可读存储介质存储有计算机可执行指令,该计算机可执行指令被一个或多个处理器执行时,可使得所述一个或多个处理器执行权利要求1-7任一项所述的基于车载嵌入式系统的多任务调度方法。9. A non-volatile computer-readable storage medium, characterized in that, the non-volatile computer-readable storage medium stores computer-executable instructions, when the computer-executable instructions are executed by one or more processors , the one or more processors can be made to execute the multi-task scheduling method based on the in-vehicle embedded system according to any one of claims 1-7. 10.一种计算机程序产品,其特征在于,所述计算机程序产品包括存储在非易失性计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被处理器执行时,使所述处理器执行权利要求1-7任一项所述的基于车载嵌入式系统的多任务调度方法。10. A computer program product, characterized in that the computer program product comprises a computer program stored on a non-volatile computer-readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a processor During execution, the processor is made to execute the multitask scheduling method based on the in-vehicle embedded system according to any one of claims 1-7.
CN202010464254.4A 2020-05-27 2020-05-27 A kind of multitask scheduling method and device based on vehicle embedded system Pending CN111831406A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010464254.4A CN111831406A (en) 2020-05-27 2020-05-27 A kind of multitask scheduling method and device based on vehicle embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010464254.4A CN111831406A (en) 2020-05-27 2020-05-27 A kind of multitask scheduling method and device based on vehicle embedded system

Publications (1)

Publication Number Publication Date
CN111831406A true CN111831406A (en) 2020-10-27

Family

ID=72913994

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010464254.4A Pending CN111831406A (en) 2020-05-27 2020-05-27 A kind of multitask scheduling method and device based on vehicle embedded system

Country Status (1)

Country Link
CN (1) CN111831406A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579215A (en) * 2020-12-23 2021-03-30 潍柴动力股份有限公司 Method and device for generating scheduling function
CN114003360A (en) * 2021-10-28 2022-02-01 芜湖雄狮汽车科技有限公司 Multi-tenant task management method, device, electronic device and storage medium
CN114153576A (en) * 2021-11-09 2022-03-08 上海卓菡科技有限公司 Multi-task scheduling method and device based on wearable device and electronic device
CN116467059A (en) * 2023-04-21 2023-07-21 哈尔滨有初科技有限公司 Data processing system and method based on distributed computing

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5636124A (en) * 1995-03-08 1997-06-03 Allen-Bradley Company, Inc. Multitasking industrial controller
CN103412796A (en) * 2013-08-30 2013-11-27 北京经纬恒润科技有限公司 Stack allocation method and stack allocation unit for tasks in operating system
CN108536527A (en) * 2018-02-08 2018-09-14 山东省科学院自动化研究所 A kind of method for scheduling task and device of embedded software
CN109710399A (en) * 2018-12-14 2019-05-03 湖北航天技术研究院总体设计所 A kind of DSP communication task scheduling system and method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5636124A (en) * 1995-03-08 1997-06-03 Allen-Bradley Company, Inc. Multitasking industrial controller
CN103412796A (en) * 2013-08-30 2013-11-27 北京经纬恒润科技有限公司 Stack allocation method and stack allocation unit for tasks in operating system
CN108536527A (en) * 2018-02-08 2018-09-14 山东省科学院自动化研究所 A kind of method for scheduling task and device of embedded software
CN109710399A (en) * 2018-12-14 2019-05-03 湖北航天技术研究院总体设计所 A kind of DSP communication task scheduling system and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
马建辉;孙常青;侯冬冬;郭坤;: "嵌入式系统裸机的任务调度应用设计", 单片机与嵌入式系统应用, no. 06, 1 June 2018 (2018-06-01) *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579215A (en) * 2020-12-23 2021-03-30 潍柴动力股份有限公司 Method and device for generating scheduling function
CN112579215B (en) * 2020-12-23 2023-12-15 潍柴动力股份有限公司 Scheduling function generation method and device
CN114003360A (en) * 2021-10-28 2022-02-01 芜湖雄狮汽车科技有限公司 Multi-tenant task management method, device, electronic device and storage medium
CN114153576A (en) * 2021-11-09 2022-03-08 上海卓菡科技有限公司 Multi-task scheduling method and device based on wearable device and electronic device
CN116467059A (en) * 2023-04-21 2023-07-21 哈尔滨有初科技有限公司 Data processing system and method based on distributed computing

Similar Documents

Publication Publication Date Title
CN111831406A (en) A kind of multitask scheduling method and device based on vehicle embedded system
CN109564528B (en) System and method for computing resource allocation in distributed computing
CN109144710B (en) Resource scheduling method, apparatus, and computer-readable storage medium
CN103729480B (en) Method for rapidly finding and scheduling multiple ready tasks of multi-kernel real-time operating system
CN113434284B (en) Privacy computation server side equipment, system and task scheduling method
JP4985662B2 (en) Program and control device
CN112882828B (en) Method for managing and scheduling a processor in a processor-based SLURM operation scheduling system
CN114637598A (en) Vehicle controller and scheduling method of operating system thereof
CN101976204B (en) Service-oriented heterogeneous multi-core computing platform and task scheduling method used by same
KR20080013993A (en) Use of Data Engines in Data Processing Units
WO2022237419A1 (en) Task execution method and apparatus, and storage medium
CN119271367A (en) Delay method, device, equipment, medium and vehicle based on AutoSar operating system
CN114633705A (en) Vehicle control device with synchronous drive program
US11301304B2 (en) Method and apparatus for managing kernel services in multi-core system
CN115658278B (en) A Microtask Scheduler Supporting High Concurrency Protocol Interaction
CN118819748A (en) A task scheduling method, scheduling management system and multi-core processor
WO2024164369A1 (en) Resource-aware task allocation method for mixed-criticality partitioned real-time operating system
CN117441161A (en) Software optimization method and equipment of NUMA architecture
Kakkar Scheduling techniques for operating systems for medical and IoT devices: A review
CN114064225A (en) Self-adaptive scheduling method, device, computer storage medium and system
CN117931483B (en) Operating system and generation method, electronic device, storage medium and program product
JP2021060707A (en) Synchronization control system and synchronization control method
EP4607348A1 (en) Preemption in an interrupt driven micro-scheduler technical field
CN117271144B (en) Thread processing method and electronic equipment
CN113438206B (en) Distributed event-driven Internet of things runtime system, method, terminal and medium

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20201027