Prime Thread Count for Even Workload Distribution
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing thread pool management systems face inefficiencies when handling tasks that require specific order processing, as they often result in uneven workload distribution among worker threads due to the use of composite numbers, leading to idle or overloaded threads and suboptimal processor utilization.
Innovation Solution
Setting the number of worker threads to a prime number greater than the product of processing cores and a predetermined factor, with worker IDs being consecutive integers, and assigning tasks based on a numeric context ID modulo the number of worker threads to ensure even distribution and ordered processing.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If the number of worker threads is set to a composite number to match processing cores, then processor utilization is improved, but workload distribution becomes uneven leading to idle or overloaded threads
Solution Approach 1:
The patent changes the parameter of worker thread count from a composite number (matching processor cores) to a prime number. This parameter change ensures that when tasks are distributed using modulo operation, the workload is evenly distributed across all worker threads, preventing both idle and overloaded threads while maintaining high processor utilization.
2Device complexity
If a single queue is used to distribute tasks among threads, then system complexity is reduced, but tasks requiring specific order processing cannot be handled correctly
Solution Approach 1:
The patent uses the worker thread's unique identifier as a copying mechanism to determine task assignment. Each task is copied to the appropriate worker thread queue based on the modulo operation of the task ID and worker count. This simple copying approach maintains low system complexity while ensuring that tasks for the same worker are processed in order, guaranteeing reliability for ordered processing requirements.
3Productivity
If a complex management layer is implemented to ensure optimized processor utilization, then processor utilization is improved, but system complexity increases
Solution Approach 1:
The patent implements a self-service mechanism where tasks automatically assign themselves to appropriate worker threads using a simple modulo operation on their task ID. This eliminates the need for a complex management layer that would otherwise be required to track and balance workload across threads. The system achieves optimized processor utilization through this simple, decentralized self-service approach, reducing management layer complexity to minimal overhead.
Data Source
AI summary
A system and method for management of task allocation in a multi-core processing system. A controller of the processing unit may, at an initialization stage determine a number of worker threads to be a prime number not smaller than a multiplication of the number of the processing cores and a predetermined factor, assign a worker identification number (ID) to each worker thread, wherein the worker IDs are consecutive positive integers ranging from zero to the number of workers minus one. At a processing state the controller may receive from a dispatcher of the processing system a task associated with a numeric context ID and designate the task to one of the worker threads, wherein the worker ID of the designated worker thread equals the numeric context ID of the task, modulo the number of worker threads.


