Task Scheduling via Standby Thread Dispatch
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In unmanned vehicle systems, the frequent switching among threads in multi-core processors leads to resource wastage due to the need for context information protection and restoration, resulting in excessive overhead and limited task parallelism, which hampers performance and scalability.
Innovation Solution
A method where a main thread assigns newly triggered processing tasks with higher priority to a standby thread, utilizing the system kernel to dispatch processors based on task priority, thereby reducing unnecessary thread switching and optimizing resource allocation.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If frequent thread switching is performed in multi-core processors to execute processing tasks, then task parallelism and processor utilization are improved, but context information protection and restoration overhead increases, leading to resource wastage
Solution Approach 1:
The patent creates a standby thread in advance before processing tasks arrive. When a high-priority task needs to be executed, the system can switch to the pre-created standby thread without creating a new thread, thereby reducing the overhead of thread creation and context switching while maintaining the ability to handle multiple tasks efficiently
2Adaptability or versatility
If thread switching is performed to execute processing tasks, then task scheduling flexibility is improved, but context information protection and restoration is required, resulting in excessive overhead
Solution Approach 1:
The patent extracts the high-priority task execution function from the main thread by creating a separate standby thread. This allows the main thread to continue executing lower-priority tasks while the standby thread handles high-priority tasks independently, reducing the complexity of context switching and information protection by minimizing the frequency of switches between different task contexts
3Ease of operation
If existing multi-core system kernel allocates time slices based on task priority, then task execution is simplified, but high-priority tasks may experience delays when main threads are busy
Solution Approach 1:
The standby thread acts as an intermediary between the main thread and the high-priority task. When a high-priority task arrives and the main thread is busy, the task is assigned to the standby thread instead of waiting for the main thread to finish. This intermediary approach ensures high-priority tasks are executed promptly without complicating the overall task execution mechanism
Data Source
AI summary
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.


