Signal Daemon for Multi-Threaded Process Thread Selection
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current methods for selecting a software thread to handle signals in multi-threaded processes are time-consuming and inefficient, especially when dealing with large numbers of threads, as they often require searching the entire thread list and result in wasted processor cycles due to frequent resets and unnecessary searches.
Innovation Solution
Implementing a signal daemon that searches a subset of threads for a candidate thread to handle signals, with the option to invoke a signal daemon to continue the search if no suitable thread is found in the initial subset, thereby reducing the time spent holding system-wide spinlocks and enabling interrupt servicing.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the entire thread list is searched for candidate threads to handle signals, then all possible candidate threads are found, but the search time increases significantly and processor cycles are wasted
Solution Approach 1:
The patent segments the thread search process into two phases: first searching a limited subset of threads (e.g., thread pool threads) and if no candidate is found, then searching the remaining threads. This segmentation allows the system to quickly find candidate threads in most cases while ensuring completeness when necessary, thereby resolving the contradiction between search speed and reliability.
2Loss of time
If a per-process signalable thread list is maintained to reduce search scope, then search time is reduced for processes with mostly non-signalable threads, but the list may not be significantly shorter when most threads are signalable, and the structure becomes more complex
Solution Approach 1:
The patent dynamically adjusts the search scope based on the actual thread pool configuration and signal handling needs. Rather than maintaining a static per-process signalable thread list, the system adapts the search strategy to the current process context, selecting an appropriate subset of threads to search first based on the thread pool size and signal characteristics, thus avoiding the complexity of maintaining additional data structures.
3Loss of time
If a signal bit mask is used to mark completely blocked signals, then searches for masked signals are avoided, but frequent resets are required and full thread list searches are still needed to maintain up-to-date values
Solution Approach 1:
The patent performs preliminary filtering by searching a limited subset of threads first before proceeding to search the entire thread list. This preliminary action on a smaller subset reduces the average search time while maintaining the ability to find candidate threads when needed, avoiding the need for frequent mask resets and full list searches.
4Measurement precision
If system-wide spinlocks are held during thread searches, then thread search accuracy is maintained, but interrupt latency increases due to blocked interrupt servicing
Solution Approach 1:
The patent segments the thread search into phases where the spinlock is held only during the critical subset search and potentially released before searching the remaining threads. This segmentation reduces the duration that spinlocks are held, allowing interrupts to be serviced more quickly while maintaining search accuracy through the two-phase approach.
Data Source
AI summary
In an embodiment of the invention, an apparatus and method for a target thread selection in a multi-threaded process perform the steps of receiving a signal that may or may not be masked by threads in the process; and searching a thread subset for a target thread that can handle the signal. A signal daemon may search for the target thread if the target thread is not found in the thread subset.


