IP Library Granted Patent US 11,294,714
Granted Patent B2
US 11,294,714 · App. 16/516,055 · Granted Apr 5, 2022

Method and apparatus for scheduling task, device and medium

Inventors: Chao Zhang (Beijing, CN); Zhuo Chen (Beijing, CN); Weifeng Yao (Beijing, CN); Liming Xia (Beijing, CN); Jiankang Xin (Beijing, CN); Chengliang Deng (Beijing, CN)
Assignee: Apollo Intelligent Driving Technology (Beijing) Co., Ltd.
G06F9/4881G06F9/5027
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,294,714
App. No.
16/516,055
Granted
Apr 5, 2022
Kind
B2
Abstract

The present disclosure provides a method and an apparatus for scheduling a task, a device and a medium. The method includes: obtaining a processing task to be executed from a task queue via a main thread bound to a processor, in which the processor is configured to execute the main thread, to execute the processing task; obtaining a newly triggered processing task; in response to determining that a priority of the newly triggered processing task is greater than or equal to a priority of the processing task executed on the main thread, assigning the newly triggered processing task to a standby thread; and dispatching and assigning a processor from at least one processor through the system kernel to execute the standby thread.

Claims (45)

1. A method for scheduling a task, comprising:

obtaining a processing task to be executed from a task queue via a main thread bound to a processor, wherein the processor is configured to execute the main thread, to execute the processing task;

obtaining a newly triggered processing task;

in response to determining that a priority of the newly triggered processing task is greater than a priority of the processing task executed on the main thread, assigning the newly triggered processing task to a standby thread without performing a switching operation on the main thread; and

dispatching and assigning a processor from at least one processor through a system kernel, to execute the standby thread;

wherein obtaining the newly triggered processing task comprises: traversing processing tasks contained in the task queue through the main thread to determine a processing task receiving an execution notification message as the newly triggered processing task;

wherein assigning the newly triggered processing task to the standby thread comprises: creating the standby thread or determining the standby thread from a set of standby threads; setting an execution priority for the standby thread, wherein the execution priority of the standby thread matches the priority of the newly trigged processing task; and assigning the newly trigged processing task to the standby thread.

2. The method according to claim 1 , wherein, dispatching and assigning the processor from the at least one processor by the system kernel to execute the standby thread comprises:

dispatching and assigning the processor from a plurality of processors to the standby thread through the system kernel, based on priorities of processing tasks on the standby thread and other threads.

3. The method according to claim 1 , wherein the priority of the processing task is determined according to sequences of processing tasks in the task queue or a topological relationship among the processing tasks in the task queue.

4. The method according to claim 1 , wherein,

the execution priority of the standby thread is greater than an execution priority of the main thread.

5. The method according to claim 1 , after creating the standby thread or determining the standby thread from the set of standby threads, further comprising:

configuring the standby thread such that the standby thread is executed by the processor bound to the main thread.

6. The method according to claim 1 , further comprising:

when an execution of the newly triggered processing task on the standby thread is completed, setting a state of the standby thread as a waiting state.

7. The method according to claim 1 , applicable to an unmanned vehicle system,

wherein the processing task corresponds to a functional module in the unmanned vehicle system, and the functional module at least comprises a planning module, a perception module and a driver module.

8. An electronic device, comprising:

one or more processors; and

a memory, configured to store one or more programs;

wherein when the one or more programs are executed by the one or more processors, the one or more processors are configured to:

obtain a processing task to be executed from a task queue via a main thread bound to a processor, in which the processor is configured to execute the main thread, to execute the processing task;

obtain a newly triggered processing task;

in response to determining that a priority of the newly triggered processing task is greater than a priority of the processing task executed on the main thread, assign the newly triggered processing task to a standby thread without performing a switching operation on the main thread; and

dispatch and assign a processor from at least one processor through a system kernel, to execute the standby thread;

wherein the one or more processors are configured to obtain the newly triggered processing task by: traversing processing tasks contained in the task queue through the main thread to determine a processing task receiving an execution notification message as the newly triggered processing task;

