Interrupt Synchronization via Message Queue and Lock-Free Algorithms
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing interrupt synchronization methods incur unnecessary overhead due to frequent switching between interrupt handler and driver threads, and require dedicated system resources, leading to inefficiencies in processing performance and memory consumption.
Innovation Solution
A method where the interrupt handler checks if a shared resource is locked, and if so, enqueues a request message; upon unlocking, the thread processes pending requests without additional context or thread switches, using lock-free and wait-free algorithms to manage concurrent access.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If frequent switching between interrupt handler and driver thread is used to synchronize access to shared resources, then data integrity is protected, but processing performance deteriorates due to overhead
Solution Approach 1:
The patent extracts the interrupt handler from the frequent context switching cycle by having it perform only the essential function of checking resource availability and enqueuing requests, while the actual resource access and processing is performed by the driver thread. This separation removes the performance penalty of frequent context switches while maintaining data integrity through the queue-based synchronization mechanism.
Solution Approach 2:
The interrupt handler performs preliminary action by checking if the shared resource is locked and enqueuing requests in advance. This allows the driver thread to process requests in order without requiring the interrupt handler to be repeatedly scheduled, thereby improving processing performance while maintaining reliability through the preliminary resource availability check.
2Reliability
If dedicated system resources are reserved for driver thread to ensure reliable interrupt processing, then reliability is improved, but memory consumption increases
Solution Approach 1:
The driver thread serves multiple functions: it processes interrupt requests, manages the message queue, and accesses shared resources. By consolidating these functions into a single thread rather than requiring dedicated resources for each function, the patent reduces overall memory consumption while maintaining reliable interrupt processing through the multi-functional driver thread.
Solution Approach 2:
The driver thread self-manages the processing of interrupt requests by retrieving them from the queue and executing the necessary operations. This self-service approach eliminates the need for additional dedicated system resources to monitor and manage interrupt processing, reducing memory consumption while ensuring reliable processing through the thread's autonomous operation.
3Extent of automation
If context switches are performed to handle interrupt requests, then interrupt processing is enabled, but processing overhead increases
Solution Approach 1:
The patent segments the interrupt processing into two distinct phases: the interrupt handler performs the segmentation of checking resource availability and enqueuing requests, while the driver thread performs the segmentation of retrieving and processing requests. This segmentation allows the interrupt handler to terminate quickly without full context switches, reducing processing overhead while maintaining automated interrupt processing capability.
Solution Approach 2:
The message queue acts as an intermediary between the interrupt handler and the driver thread. The interrupt handler deposits requests into this intermediary structure and can terminate without switching to the driver thread. The driver thread retrieves requests from the intermediary at its own pace. This intermediary mechanism enables automated interrupt processing while eliminating the overhead of frequent context switches.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
The invention concerns a method for synchronizing access to a shared resource between at least two threads of execution, the method, comprising the steps of retrieving (103) a request message from a queue (212) and, based on the request message, accessing (104) the shared resource, wherein the method comprises the precursory steps of checking (101), in a first thread of execution, whether the shared resource is locked by a further thread of execution and, in response to the shared resource being locked by the further thread of execution, enqueueing (102) the request message by the first thread of execution, the request message is retrieved (103) by the further thread of execution upon unlocking the shared resource and the shared resource is accessed (104) by the further thread of execution based on the request message. The invention further concerns a corresponding device, storage means, and software program (200, 300) therefore.