CN112783619B - Task scheduling method and device and automatic driving system - Google Patents

Task scheduling method and device and automatic driving system Download PDF

Info

Publication number
CN112783619B
CN112783619B CN202011639302.5A CN202011639302A CN112783619B CN 112783619 B CN112783619 B CN 112783619B CN 202011639302 A CN202011639302 A CN 202011639302A CN 112783619 B CN112783619 B CN 112783619B
Authority
CN
China
Prior art keywords
task
tasks
target
executed
scheduling
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.)
Active
Application number
CN202011639302.5A
Other languages
Chinese (zh)
Other versions
CN112783619A (en
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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN202011639302.5A priority Critical patent/CN112783619B/en
Publication of CN112783619A publication Critical patent/CN112783619A/en
Application granted granted Critical
Publication of CN112783619B publication Critical patent/CN112783619B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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)
  • Traffic Control Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the application provides a task scheduling method, a task scheduling device and an automatic driving system, wherein the method comprises the following steps: obtaining a plurality of target tasks to be executed; determining out-of-period scheduling frequency of the current moment of each target task to be executed; wherein, the out-of-schedule scheduling frequency of a target task to be executed represents: continuously overtime scheduling the times of the target task to be executed in a preset historical time; and scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-time scheduling frequency from high to low. Thus, the reliability of task scheduling can be improved.

Description

