User-Mode Interrupt Handling With Lightweight Running Entity Switching
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Ensuring real-time performance of processing user mode interrupts in operating systems is challenging due to factors like preemption and core switching during interrupt processing, which affect the performance of drivers.
Innovation Solution
An interrupt processing method that replaces the common running entity with a simplified interrupt running entity, allowing for faster response times and avoiding operations like preemption or core switching by using an interrupt running entity resource pool with different priorities, ensuring timely processing of interrupts.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Speed
If a common running entity is used to process interrupts in user mode, then the interrupt processing can be flexible and maintainable, but the interrupt response speed is slow due to the complexity of the running entity
Solution Approach 1:
The patent segments the running entity into two distinct parts: a simplified interrupt running entity for interrupt processing and a common running entity for normal execution. The interrupt running entity contains only essential context information needed for interrupt handling, while the common running entity maintains the full set of thread state information. This segmentation allows the system to use a lightweight structure for time-critical interrupt processing while preserving the functionality of the complete running entity.
Solution Approach 2:
The patent extracts the essential components from the common running entity to create a minimal interrupt running entity. This extracted version contains only the critical context information required for interrupt processing, such as basic register states and control flags, while omitting non-essential elements. This extraction process directly reduces the complexity and size of the running entity used during interrupt handling.
2Reliability
If preemption or core switching is performed on an interrupt processing thread, then scheduling flexibility is improved, but real-time performance deteriorates due to additional operations during interrupt running
Solution Approach 1:
The patent applies different quality characteristics to different execution contexts. During interrupt processing, the system uses a simplified interrupt running entity with restricted scheduling operations to ensure deterministic real-time performance. During normal execution, the system uses the common running entity that allows full scheduling flexibility. This local differentiation of quality attributes allows the system to optimize for real-time performance when needed while maintaining scheduling flexibility when possible.
Solution Approach 2:
The patent implements dynamic switching between different running entity types based on execution context. The system dynamically transitions from the common running entity to the interrupt running entity when an interrupt occurs, and back to the common running entity after interrupt handling completes. This dynamic adaptation allows the system to adjust its behavior and characteristics according to the current operational requirements.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
Embodiments of this application provide an interrupt processing method and apparatus, and an electronic device. The method includes: when a first interrupt request is triggered, determining a target CPU that responds to the first interrupt request; determining a first target interrupt running entity in the target CPU; scheduling a target thread from a user mode to a kernel mode; replacing a running entity in the target thread with the first target interrupt running entity; and scheduling the target thread including the first target interrupt running entity to the user mode, and running the first target interrupt running entity by using the target CPU. According to the technical method, an interrupt running entity replaces a common running entity. Because the interrupt running entity includes less content, an interrupt response speed can be improved. In addition, an electronic device may sense interrupt running by using the interrupt running entity, to avoid an operation such as preemption or core switching performed on an interrupt processing thread due to interruption or scheduling during interrupt running, thereby ensuring real-time performance of the interrupt.