Direct Thread Switching Bypassing Run Queue
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current systems face inefficiencies in reducing wait time and CPU contention for a software thread that has been woken up, as it often has to wait in a run queue despite a resource being available, leading to unnecessary contention and wasted CPU consumption.
Innovation Solution
Implementing a system that allows direct switching of the woken-up thread onto the resource by using selection criteria such as CPU binding, locality-domain binding, and sleep time, thereby bypassing the run queue and reducing latency and contention.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the woken-up thread is placed in the run queue to wait for execution, then the scheduler can manage thread execution order, but the thread experiences increased wait time and CPU contention before accessing the available resource
Solution Approach 1:
The patent extracts the woken-up thread from the standard run queue mechanism and places it directly into a runnable state on the processor. This removes the thread from the queue-based waiting system, allowing immediate execution when the resource is available, thereby eliminating the wait time associated with run queue scheduling while maintaining scheduler control through alternative mechanisms.
Solution Approach 2:
The patent performs preliminary actions by pre-positioning the woken-up thread in a state ready for immediate execution before the resource becomes available. The thread is kept in a suspended state with all necessary context preserved, so that when the resource is released, the thread can be activated without going through the run queue waiting process, thus reducing latency.
2Productivity
If the woken-up thread waits in the run queue, then other threads can be scheduled, but the available resource remains unused and CPU cycles are wasted due to unnecessary contention
Solution Approach 1:
The patent extracts the woken-up thread from the run queue and places it directly into execution, removing the unnecessary intermediate waiting step. This allows the thread to immediately acquire and use the available resource, improving resource utilization and eliminating wasted CPU cycles that would otherwise be spent on contention and scheduling overhead.
Solution Approach 2:
The patent enables the woken-up thread to skip the run queue waiting phase and rush directly into execution. By bypassing the queue mechanism, the thread can immediately access the resource as soon as it becomes available, eliminating the time when the resource sits unused and preventing wasted CPU energy on unnecessary scheduling operations.
3Loss of time
If the woken-up thread is immediately activated without run queue, then wait time is reduced, but scheduler control and thread management complexity increase
Solution Approach 1:
The patent segments the thread management system into distinct states: suspended (waiting for resource), runnable (ready for execution), and running. By creating this segmentation, the system can move threads directly between suspended and runnable states without requiring run queue intervention, reducing wait time while maintaining manageable complexity through clear state transitions.
Solution Approach 2:
The patent introduces an intermediary mechanism (a direct activation path) between the resource availability signal and thread execution. This intermediary allows the scheduler to control thread activation without requiring the thread to pass through the run queue, thereby reducing wait time while maintaining scheduler authority through the intermediary control structure.
Data Source
AI summary
An embodiment of the invention provides an apparatus and a method for direct switching of software threads. The apparatus and method include performing acts including: issuing a wakeup call from a first thread to a second thread in a sleep state; removing the second thread from the sleep state; switching out the first thread from the resource; switching in the second thread to the resource; and running the second thread on the resource.