Task scheduling method and device and automatic driving system
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a task scheduling method, device, and automatic driving system.
Background
With the rapid development of computer technology, automation control can be achieved by performing a preset plurality of tasks. For example, in the unmanned field, the automatic driving of the automobile can be controlled by executing different driving tasks such as a target perception task, a path planning task, a decision control task and the like.
In the related art, a driving task currently in a state to be executed (may be referred to as a driving task to be executed) may be determined from a plurality of preset driving tasks, and further, each driving task to be executed may be sequentially scheduled to the kernel for execution according to a preset scheduling sequence.
However, the foregoing preset scheduling sequence is generally set by a technician according to experience, and for some special situations, for example, when the road condition where the automobile is located is relatively complex, the execution of each driving task may be affected, for example, the execution duration of some driving tasks may be increased, and at this time, if the driving tasks to be executed are scheduled to the kernel for execution according to the preset scheduling sequence, some driving tasks may not be completed in time, which may reduce the reliability of task scheduling.
Disclosure of Invention
The embodiment of the application aims to provide a task scheduling method, a task scheduling device and an automatic driving system so as to improve the reliability of task scheduling. The specific technical scheme is as follows:
in order to achieve the above object, an embodiment of the present application discloses a task scheduling method, where the method includes:
obtaining a plurality of target tasks to be executed;
determining out-of-period scheduling frequency of the current moment of each target task to be executed; wherein, the out-of-schedule scheduling frequency of a target task to be executed represents: continuously overtime scheduling the times of the target task to be executed in a preset historical time;
and scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-time scheduling frequency from high to low.
Optionally, before the obtaining the plurality of target tasks to be performed, the method further includes:
dividing all tasks into a plurality of task groups, wherein I/O intensive tasks are allocated to a first task group with highest priority, and non-I/O intensive tasks are allocated to the first task group or one or more second task groups with lower priority than the first task group based on historical over-time scheduling frequency;
the obtaining a plurality of target tasks to be executed includes:
starting an actuator for each task group; the priority of each executor is consistent with the priority of the corresponding task group;
respectively obtaining a plurality of target tasks to be executed in a task group corresponding to each executor;
and scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-time scheduling frequency from high to low, wherein the method comprises the following steps:
scheduling the target tasks to be executed in the first task group to the kernel according to a preset sequence through the executors corresponding to the first task group; wherein the preset sequence represents: the I/O intensive tasks are prioritized over the non-I/O intensive tasks, and the non-I/O intensive tasks are in sequence from high to low according to the out-of-date scheduling frequency;
And/or the number of the groups of groups,
scheduling target tasks to be executed in the second task groups corresponding to the actuators to the kernel according to the sequence of the over-period scheduling frequency from high to low through the actuators corresponding to the second task groups; so that the kernel executes the received task to be executed according to the priority of each executor.
Optionally, when the number of the second task groups is multiple, priorities of the second task groups are different;
the method further comprises the steps of:
when reaching the preset moment, judging whether the maximum out-of-time scheduling frequency of the tasks in each second task group is larger than a preset threshold value or not according to each second task group;
if the maximum out-of-schedule scheduling frequency of the tasks in the second task group is greater than a preset threshold, transferring the task corresponding to the maximum out-of-schedule scheduling frequency of the tasks in the second task group to a target task group, wherein the priority of the target task group is higher than the priority of the second task group, and the priority of the target task group and the priority of the second task group are adjacent priorities; and/or the number of the groups of groups,
and transferring the task corresponding to the minimum out-of-date scheduling frequency of the tasks in the target task group to the second task group.
Optionally, before the task corresponding to the maximum out-of-schedule scheduling frequency of the tasks in the second task group is migrated to the target task group, the method further includes:
judging whether the maximum out-of-schedule frequency of the tasks in the second task group is greater than the minimum out-of-schedule frequency of the tasks in the target task group;
and if the maximum out-of-schedule frequency of the tasks in the second task group is greater than the minimum out-of-schedule frequency of the tasks in the target task group, executing the step of migrating the task corresponding to the maximum out-of-schedule frequency of the tasks in the second task group to the target task group.
Optionally, the scheduling, by the executor corresponding to the first task group, the target task to be executed in the first task group to the kernel according to a preset sequence includes:
the method comprises the steps that an actuator corresponding to a first task group determines a current unprocessed task in the first task group as a first current alternative task according to a preset sequence;
judging whether to receive the service data to be processed corresponding to the first current alternative task;
if so, generating a first task to be executed corresponding to the first current alternative task based on the service data to be processed corresponding to the first current alternative task, and scheduling the first task to the kernel;
If not, returning to the step of determining one current unprocessed task in the first task group as a current first alternative task according to a preset sequence through the corresponding executor of the first task group;
the scheduling, by the executor corresponding to each second task group, the target task to be executed in the second task group corresponding to the executor to the kernel according to the sequence of the over-period scheduling frequency from high to low includes:
determining a current unprocessed task in the second task group as a second current alternative task according to the sequence of the over-time scheduling frequency from high to low through the corresponding executors of each second task group;
judging whether to receive the service data to be processed corresponding to the second current alternative task;
if yes, generating a second task to be executed corresponding to the second current alternative task based on the service data to be processed corresponding to the second current alternative task, and scheduling the second task to the kernel;
and if not, returning to the step of determining one current unprocessed task in the second task group as a second current alternative task according to the sequence of the over-time scheduling frequency from high to low through the corresponding executor of each second task group.
Optionally, the method further comprises:
aiming at each target task to be executed, calculating the execution time length of the target task to be executed when the execution of the target task to be executed is finished;
if the execution time length of the target task to be executed is longer than the preset time length, adding 1 to the out-of-time scheduling frequency of the target task to be executed;
if the execution time length of the target task to be executed is not longer than the preset time length, setting the out-of-time scheduling frequency of the target task to be executed to be 0.
Optionally, the I/O intensive task represents a driving task that requires data transmission; the non-I/O intensive tasks represent driving tasks that do not require data transmission.
Optionally, the I/O intensive tasks include: sensor reading tasks and/or decision control tasks; the sensor reading task is used for reading collected environmental data of the vehicle from the sensor; the decision control task is used for determining control parameters of driving components of the vehicle;
the non-I/O intensive tasks include at least one of: combining a positioning task, a target perception task, a scene modeling task and a path planning task; the combined positioning task is used for determining the position of the vehicle; the target perception task is used for determining targets around the vehicle; the scene modeling task is used for establishing a virtual scene of the environment where the vehicle is located; the path planning task is used for determining a driving path of the vehicle.
In order to achieve the above object, an embodiment of the present application discloses a task scheduling device, including:
the target task to be executed acquisition module is used for acquiring a plurality of target tasks to be executed;
the over-time scheduling frequency determining module is used for determining the over-time scheduling frequency of the current moment of each target task to be executed; wherein, the out-of-schedule scheduling frequency of a target task to be executed represents: continuously overtime scheduling the times of the target task to be executed in a preset historical time;
and the scheduling module is used for scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-period scheduling frequency from high to low.
Optionally, the apparatus further includes:
a grouping module, configured to divide all tasks into a plurality of task groups before the obtaining a plurality of target tasks to be executed, where I/O-intensive tasks are assigned to a first task group with a highest priority, and non-I/O-intensive tasks are assigned to the first task group or one or more second task groups with a lower priority than the first task group based on a historical out-of-date scheduling frequency;
the target task to be executed acquisition module comprises:
an execution sub-module for starting an actuator for each task group; the priority of each executor is consistent with the priority of the corresponding task group;
The target task to be executed acquisition module is used for respectively acquiring a plurality of target tasks to be executed in the task group corresponding to each executor;
the scheduling module comprises:
the first scheduling sub-module is used for scheduling the target tasks to be executed in the first task group to the kernel according to a preset sequence through the executors corresponding to the first task group; wherein the preset sequence represents: the I/O intensive tasks are prioritized over the non-I/O intensive tasks, and the non-I/O intensive tasks are in sequence from high to low according to the out-of-date scheduling frequency;
and/or the number of the groups of groups,
the second scheduling sub-module is used for scheduling the target tasks to be executed in the second task groups corresponding to the actuators to the kernel according to the sequence of the out-of-date scheduling frequency from high to low through the actuators corresponding to the second task groups; so that the kernel executes the received task to be executed according to the priority of each executor.
Optionally, when the number of the second task groups is multiple, priorities of the second task groups are different;
the apparatus further comprises:
the judging module is used for judging whether the maximum out-of-time scheduling frequency of the tasks in each second task group is larger than a preset threshold value or not according to each second task group when the preset moment is reached;
The first processing module is configured to migrate a task corresponding to the maximum out-of-schedule scheduling frequency of the task in the second task group to a target task group if the maximum out-of-schedule scheduling frequency of the task in the second task group is greater than a preset threshold, where the priority of the target task group is higher than the priority of the second task group, and the priority of the target task group and the priority of the second task group are adjacent priorities; and/or the number of the groups of groups,
and the second processing module is used for migrating the task corresponding to the minimum out-of-date scheduling frequency of the tasks in the target task group to the second task group.
Optionally, the apparatus further includes:
the second judging module is used for judging whether the maximum over-time scheduling frequency of the tasks in the second task group is larger than the minimum over-time scheduling frequency of the tasks in the target task group before the tasks corresponding to the maximum over-time scheduling frequency of the tasks in the second task group are migrated to the target task group;
and if the maximum out-of-schedule frequency of the tasks in the second task group is greater than the minimum out-of-schedule frequency of the tasks in the target task group, triggering the first processing module.
Optionally, the first scheduling sub-module includes:
the first processing unit is used for determining one current unprocessed task in the first task group as a first current alternative task according to a preset sequence through the corresponding executor of the first task group;
the first judging unit is used for judging whether to receive the service data to be processed corresponding to the first current alternative task; if yes, triggering a first scheduling unit, and if not, triggering the first processing unit;
the first scheduling unit is configured to generate a first task to be executed corresponding to the first current candidate task based on the service data to be processed corresponding to the first current candidate task, and schedule the first task to the kernel;
the second scheduling sub-module includes:
the second processing unit is used for determining one current unprocessed task in the second task group as a second current alternative task according to the sequence of the over-time scheduling frequency from high to low through the corresponding executor of each second task group;
the first judging unit is used for judging whether to receive the service data to be processed corresponding to the second current alternative task; if yes, triggering a second scheduling unit, and if not, triggering the second processing unit;
The second scheduling unit is configured to generate a second task to be executed corresponding to the second current candidate task based on the service data to be processed corresponding to the second current candidate task, and schedule the second task to the kernel.
Optionally, the apparatus further includes:
the execution duration calculation module is used for calculating the execution duration of each target task to be executed when the execution of the target task to be executed is finished;
the third processing module is used for adding 1 to the out-of-time scheduling frequency of the target task to be executed if the execution time of the target task to be executed is longer than the preset time;
and the fourth processing module is used for setting the out-of-time scheduling frequency of the target task to be executed to be 0 if the execution duration of the target task to be executed is not longer than the preset duration.
Optionally, the I/O intensive task represents a driving task requiring data transmission; the non-I/O intensive tasks represent driving tasks that do not require data transmission.
Optionally, the I/O intensive tasks include: sensor reading tasks and/or decision control tasks; the sensor reading task is used for reading collected environmental data of the vehicle from the sensor; the decision control task is used for determining control parameters of driving components of the vehicle;
The non-I/O intensive tasks include at least one of: combining a positioning task, a target perception task, a scene modeling task and a path planning task; the combined positioning task is used for determining the position of the vehicle; the target perception task is used for determining targets around the vehicle; the scene modeling task is used for establishing a virtual scene of the environment where the vehicle is located; the path planning task is used for determining a driving path of the vehicle.
In order to achieve the above object, an embodiment of the present application discloses an automatic driving system, including: a processor; wherein:
the processor is used for obtaining a plurality of target tasks to be executed; determining out-of-period scheduling frequency of the current moment of the driving task to be executed by each target; wherein, the out-of-date dispatch frequency of a target to-be-executed driving task represents: continuously overtime scheduling the times of the target to-be-executed driving task in a preset historical time; scheduling the driving tasks to be executed of each target to the kernel of the processor according to the sequence of the over-time scheduling frequency from high to low; and executing the received driving tasks to be executed by the targets through the kernel.
Optionally, the automatic driving system further comprises a sensor and a target vehicle; the target vehicle comprises a whole vehicle controller and a driving component;
the sensor is used for collecting environmental data of the target vehicle;
the processor is used for executing the received driving task to be executed through the kernel, acquiring the environmental data from the sensor, determining control parameters of driving components of the target vehicle based on the environmental data, and sending the control parameters to the whole vehicle controller;
the whole vehicle controller is used for controlling driving components of the target vehicle based on the control parameters.
In another aspect of the application, in order to achieve the above object, an embodiment of the application further discloses an electronic device, where the electronic device includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the task scheduling method according to the first aspect when executing the program stored in the memory.
In yet another aspect of the application, there is further provided a computer readable storage medium, in which a computer program is stored, which when executed by a processor, implements the task scheduling method according to the first aspect.
In yet another aspect of the application, embodiments of the application further provide a computer program product containing instructions that, when run on a computer, cause the computer to perform the task scheduling method of the first aspect described above.
The embodiment of the application provides a task scheduling method, which can obtain a plurality of target tasks to be executed; determining out-of-period scheduling frequency of the current moment of each target task to be executed; wherein, the out-of-schedule scheduling frequency of a target task to be executed represents: continuously overtime scheduling the times of the target task to be executed in a preset historical time; and scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-time scheduling frequency from high to low.
Based on the above processing, tasks with higher over-time scheduling frequency can be scheduled preferentially. In some special scenarios, if the scenario has a larger influence on some tasks, the task is scheduled more frequently than the task is scheduled in an out-of-date mode, and then the task can be scheduled preferentially. That is, for a special scenario, tasks that are greatly affected by the scenario may be scheduled preferentially, so as to ensure that such tasks are completed in time, rather than scheduling tasks according to a fixed scheduling order, and further, the reliability of task scheduling is improved.
Of course, not all of the above-described advantages need be achieved simultaneously in practicing any one of the products or methods of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a task scheduling method provided in an embodiment of the present application;
FIG. 2 is a flowchart of another task scheduling method according to an embodiment of the present application;
FIG. 3 is a flow chart of a task grouping adjustment in task scheduling according to an embodiment of the present application;
fig. 4 is a schematic diagram of a task state switching process according to an embodiment of the present application;
FIG. 5 is a flowchart for updating the over-time scheduling frequency in task scheduling according to an embodiment of the present application;
FIG. 6 is a flowchart of another method for updating the over-time scheduling frequency during task scheduling according to an embodiment of the present application;
fig. 7A is a block diagram of an autopilot system according to an embodiment of the present application;
Fig. 7B is a schematic diagram of a task scheduling principle according to an embodiment of the present application;
fig. 8 is a block diagram of a task scheduling device according to an embodiment of the present application;
fig. 9 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
In the related art, for some special scenarios, the electronic device for processing tasks still schedules the tasks to be executed to the kernel of the CPU (central processing unit ) according to the preset scheduling sequence for execution, which may cause some tasks to be unable to be completed in time, and reduce the reliability of task scheduling.
In order to solve the above problem, an embodiment of the present application provides a task scheduling method, referring to fig. 1, and fig. 1 is a flowchart of a task scheduling method provided in an embodiment of the present application, where the method may include the following steps:
S101: and obtaining a plurality of target tasks to be executed.
S102: and determining the out-of-date scheduling frequency of the current moment of each target task to be executed.
Wherein, the out-of-schedule scheduling frequency of a target task to be executed represents: and continuously and overtime scheduling the times of the target task to be executed in the preset historical time.
S103: and scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-time scheduling frequency from high to low.
The task scheduling method provided by the embodiment of the application can be used for preferentially scheduling the tasks with higher out-of-schedule scheduling frequency. In some special scenarios, if the scenario has a larger influence on some tasks, the task is scheduled more frequently than the task is scheduled in an out-of-date mode, and then the task can be scheduled preferentially. That is, for a special scenario, tasks that are greatly affected by the scenario may be scheduled preferentially, so as to ensure that such tasks are completed in time, rather than scheduling tasks according to a fixed scheduling order, and further, the reliability of task scheduling is improved.
In one embodiment, the target task to be executed may be a task to be currently executed among all tasks, that is, a task for which there is currently traffic data to be processed.
In one embodiment, all tasks may also be grouped to improve the efficiency of task scheduling. Referring to fig. 2, before step S101, the method may further include the steps of:
S104: all tasks are divided into a plurality of task groups.
Wherein I/O-intensive tasks are assigned to a first task group with highest priority and non-I/O-intensive tasks are assigned to the first task group or one or more second task groups with lower priority than the first task group based on historical out-of-schedule frequency.
Accordingly, the step S101 may include the steps of:
s1011: one actuator is activated for each task group.
Wherein the priority of each actuator is consistent with the priority of the corresponding task group.
S1012: and respectively acquiring a plurality of target tasks to be executed in the task group corresponding to each executor.
The step S103 may include at least one of the following steps:
s1031: and scheduling the target tasks to be executed in the first task group to the kernel according to a preset sequence by the executors corresponding to the first task group.
S1032: and scheduling the target tasks to be executed in the second task groups corresponding to the actuators to the kernel according to the sequence of the over-period scheduling frequency from high to low through the actuators corresponding to the second task groups.
Wherein, the preset sequence represents: I/O-intensive tasks take precedence over non-I/O-intensive tasks, and non-I/O-intensive tasks are ordered from high to low in an out-of-schedule frequency.
Based on the above processing, the kernel can execute the received task to be executed according to the priority of each executor.
In the embodiments of the present application, tasks may be divided into I/O-intensive tasks and non-I/O-intensive tasks. non-I/O intensive tasks may include compute intensive tasks.
The I/O intensive tasks may represent: tasks involving network, disk I/O, which occupy less CPU resources, are waiting for I/O operations to complete most of the time. The computationally intensive tasks may represent: a large number of operations need to be performed, tasks consuming CPU resources are performed, and the number of the types of tasks is generally equal to the number of cores of the CPU.
In one embodiment, the target task to be performed may be a driving task. Correspondingly, the I/O intensive task represents a driving task requiring data transmission; non-I/O intensive tasks represent driving tasks that do not require data transmission.
The method of the embodiment of the application can be applied to electronic equipment, and the electronic equipment can acquire data from other equipment through a communication bus. For example, the electronic device may obtain the collected data from the sensor via a communication bus. In addition, the electronic device may also send data to other devices over the communication bus. For example, the electronic device may send control parameters of the driving components to a vehicle controller of the vehicle via a communication bus. In the above process, data transmission is involved, so the driving task involved in the above process may be an I/O intensive task.
In one embodiment, if the target task to be performed is a driving task, the I/O intensive tasks may include: sensor reading tasks and/or decision control tasks. non-I/O intensive tasks may include at least one of: combining a positioning task, a target perception task, a scene modeling task and a path planning task.
The sensor reading task is used for reading collected environment data of the vehicle from the sensor; the decision control task is used for determining control parameters of driving components of the vehicle; the combined positioning task is used for determining the position of the vehicle; the target perception task is used for determining targets around the vehicle; the scene modeling task is used for establishing a virtual scene of the environment where the vehicle is located; the path planning task is used to determine a travel path of the vehicle.
In the embodiment of the application, based on the sensor reading task, the environmental data of the vehicle collected by the sensor can be read from the sensor in the vehicle through the communication bus. Based on the decision control task, control parameters of the driving components of the vehicle (e.g., direction of steering wheel rotation, angle of steering wheel rotation, time of braking, etc.) may be determined and sent to the control unit of the vehicle via the communication bus. Through the object sensing task, objects around the vehicle can be determined, including static objects such as curbs, piers, roadblocks, and the like, and dynamic objects such as pedestrians, vehicles, and the like.
Typically, I/O-intensive tasks are more important than non-I/O-intensive tasks. For example, in the field of autopilot, I/O intensive tasks such as sensor device reading tasks and decision control tasks are preferentially guaranteed to be completed within a certain time.
In addition, the task groups obtained by grouping the tasks have different priorities, and each task group can correspond to one actuator. The priority of an actuator is consistent with the priority of the task group corresponding to the actuator.
In one embodiment, an actuator may be represented by a Thread Pool (Thread Pool), which may contain multiple threads, i.e., multiple threads in the same actuator may have the same priority, and different actuators may contain different priorities of threads. When the task in the task group has the service data to be processed, the kernel can wake up the executor corresponding to the task group, and then the executor can generate the task to be executed of the task with the service data to be processed, and dispatch the task to the kernel, and the kernel executes the received task to be executed. The executors are mutually independent, that is to say, threads in the executors work in parallel, and further, the parallel execution of tasks can be realized, and the task scheduling efficiency is improved.
In one embodiment, if multiple executors are bound to the same kernel, the kernel may execute the received task to be executed according to the priority of each executor. For example, the actuators bound to the kernel include an actuator 1 and an actuator 2, and the priority of the actuator 1 is lower than that of the actuator 2. Accordingly, if the kernel receives task 1 scheduled by a thread in the executor 1, it executes task 1. In the process of executing the task 1, if the kernel receives the task 2 scheduled by the thread in the executor 2, the kernel determines that the priority of the executor 1 is lower than that of the executor 2, at this time, the kernel can execute the task 2 preferentially, and execute the task 1 again after the execution of the task 2 is finished, so as to realize kernel preemption.
Therefore, if all tasks include I/O-intensive tasks and non-I/O-intensive tasks, in order to improve the efficiency of task scheduling while preferentially ensuring that the I/O-intensive tasks complete execution within a certain time, the I/O-intensive tasks may be assigned to the task group with the highest priority (i.e., the first task group). Meanwhile, non-I/O intensive tasks are assigned to a first task group or other task groups (i.e., a second task group) having a lower priority than the first task group based on the historical out-of-schedule frequency. That is, the I/O-intensive tasks only exist in the task group with the highest priority, and the non-I/O-intensive tasks may be distributed in the task group with other priorities, or may be distributed in the task group with the highest priority.
The second task group may be one or more. For example, the first task group may have a priority of "high-level", and the second task group may have a priority of "low-level"; if there are two second task groups, one of the second task groups may be "medium" in priority and the other second task group may be "low" in priority.
In one embodiment, the scheduling order between I/O intensive tasks in the first task group may be preset. If the first task group contains non-I/O-intensive tasks, the I/O-intensive tasks in the first task group are prioritized over the non-I/O-intensive tasks, that is, the actuators corresponding to the first task group schedule the I/O-intensive tasks in the first task group preferentially. Aiming at non-I/O intensive tasks in the first task group, the executors corresponding to the first task group are scheduled according to the sequence from high to low of the over-time scheduling frequency.
And for each second task group, the executor corresponding to the second task group schedules the non-I/O intensive tasks in the second task group according to the sequence from high to low of the over-time scheduling frequency.
For example, in the field of autopilot, sensor reading tasks and decision control tasks may be assigned to "advanced" task groups. The combined positioning task and the target perception task are distributed to a 'medium-level' task group, and the scene modeling task and the path planning task are respectively distributed to a 'low-level' task group.
In the process of executing tasks, the historical over-time scheduling frequency of each task in the 'middle-level' task group and the 'low-level' task group can be counted, the tasks and the target perception tasks are positioned aiming at the combination in the 'middle-level' task group, and the tasks can be executed according to the sequence from high to low according to the historical over-time scheduling frequency through corresponding executors; the scene modeling task and the path planning task in the low-level task group can be executed according to the sequence from high to low of the historical over-time scheduling frequency through corresponding executors. The order of execution of the sensor reading tasks and decision control tasks in the "advanced" task group may be fixed.
Correspondingly, if the current determined historical out-of-schedule scheduling frequency of the scene modeling task is higher than the historical out-of-schedule scheduling frequency of the combined positioning task, the scene modeling task can be distributed to a middle-level task group, and the combined positioning task can be distributed to a low-level task group. Further, the tasks in the adjusted task groups may be executed by the actuators corresponding to the task groups. Until the next adjustment moment.
When the next adjustment time is reached, the historical out-of-schedule frequency of each task in the 'middle' task group and the 'low' task group can be determined again. If the determined historical out-of-schedule frequency of the path planning task is higher than the historical out-of-schedule frequency of the target perception task, the path planning task can be distributed to a 'middle-level' task group, and the target perception task can be distributed to a 'low-level' task group. Further, the tasks in the adjusted task groups may be executed by the actuators corresponding to the task groups. Until the next adjustment instant, and so on.
In one embodiment, when the number of the second task groups is a plurality, the priorities of the second task groups are different, and accordingly, referring to fig. 3, the method may further include the steps of:
s301: when the preset time is reached, judging whether the maximum out-of-schedule scheduling frequency of the tasks in each second task group is larger than a preset threshold value or not according to each second task group.
S302: if the maximum out-of-schedule frequency of the tasks in the second task group is greater than a preset threshold, transferring the task corresponding to the maximum out-of-schedule frequency of the tasks in the second task group to a target task group; and/or migrating the task corresponding to the minimum out-of-schedule scheduling frequency of the tasks in the target task group to the second task group.
The priority of the target task group is higher than the priority of the second task group, and the priority of the target task group and the priority of the second task group are adjacent priorities.
In the embodiment of the present application, with continuous scheduling of tasks, the over-time scheduling frequency of each task may change, so that a task group to which a task belongs may be periodically adjusted according to the latest over-time scheduling frequency of the task. The duration of the period may be 5 seconds or, alternatively, may be 8 seconds, but is not limited thereto.
In one manner, when the preset time is reached, for each second task group, it may be determined whether the maximum out-of-schedule scheduling frequency of the tasks in the second task group is greater than a preset threshold. Each task group can correspond to a preset threshold, and the preset thresholds corresponding to the task groups are different.
If the maximum out-of-schedule frequency of the tasks in the second task group is greater than the preset threshold, the task corresponding to the maximum out-of-schedule frequency of the tasks in the second task group may be migrated to a task group with a higher priority (i.e., a target task group).
In addition, the task corresponding to the minimum out-of-schedule scheduling frequency of the tasks in the target task group can be migrated to the second task group.
Based on the processing, the tasks in each task group can be balanced, so that the load balance of each executor is realized, and the backlog of the tasks is avoided.
In one embodiment, the tasks in each task group may be ordered. For the first task group, the I/O-intensive tasks may be located before the non-I/O-intensive tasks, and the non-I/O-intensive tasks are arranged in order from high to low according to the out-of-schedule frequency. For the second task group, non-I/O intensive tasks are arranged in order from high to low according to the over-time scheduling frequency.
In one embodiment, I/O-intensive tasks are not related to over-schedule scheduling frequency, only by ensuring that non-I/O-intensive tasks are prioritized over the first task group. Accordingly, in the process of adjusting task grouping, only the grouping to which the non-I/O intensive task belongs is adjusted, and the I/O intensive task does not participate in adjustment, i.e., the I/O intensive task always belongs to the first task group with the highest priority and is prioritized over the non-I/O intensive task.
In one embodiment, prior to S302, the method may further comprise the steps of:
and judging whether the maximum out-of-schedule frequency of the tasks in the second task group is greater than the minimum out-of-schedule frequency of the tasks in the target task group. If the maximum overstock scheduling frequency of the tasks in the second task group is greater than the minimum overstock scheduling frequency of the tasks in the target task group, S302 is performed.
In this embodiment of the present application, if the maximum overstock scheduling frequency of the tasks in the second task group is greater than the preset threshold, it may be further determined whether the maximum overstock scheduling frequency of the tasks in the second task group is greater than the minimum overstock scheduling frequency of the tasks in the target task group.
If the maximum over-schedule frequency of the tasks in the second task group is greater than the minimum over-schedule frequency of the tasks in the target task group, the task group can be interchanged with the task corresponding to the maximum over-schedule frequency of the tasks in the second task group and the task corresponding to the minimum over-schedule frequency of the tasks in the target task group.
If the maximum overstock scheduling frequency of the tasks in the second task group is not greater than the minimum overstock scheduling frequency of the tasks in the target task group, the tasks corresponding to the maximum overstock scheduling frequency of the tasks in the second task group and the tasks corresponding to the minimum overstock scheduling frequency of the tasks in the target task group do not need to exchange task groups.
In one embodiment, the step S1031 may include the steps of:
step one: and determining one current unprocessed task in the first task group as a first current alternative task according to a preset sequence through the executor corresponding to the first task group.
Step two: and judging whether to receive the service data to be processed corresponding to the first current candidate task. If yes, executing the third step, and if not, executing the first step.
Step three: and generating a first task to be executed corresponding to the first current candidate task based on the service data to be processed corresponding to the first current candidate task, and scheduling the first task to the kernel.
In this embodiment of the present application, the threads in the executor corresponding to the first task group may traverse each task in the first task group according to a preset sequence, and further, may determine a next currently unprocessed task (i.e., a first currently candidate task).
And further, if the to-be-processed service data corresponding to the first current alternative task is received, generating a first to-be-executed task corresponding to the first current alternative task, and scheduling the first to-be-executed task to the kernel. If the service data to be processed corresponding to the first current candidate task is not received, the next unprocessed task can be determined.
In one embodiment, the step S1032 may include the steps of:
step 1: and determining one current unprocessed task in the second task group as a second current alternative task according to the sequence of the over-time scheduling frequency from high to low through the executors corresponding to the second task groups.
Step 2: and judging whether to receive the service data to be processed corresponding to the second current alternative task. If yes, step 3 is executed, and if no, step 1 is executed.
Step 3: and generating a second task to be executed corresponding to the second current candidate task based on the service data to be processed corresponding to the second current candidate task, and scheduling the second task to the kernel.
In this embodiment of the present application, the threads in the executor corresponding to the second task group may traverse each task in the second task group according to the sequence from high to low of the out-of-date scheduling frequency, so as to determine the next currently unprocessed task (i.e., the second currently candidate task).
And further, if the to-be-processed service data corresponding to the second current alternative task is received, generating a second to-be-executed task corresponding to the second current alternative task, and scheduling the second to-be-executed task to the kernel. If the service data to be processed corresponding to the second current candidate task is not received, the next unprocessed task can be determined.
In an embodiment, the state of the task may also be set, referring to fig. 4, and fig. 4 is a schematic diagram of a task state switching process provided in the embodiment of the present application.
In the process that the executor traverses the tasks in the task group, when traversing to a task to be in wait state, if determining that corresponding service data to be processed exists, the executor can generate a corresponding task to be executed, and switch the task to ready state. Further, the corresponding task to be executed may be scheduled to the kernel, executed by the kernel, and switched to a running state. When execution ends, the task may be switched to a finished state. For the task in the finish state, if the corresponding service data to be processed exist, the task can be switched to a ready state; if no corresponding service data to be processed exists, the task can be switched to the wait state.
In one embodiment, referring to fig. 5, the method may further comprise the steps of:
s501: and aiming at each target task to be executed, calculating the execution time length of the target task to be executed when the execution of the target task to be executed is finished.
S502: and if the execution time length of the target task to be executed is longer than the preset time length, adding 1 to the out-of-time scheduling frequency of the target task to be executed.
S503: if the execution time length of the target task to be executed is not longer than the preset time length, setting the out-of-time scheduling frequency of the target task to be executed to be 0.
In the embodiment of the present application, for each target task to be executed, when the execution of the target task to be executed is ended, the execution duration of the target task to be executed may be calculated.
For example, when the target task to be executed is scheduled to the kernel, the current time t1 may be recorded; when the execution of the target task to be executed is finished, the current time t2 may be recorded, and then te=t2-t 1 may be used as the execution duration of the target task to be executed.
In one implementation, the preset duration may be determined according to an average execution duration Ta of the target task to be executed. The average execution duration Ta of the target task to be executed may be an average value of execution durations of multiple executions of the target task to be executed in the historical period.
Further, the scheduling time duty ratio of the target task to be executed can be calculatedIf y is greater than a preset value y', determining that the execution duration of the target task to be executed is greater than a preset duration, otherwise, determining that the execution duration of the target task to be executed is not greater than the preset duration. />
If the execution duration of the target task to be executed is not longer than the preset duration, the target task to be executed is indicated to resume normal operation, and at this time, the out-of-date scheduling frequency of the target task to be executed can be set to 0.
Referring to fig. 6, fig. 6 is a flowchart for updating an over-time scheduling frequency according to an embodiment of the present application, which may include the following steps:
the executor may traverse the corresponding task group to determine the tasks of the ready and finished states.
After judging the task state type, aiming at the task in the finish state, judging whether the task to be processed business data is received or not, if not, switching the task into the wait state, and if so, switching into the ready state.
For the ready state task, a corresponding task to be executed can be generated and scheduled to the kernel to be executed by the kernel. And switching the task to a running state, and recording t1. At the end of execution, the task is switched to the finished state, t2 is recorded.
The execution duration te=t2-t 1 of the task is calculated, and it is judged whether the execution duration Te is greater than the average execution duration Ta.
And if the execution duration Te is not greater than the average execution duration Ta, setting the out-of-schedule frequency of the task to 0. If the execution duration Te is greater than the average execution duration Ta, calculating the scheduling time duty ratio of the taskFurther, it can be judged whether the scheduling time duty ratio y is greater than a preset value y'.
If the dispatching time duty ratio y is larger than a preset value y', adding 1 to the out-of-date dispatching frequency of the task; and if the scheduling time duty ratio y is not greater than a preset value y', setting the out-of-date scheduling frequency of the task to 0.
Further, it is possible to continue to judge whether or not the service data to be processed of the task is received.
The embodiment of the application also provides an automatic driving system, which may include: a processor.
The processor is used for obtaining a plurality of target tasks to be executed; determining out-of-period scheduling frequency of the current moment of the driving task to be executed by each target; wherein, the out-of-date dispatch frequency of a target to-be-executed driving task represents: continuously overtime scheduling the times of the target to-be-executed driving task in a preset historical time; scheduling each target driving task to be executed to the kernel of the processor according to the sequence of the over-time scheduling frequency from high to low; and executing the received driving tasks to be executed by the targets through the kernel.
In one embodiment, the processor may be connected to other devices via a communication bus. For example, the sensor may be connected to the vehicle controller via a communication bus, or may be connected to the vehicle controller via a communication bus.
In one embodiment, the autopilot system may further include a sensor and a target vehicle. The target vehicle comprises a whole vehicle controller and a driving component.
Correspondingly, the sensor is used for collecting the environmental data of the target vehicle.
And the processor is used for executing the received driving task to be executed through the kernel, acquiring the environmental data from the sensor, determining the control parameters of the driving component of the target vehicle based on the environmental data, and sending the control parameters to the whole vehicle controller.
And the whole vehicle controller is used for controlling driving components of the target vehicle based on the control parameters.
In one embodiment, the processor and the sensor may transmit data over a communication bus, and the processor and the vehicle controller may also transmit data over the communication bus.
The vehicle controller may be a VCU (Vehicle Control Unit, electric vehicle controller) or an HCU (Hybrid Control Unit, hybrid vehicle controller).
The sensor may include: cameras, global positioning systems (GPS, global Positioning System), inertial test units (IMU, inertial Measurement Unit), laser radar (LIDAR), millimeter wave radar, etc. The sensor may be disposed at a different position of the vehicle, for example, may be disposed at the roof of the vehicle or may be disposed at the tail of the vehicle. The environmental data collected by the above-mentioned sensor may include: the running speed of the vehicle, the running direction of the vehicle, an image of the surroundings of the vehicle, the distance of obstacles around the vehicle, the running speeds of other vehicles around the vehicle, and the like. A combined positioning task can be performed based on data acquired by the lidar, GPS and IMU; the target perception task may be performed based on data collected by the camera, lidar and millimeter wave radar.
The processor executes a sensor reading task through the kernel to acquire environmental data from the sensor through the communication bus; the path planning task can be executed to determine the driving path of the target vehicle, and then the decision control task is executed to determine the control parameters of the driving components of the target vehicle, and the control parameters are sent to the whole vehicle controller through the communication bus. Further, the vehicle controller may control the driving components of the target vehicle based on the control parameters so that the target vehicle travels along the determined travel path.
Correspondingly, fig. 7A is a block diagram of an autopilot system according to an embodiment of the present application.
In fig. 7A, the autopilot system may include a processor, sensors, and a target vehicle. The target vehicle may include a vehicle controller and a driving component. The sensors may include cameras, GPS, IMU, LIDAR, and RADAR.
The processor can execute a sensor reading task to acquire acquired data from the sensor through the communication bus, execute a combined positioning task, a target sensing task, a scene modeling task, a path planning task and a decision control task based on the acquired data to determine control parameters of the driving component, and send the control parameters to the whole vehicle controller through the communication bus. The overall vehicle controller may then control the driving components of the vehicle based on the control parameters.
Referring to fig. 7B, fig. 7B is a schematic diagram of a task scheduling principle according to an embodiment of the present application.
In fig. 7B, tasks may be divided into three task groups, with priorities of "high-level", "medium-level", and "low-level", respectively. Each task group corresponds to an actuator, and the priority of the actuator is consistent with the priority of the corresponding task group. The computing unit may include multiple core CPUs 0 -CPU n . Each executor is responsible for scheduling the task to be executed in the corresponding task group to the kernel in the computing unit, and the task to be executed is executed by the kernel.
Wherein the I/O intensive tasks belong to an advanced task group, and the computation intensive tasks are distributed among the three task groups. In the advanced task group, I/O-intensive tasks are prioritized over computation-intensive tasks, and the computation-intensive tasks are ordered from high to low according to an out-of-date scheduling frequency. And in the middle-level task group and the low-level task group, the computationally intensive tasks are ordered from high to low according to the over-time scheduling frequency.
The scheduler is responsible for scheduling tasks, and specifically, the scheduler can update a task group to which the computationally intensive task belongs according to the task type, the state of the task, the average execution time length of the task, a preset value y' and the out-of-date scheduling frequency.
In fig. 7B, one actuator may be represented by a Thread Pool (Thread Pool), and one Thread Pool may include multiple threads, that is, multiple threads in the same actuator may have the same priority, and different actuators may include threads having different priorities. The executors are mutually independent, that is to say, threads in the executors work in parallel, and further, the parallel execution of tasks can be realized, and the task scheduling efficiency is improved.
Based on the same inventive concept, the embodiment of the present application further provides a task scheduling device, referring to fig. 8, and fig. 8 is a structural diagram of the task scheduling device provided in the embodiment of the present application, which may include:
a target task to be executed acquisition module 801, configured to acquire a plurality of target tasks to be executed;
the over-time scheduling frequency determining module 802 is configured to determine an over-time scheduling frequency of a current time of each target task to be executed; wherein, the out-of-schedule scheduling frequency of a target task to be executed represents: continuously overtime scheduling the times of the target task to be executed in a preset historical time;
and the scheduling module 803 is configured to schedule the tasks to be executed of the targets to the kernel for execution according to the order of the over-period scheduling frequency from high to low.
Optionally, the apparatus further includes:
a grouping module, configured to divide all tasks into a plurality of task groups before the obtaining a plurality of target tasks to be executed, where I/O-intensive tasks are assigned to a first task group with a highest priority, and non-I/O-intensive tasks are assigned to the first task group or one or more second task groups with a lower priority than the first task group based on a historical out-of-date scheduling frequency;
the target task to be executed obtaining module 801 includes:
an execution sub-module for starting an actuator for each task group; the priority of each executor is consistent with the priority of the corresponding task group;
the target task to be executed acquisition module is used for respectively acquiring a plurality of target tasks to be executed in the task group corresponding to each executor;
the scheduling module 803 includes:
the first scheduling sub-module is used for scheduling the target tasks to be executed in the first task group to the kernel according to a preset sequence through the executors corresponding to the first task group; wherein the preset sequence represents: the I/O intensive tasks are prioritized over the non-I/O intensive tasks, and the non-I/O intensive tasks are in sequence from high to low according to the out-of-date scheduling frequency;
And/or the number of the groups of groups,
the second scheduling sub-module is used for scheduling the target tasks to be executed in the second task groups corresponding to the actuators to the kernel according to the sequence of the out-of-date scheduling frequency from high to low through the actuators corresponding to the second task groups; so that the kernel executes the received task to be executed according to the priority of each executor.
Optionally, when the number of the second task groups is multiple, priorities of the second task groups are different;
the apparatus further comprises:
the judging module is used for judging whether the maximum out-of-time scheduling frequency of the tasks in each second task group is larger than a preset threshold value or not according to each second task group when the preset moment is reached;
the first processing module is configured to migrate a task corresponding to the maximum out-of-schedule scheduling frequency of the task in the second task group to a target task group if the maximum out-of-schedule scheduling frequency of the task in the second task group is greater than a preset threshold, where the priority of the target task group is higher than the priority of the second task group, and the priority of the target task group and the priority of the second task group are adjacent priorities; and/or the number of the groups of groups,
and the second processing module is used for migrating the task corresponding to the minimum out-of-date scheduling frequency of the tasks in the target task group to the second task group.
Optionally, the apparatus further includes:
the second judging module is used for judging whether the maximum over-time scheduling frequency of the tasks in the second task group is larger than the minimum over-time scheduling frequency of the tasks in the target task group before the tasks corresponding to the maximum over-time scheduling frequency of the tasks in the second task group are migrated to the target task group;
and if the maximum out-of-schedule frequency of the tasks in the second task group is greater than the minimum out-of-schedule frequency of the tasks in the target task group, triggering the first processing module.
Optionally, the first scheduling sub-module includes:
the first processing unit is used for determining one current unprocessed task in the first task group as a first current alternative task according to a preset sequence through the corresponding executor of the first task group;
the first judging unit is used for judging whether to receive the service data to be processed corresponding to the first current alternative task; if yes, triggering a first scheduling unit, and if not, triggering the first processing unit;
the first scheduling unit is configured to generate a first task to be executed corresponding to the first current candidate task based on the service data to be processed corresponding to the first current candidate task, and schedule the first task to the kernel;
The second scheduling sub-module includes:
the second processing unit is used for determining one current unprocessed task in the second task group as a second current alternative task according to the sequence of the over-time scheduling frequency from high to low through the corresponding executor of each second task group;
the first judging unit is used for judging whether to receive the service data to be processed corresponding to the second current alternative task; if yes, triggering a second scheduling unit, and if not, triggering the second processing unit;
the second scheduling unit is configured to generate a second task to be executed corresponding to the second current candidate task based on the service data to be processed corresponding to the second current candidate task, and schedule the second task to the kernel.
Optionally, the apparatus further includes:
the execution duration calculation module is used for calculating the execution duration of each target task to be executed when the execution of the target task to be executed is finished;
the third processing module is used for adding 1 to the out-of-time scheduling frequency of the target task to be executed if the execution time of the target task to be executed is longer than the preset time;
and the fourth processing module is used for setting the out-of-time scheduling frequency of the target task to be executed to be 0 if the execution duration of the target task to be executed is not longer than the preset duration.
Optionally, the I/O intensive task represents a driving task that requires data transmission; the non-I/O intensive tasks represent driving tasks that do not require data transmission.
Optionally, the I/O intensive tasks include: sensor reading tasks and/or decision control tasks; the sensor reading task is used for reading collected environmental data of the vehicle from the sensor; the decision control task is used for determining control parameters of driving components of the vehicle;
the non-I/O intensive tasks include at least one of: combining a positioning task, a target perception task, a scene modeling task and a path planning task; the combined positioning task is used for determining the position of the vehicle; the target perception task is used for determining targets around the vehicle; the scene modeling task is used for establishing a virtual scene of the environment where the vehicle is located; the path planning task is used for determining a driving path of the vehicle.
The embodiment of the present application further provides an electronic device, as shown in fig. 9, including a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 perform communication with each other through the communication bus 904,
A memory 903 for storing a computer program;
the processor 901 is configured to execute a program stored in the memory 903, and implement the following steps:
obtaining a plurality of target tasks to be executed;
determining out-of-period scheduling frequency of the current moment of each target task to be executed; wherein, the out-of-schedule scheduling frequency of a target task to be executed represents: continuously overtime scheduling the times of the target task to be executed in a preset historical time;
and scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-time scheduling frequency from high to low.
The communication bus mentioned by the above electronic device may be a peripheral component interconnect standard (Peripheral Component Interconnect, abbreviated as PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated as EISA) bus, or the like. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The memory may include random access memory (Random Access Memory, RAM) or non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processor, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
The embodiment of the application also provides a computer readable storage medium, wherein instructions are stored in the computer readable storage medium, and when the instructions run on a computer, the computer is caused to execute the task scheduling method provided by the embodiment of the application.
Specifically, the task scheduling method includes:
obtaining a plurality of target tasks to be executed;
determining out-of-period scheduling frequency of the current moment of each target task to be executed; wherein, the out-of-schedule scheduling frequency of a target task to be executed represents: continuously overtime scheduling the times of the target task to be executed in a preset historical time;
and scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-time scheduling frequency from high to low.
It should be noted that other implementation manners of the task scheduling method are partially the same as those of the foregoing method embodiment, and are not repeated here.
The present embodiments also provide another computer program product containing instructions that, when executed on a computer, cause the computer to perform the task scheduling method provided by the embodiments of the present application.
Specifically, the task scheduling method includes:
obtaining a plurality of target tasks to be executed;
determining out-of-period scheduling frequency of the current moment of each target task to be executed; wherein, the out-of-schedule scheduling frequency of a target task to be executed represents: continuously overtime scheduling the times of the target task to be executed in a preset historical time;
and scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-time scheduling frequency from high to low.
It should be noted that other implementation manners of the task scheduling method are partially the same as those of the foregoing method embodiment, and are not repeated here.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the apparatus, electronic device, autopilot system, computer readable storage medium, computer program product embodiments, the description is relatively simple, as it is substantially similar to the method embodiments, as relevant see the partial description of the method embodiments.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application. Any modifications, equivalent substitutions, improvements, etc. that are within the spirit and principles of the present application are intended to be included within the scope of the present application.

