Task Scheduling via Data Block Segmentation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In multi-core processor environments, data contention occurs when multiple threads access the same data block concurrently, leading to performance overheads and difficulties in debugging concurrent errors, as existing solutions rely on lock mechanisms that introduce additional performance burdens.
Innovation Solution
A task scheduling method where each task is added to a task queue corresponding to a data block, and multiple threads execute tasks in different task queues, eliminating the need for locks and reducing contention by ensuring each thread operates on distinct data blocks, with idle threads managing waiting queues to optimize task execution.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a lock mechanism is introduced to avoid data contention when multiple threads access one data block concurrently, then data contention is avoided, but extra performance overheads are incurred
Solution Approach 1:
The patent divides the system into multiple independent data blocks, each with its own dedicated thread. This segmentation ensures that threads operate on separate data blocks simultaneously without interfering with each other, eliminating the need for lock mechanisms and avoiding the performance overhead associated with locks while maintaining data integrity.
2Reliability
If a lock mechanism is introduced to avoid data contention, then data access safety is improved, but difficulty in detecting and debugging concurrent errors increases
Solution Approach 1:
By assigning dedicated threads to specific data blocks, the patent creates isolated execution contexts that eliminate complex inter-thread dependencies. This segmentation makes the system behavior more predictable and easier to debug, as each thread operates independently on its own data block without requiring lock coordination with other threads.
3Productivity
If multiple threads are used to execute tasks concurrently on the same data block, then processing speed is improved, but data contention occurs
Solution Approach 1:
The patent segments both the computational work and the data by creating multiple data blocks and assigning dedicated threads to each. This allows the system to maintain high concurrent processing speed by utilizing multiple threads simultaneously, while avoiding data contention through the one-thread-per-data-block assignment model.
Solution Approach 2:
The patent resolves the contradiction by moving from a single-dimension model (multiple threads sharing one data block) to a two-dimension model (threads and data blocks in a many-to-many mapping where each thread has dedicated data blocks). This dimensional change allows concurrent access without contention by providing multiple independent access paths.
Data Source
Figure 1
Figure 2~3
Figure 4~5
AI summary
Embodiments of the present invention disclose a task scheduling method and apparatus, and relate to the field of computer technologies. Data contention caused by multiple threads accessing one data block at the same time when used to execute tasks in parallel may be avoided, extra performance overheads caused by introducing a lock may further be avoided, and difficulty in detecting and debugging a concurrent error may be reduced. A specific solution is: adding, according to correspondences between multiple to-be-executed tasks and M data blocks that are to be accessed by the multiple tasks, each task of the multiple tasks to a task queue of a data block corresponding to the task; using N threads to execute tasks in N task queues of M task queues in parallel, where each thread of the N threads executes a task in a task queue of the N task queues, different threads of the N threads execute tasks in different task queues, and 2≤N≤M. The present invention is used in a task scheduling process of a multi-core system.