wherein the one or more processors are configured to assign the newly triggered processing task to the standby thread by: creating the standby thread or determining the standby thread from a set of standby threads; setting an execution priority for the standby thread, wherein the execution priority of the standby thread matches the priority of the newly trigged processing task; and assigning the newly trigged processing task to the standby thread.

9. The electronic device according to claim 8 , wherein the one or more processors are further configured to dispatch and assign the processor from the at least one processor by the system kernel to execute the standby thread by:

dispatching and assigning the processor from a plurality of processors to the standby thread through the system kernel, based on priorities of processing tasks on the standby thread and other threads.

10. The electronic device according to claim 8 , wherein the priority of the processing task is determined according to sequences of processing tasks in the task queue or a topological relationship among the processing tasks in the task queue.

11. The electronic device according to claim 8 , wherein the execution priority of the standby thread is greater than an execution priority of the main thread.

12. The electronic device according to claim 8 , wherein the one or more processors are further configured to configure the standby thread such that the standby thread is executed by the processor bound to the main thread.

13. The electronic device according to claim 8 , wherein the one or more processors are further configured to:

when an execution of the newly triggered processing task on the standby thread is completed, set a state of the standby thread as a waiting state.

14. The electronic device according to claim 8 , arranged to an unmanned vehicle system, wherein the processing task corresponds to a functional module in the unmanned vehicle system, and the functional module at least comprises a planning module, a perception module and a driver module.

15. A non-transitory computer readable storage medium, having a computer program stored therein, wherein when the computer program is executed by a processor, a method for scheduling a task is executed, the method comprises:

obtaining a processing task to be executed from a task queue via a main thread bound to a processor, wherein the processor is configured to execute the main thread, to execute the processing task;

obtaining a newly triggered processing task;

in response to determining that a priority of the newly triggered processing task is greater than a priority of the processing task executed on the main thread, assigning the newly triggered processing task to a standby thread without performing a switching operation on the main thread; and

dispatching and assigning a processor from at least one processor through a system kernel, to execute the standby thread;

wherein obtaining the newly triggered processing task comprises: traversing processing tasks contained in the task queue through the main thread to determine a processing task receiving an execution notification message as the newly triggered processing task;

wherein assigning the newly triggered processing task to the standby thread comprises: creating the standby thread or determining the standby thread from a set of standby threads; setting an execution priority for the standby thread, wherein the execution priority of the standby thread matches the priority of the newly trigged processing task; and assigning the newly trigged processing task to the standby thread.

16. The non-transitory computer readable storage medium according to claim 15 , wherein dispatching and assigning the processor from the at least one processor by the system kernel to execute the standby thread comprises:

dispatching and assigning the processor from a plurality of processors to the standby thread through the system kernel, based on priorities of processing tasks on the standby thread and other threads.

Assignments (3)
CORRECTIVE ASSIGNMENT TO CORRECT THE APPLICANT NAME PREVIOUSLY RECORDED AT REEL: 057933 FRAME: 0812. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT. Recorded Dec 28, 2021
From: BAIDU ONLINE NETWORK TECHNOLOGY (BEIJING) CO., LTD.
To: APOLLO INTELLIGENT DRIVING TECHNOLOGY (BEIJING) CO., LTD.
Reel/Frame 058594/0836 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 13, 2021
From: BAIDU ONLINE NETWORK TECHNOLOGY (BEIJING) CO., LTD.
To: APOLLO INTELLIGENT DRIVING (BEIJING) TECHNOLOGY CO., LTD.
Reel/Frame 057933/0812 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 26, 2019
From: ZHANG, CHAO; CHEN, ZHUO; YAO, WEIFENG; XIA, LIMING; XIN, JIANKANG; DENG, CHENGLIANG
To: BAIDU ONLINE NETWORK TECHNOLOGY (BEIJING) CO., LTD.
Reel/Frame 049867/0415 →
Priority Claims (1)
CN 201811003390.2 · Aug 30, 2018 · national
Continuity (1)
Related Publication 20200073709A1 · Mar 5, 2020