Claims (9)

1. A method of task scheduling, the method comprising:
obtaining a plurality of target tasks to be executed;
determining out-of-period scheduling frequency of the current moment of each target task to be executed; wherein, the out-of-schedule scheduling frequency of a target task to be executed represents: continuously overtime scheduling the times of the target task to be executed in a preset historical time;
scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-time scheduling frequency from high to low;
before the obtaining the plurality of target tasks to be performed, the method further includes:
dividing all tasks into a plurality of task groups, wherein I/O intensive tasks are allocated to a first task group with highest priority, and non-I/O intensive tasks are allocated to the first task group or one or more second task groups with lower priority than the first task group based on historical over-time scheduling frequency;
the obtaining a plurality of target tasks to be executed includes:
Starting an actuator for each task group; the priority of each executor is consistent with the priority of the corresponding task group;
respectively obtaining a plurality of target tasks to be executed in a task group corresponding to each executor;
and scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-time scheduling frequency from high to low, wherein the method comprises the following steps:
scheduling the target tasks to be executed in the first task group to the kernel according to a preset sequence through the executors corresponding to the first task group; wherein the preset sequence represents: the I/O intensive tasks are prioritized over the non-I/O intensive tasks, and the non-I/O intensive tasks are in sequence from high to low according to the out-of-date scheduling frequency;
and/or the number of the groups of groups,
scheduling target tasks to be executed in the second task groups corresponding to the actuators to the kernel according to the sequence of the over-period scheduling frequency from high to low through the actuators corresponding to the second task groups; so that the kernel executes the received task to be executed according to the priority of each executor;
when the number of the second task groups is a plurality of, the priorities of the second task groups are different;
the method further comprises the steps of:
when reaching the preset moment, judging whether the maximum out-of-time scheduling frequency of the tasks in each second task group is larger than a preset threshold value or not according to each second task group;
If the maximum out-of-schedule scheduling frequency of the tasks in the second task group is greater than a preset threshold, transferring the task corresponding to the maximum out-of-schedule scheduling frequency of the tasks in the second task group to a target task group, wherein the priority of the target task group is higher than the priority of the second task group, and the priority of the target task group and the priority of the second task group are adjacent priorities; and/or the number of the groups of groups,
and transferring the task corresponding to the minimum out-of-date scheduling frequency of the tasks in the target task group to the second task group.
2. The method of claim 1, wherein before the task corresponding to the maximum overstocked frequency of tasks in the second task group is migrated to the target task group, the method further comprises:
judging whether the maximum out-of-schedule frequency of the tasks in the second task group is greater than the minimum out-of-schedule frequency of the tasks in the target task group;
and if the maximum out-of-schedule frequency of the tasks in the second task group is greater than the minimum out-of-schedule frequency of the tasks in the target task group, executing the step of migrating the task corresponding to the maximum out-of-schedule frequency of the tasks in the second task group to the target task group.
3. The method of claim 1, wherein the scheduling, by the executor corresponding to the first task group, the target task to be executed in the first task group to the kernel according to a preset order includes:
determining one current unprocessed task in the first task group as a first current alternative task according to a preset sequence through an actuator corresponding to the first task group;
judging whether to receive the service data to be processed corresponding to the first current alternative task;
if so, generating a first task to be executed corresponding to the first current alternative task based on the service data to be processed corresponding to the first current alternative task, and scheduling the first task to the kernel;
if not, returning to the step of determining one current unprocessed task in the first task group as a current first alternative task according to a preset sequence through the corresponding executor of the first task group;
the scheduling, by the executor corresponding to each second task group, the target task to be executed in the second task group corresponding to the executor to the kernel according to the sequence of the over-period scheduling frequency from high to low includes:
Determining a current unprocessed task in the second task group as a second current alternative task according to the sequence of the over-time scheduling frequency from high to low through the corresponding executors of each second task group;
judging whether to receive the service data to be processed corresponding to the second current alternative task;
if yes, generating a second task to be executed corresponding to the second current alternative task based on the service data to be processed corresponding to the second current alternative task, and scheduling the second task to the kernel;
and if not, returning to the step of determining one current unprocessed task in the second task group as a second current alternative task according to the sequence of the over-time scheduling frequency from high to low through the corresponding executor of each second task group.
4. The method according to claim 1, wherein the method further comprises:
aiming at each target task to be executed, calculating the execution time length of the target task to be executed when the execution of the target task to be executed is finished;
if the execution time length of the target task to be executed is longer than the preset time length, adding 1 to the out-of-time scheduling frequency of the target task to be executed;
if the execution time length of the target task to be executed is not longer than the preset time length, setting the out-of-time scheduling frequency of the target task to be executed to be 0.
5. The method of claim 1, wherein the I/O intensive tasks represent driving tasks that require data transmission; the non-I/O intensive tasks represent driving tasks that do not require data transmission.
6. The method of claim 5, wherein the I/O intensive tasks comprise: sensor reading tasks and/or decision control tasks; the sensor reading task is used for reading collected environmental data of the vehicle from the sensor; the decision control task is used for determining control parameters of driving components of the vehicle;
the non-I/O intensive tasks include at least one of: combining a positioning task, a target perception task, a scene modeling task and a path planning task; the combined positioning task is used for determining the position of the vehicle; the target perception task is used for determining targets around the vehicle; the scene modeling task is used for establishing a virtual scene of the environment where the vehicle is located; the path planning task is used for determining a driving path of the vehicle.
7. A task scheduling device, the device comprising:
the target task to be executed acquisition module is used for acquiring a plurality of target tasks to be executed;
The over-time scheduling frequency determining module is used for determining the over-time scheduling frequency of the current moment of each target task to be executed; wherein, the out-of-schedule scheduling frequency of a target task to be executed represents: continuously overtime scheduling the times of the target task to be executed in a preset historical time;
the scheduling module is used for scheduling the tasks to be executed of each target to the kernel for execution according to the sequence of the over-period scheduling frequency from high to low;
the apparatus further comprises:
a grouping module, configured to divide all tasks into a plurality of task groups before the obtaining a plurality of target tasks to be executed, where I/O-intensive tasks are assigned to a first task group with a highest priority, and non-I/O-intensive tasks are assigned to the first task group or one or more second task groups with a lower priority than the first task group based on a historical out-of-date scheduling frequency;
the target task to be executed acquisition module comprises:
an execution sub-module for starting an actuator for each task group; the priority of each executor is consistent with the priority of the corresponding task group;
the target task to be executed acquisition module is used for respectively acquiring a plurality of target tasks to be executed in the task group corresponding to each executor;
The scheduling module comprises:
the first scheduling sub-module is used for scheduling the target tasks to be executed in the first task group to the kernel according to a preset sequence through the executors corresponding to the first task group; wherein the preset sequence represents: the I/O intensive tasks are prioritized over the non-I/O intensive tasks, and the non-I/O intensive tasks are in sequence from high to low according to the out-of-date scheduling frequency;
and/or the number of the groups of groups,
the second scheduling sub-module is used for scheduling the target tasks to be executed in the second task groups corresponding to the actuators to the kernel according to the sequence of the out-of-date scheduling frequency from high to low through the actuators corresponding to the second task groups; so that the kernel executes the received task to be executed according to the priority of each executor;
when the number of the second task groups is a plurality of, the priorities of the second task groups are different;
the apparatus further comprises:
the judging module is used for judging whether the maximum out-of-time scheduling frequency of the tasks in each second task group is larger than a preset threshold value or not according to each second task group when the preset moment is reached;
the first processing module is configured to migrate a task corresponding to the maximum out-of-schedule scheduling frequency of the task in the second task group to a target task group if the maximum out-of-schedule scheduling frequency of the task in the second task group is greater than a preset threshold, where the priority of the target task group is higher than the priority of the second task group, and the priority of the target task group and the priority of the second task group are adjacent priorities; and/or the number of the groups of groups,
And the second processing module is used for migrating the task corresponding to the minimum out-of-date scheduling frequency of the tasks in the target task group to the second task group.
8. An autopilot system, characterized in that the autopilot system comprises: a processor; wherein:
the processor is used for obtaining a plurality of target tasks to be executed; determining out-of-period scheduling frequency of the current moment of the driving task to be executed by each target; wherein, the out-of-date dispatch frequency of a target to-be-executed driving task represents: continuously overtime scheduling the times of the target to-be-executed driving task in a preset historical time; scheduling the driving tasks to be executed of each target to the kernel of the processor according to the sequence of the over-time scheduling frequency from high to low; executing the received driving tasks to be executed of each target through the kernel;
the processor is further configured to divide all tasks into a plurality of task groups before the obtaining the plurality of target tasks to be executed, where I/O-intensive tasks are assigned to a first task group with a highest priority, and non-I/O-intensive tasks are assigned to the first task group or one or more second task groups with a lower priority than the first task group based on a historical out-of-schedule frequency;
The processor is specifically configured to start an actuator for each task group; the priority of each executor is consistent with the priority of the corresponding task group; respectively obtaining a plurality of target tasks to be executed in a task group corresponding to each executor; scheduling the target tasks to be executed in the first task group to the kernel according to a preset sequence through the executors corresponding to the first task group; wherein the preset sequence represents: the I/O intensive tasks are prioritized over the non-I/O intensive tasks, and the non-I/O intensive tasks are in sequence from high to low according to the out-of-date scheduling frequency; and/or scheduling the target tasks to be executed in the second task groups corresponding to the actuators to the kernel according to the sequence from high to low of the out-of-date scheduling frequency through the actuators corresponding to the second task groups; so that the kernel executes the received task to be executed according to the priority of each executor;
when the number of the second task groups is a plurality of, the priorities of the second task groups are different;
the processor is further configured to determine, for each second task group, whether a maximum out-of-schedule frequency of tasks in the second task group is greater than a preset threshold when a preset time is reached; if the maximum out-of-schedule scheduling frequency of the tasks in the second task group is greater than a preset threshold, transferring the task corresponding to the maximum out-of-schedule scheduling frequency of the tasks in the second task group to a target task group, wherein the priority of the target task group is higher than the priority of the second task group, and the priority of the target task group and the priority of the second task group are adjacent priorities; and/or migrating the task corresponding to the minimum out-of-schedule scheduling frequency of the tasks in the target task group to the second task group.
9. The autopilot system of claim 8 further comprising a sensor and a target vehicle; the target vehicle comprises a whole vehicle controller and a driving component;
the sensor is used for collecting environmental data of the target vehicle;
the processor is used for executing the received driving task to be executed through the kernel, acquiring the environmental data from the sensor, determining control parameters of driving components of the target vehicle based on the environmental data, and sending the control parameters to the whole vehicle controller;
the whole vehicle controller is used for controlling driving components of the target vehicle based on the control parameters.
CN202011639302.5A 2020-12-31 2020-12-31 Task scheduling method and device and automatic driving system Active CN112783619B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011639302.5A CN112783619B (en) 2020-12-31 2020-12-31 Task scheduling method and device and automatic driving system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011639302.5A CN112783619B (en) 2020-12-31 2020-12-31 Task scheduling method and device and automatic driving system

Publications (2)

Publication Number Publication Date
CN112783619A CN112783619A (en) 2021-05-11
CN112783619B true CN112783619B (en) 2024-01-02

Family

ID=75755110

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011639302.5A Active CN112783619B (en) 2020-12-31 2020-12-31 Task scheduling method and device and automatic driving system

Country Status (1)

Country Link
CN (1) CN112783619B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112508449B (en) * 2020-12-21 2023-06-30 北京元心科技有限公司 Task execution method, device, electronic equipment and computer readable storage medium
CN113254181B (en) * 2021-06-07 2022-03-18 中汽创智科技有限公司 Self-adaptive scheduling method and system
CN113867911A (en) * 2021-09-26 2021-12-31 聚好看科技股份有限公司 Task scheduling method and device and micro-service system
CN114780226B (en) * 2022-06-14 2022-09-16 小米汽车科技有限公司 Resource scheduling method and device, computer readable storage medium and vehicle
CN115658279B (en) * 2022-12-20 2023-04-07 华控清交信息科技(北京)有限公司 Ciphertext computing task scheduling method and device and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000148513A (en) * 1998-11-11 2000-05-30 Matsushita Electric Ind Co Ltd Method and device for controlling task
JP2002073354A (en) * 2000-08-29 2002-03-12 Ricoh Co Ltd Task control device and task contol method
WO2005098623A2 (en) * 2004-04-02 2005-10-20 Emulex Design & Manufacturing Corporation Prerequisite-based scheduler
US8661447B1 (en) * 2009-03-23 2014-02-25 Symantec Corporation Method and apparatus for managing execution of a plurality of computer tasks based on availability of computer resources
CN109144697A (en) * 2018-08-30 2019-01-04 百度在线网络技术(北京)有限公司 A kind of method for scheduling task, device, electronic equipment and storage medium
CN111694647A (en) * 2020-06-08 2020-09-22 北京百度网讯科技有限公司 Task scheduling method, device and storage medium for automatic driving vehicle

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10157079B2 (en) * 2016-10-18 2018-12-18 International Business Machines Corporation Resource allocation for tasks of unknown complexity

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000148513A (en) * 1998-11-11 2000-05-30 Matsushita Electric Ind Co Ltd Method and device for controlling task
JP2002073354A (en) * 2000-08-29 2002-03-12 Ricoh Co Ltd Task control device and task contol method
WO2005098623A2 (en) * 2004-04-02 2005-10-20 Emulex Design & Manufacturing Corporation Prerequisite-based scheduler
US8661447B1 (en) * 2009-03-23 2014-02-25 Symantec Corporation Method and apparatus for managing execution of a plurality of computer tasks based on availability of computer resources
CN109144697A (en) * 2018-08-30 2019-01-04 百度在线网络技术(北京)有限公司 A kind of method for scheduling task, device, electronic equipment and storage medium
CN111694647A (en) * 2020-06-08 2020-09-22 北京百度网讯科技有限公司 Task scheduling method, device and storage medium for automatic driving vehicle

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
一种基于资源可靠性的网格资源调度;欧攀;;软件导刊(09);33-35 *
基于统计分析的实时多任务流系统的最优调度;陈颖, 李在铭;系统工程与电子技术(01);63-66 *

Also Published As

Publication number Publication date
CN112783619A (en) 2021-05-11

Similar Documents

Publication Publication Date Title
CN112783619B (en) Task scheduling method and device and automatic driving system
US20200064842A1 (en) Autonomous vehicle fleet model training and testing
RU2654162C2 (en) Vehicle management and computation system
CN109213143B (en) Centralized scheduling system for operating cycles of use events for autonomous vehicles
EP3577528B1 (en) Enabling remote control of a vehicle
US11854404B2 (en) Computing timing intervals for vehicles through directional route corridor
WO2020227610A1 (en) Dynamic routing of vehicles through established corridors
CN111615067B (en) Automatic driving moving edge calculation method, equipment and storage medium based on road side unit
US20200393256A1 (en) Managing movement of vehicles through directional route corridors
CN110543148B (en) Task scheduling method and device
CN111586636B (en) Automatic driving vehicle rapid communication method, equipment and storage medium based on mixed traffic flow state
CN113298445B (en) Method and device for model training and unmanned equipment scheduling
CN114489976A (en) Cross-edge service migration method, device, equipment and computer readable medium
CN112258860B (en) Crossing vehicle scheduling method, device, equipment and computer readable storage medium
US11458996B2 (en) Systems and methods to enable reciprocation in vehicular micro cloud
EP4268164A1 (en) Route-based digital service management
CN113486452B (en) Method and device for remotely controlling unmanned equipment
WO2020252395A1 (en) Computing timing intervals for vehicles through directional route corridors
US11233717B2 (en) System and method for collaborative centralized latency characterization
KR102285963B1 (en) Method for scheduling a task using multi-node and apparatus thereof
CN114274977B (en) Automatic driving control method, device, equipment and storage medium
CN118134733A (en) Unmanned scheduling method and device, electronic equipment and storage medium
CN114757523B (en) Robot scheduling method, equipment and storage medium
CN114565304B (en) Unmanned vehicle dispatching method, electronic equipment and dispatching operation system
CN110691321B (en) Terminal control method, device and equipment

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
GR01 Patent grant
GR01 Patent grant