📝 Windows 7 Software interrupts: Asynchronous and deferred procedure calls (8 MCQs)
APCs and DPCs for Deferred Kernel Processing
Windows 7 uses Asynchronous Procedure Calls and Deferred Procedure Calls to schedule work outside the immediate execution of an interrupt service routine. A DPC performs deferred kernel work at a lower interrupt request level than the device ISR, while an APC arranges execution in a particular thread context. These mechanisms allow time-sensitive interrupt handling to remain relatively short.
Why Interrupt Handlers Must Avoid Lengthy Operations
Hardware interrupts can interrupt ordinary execution and may prevent lower-priority work from proceeding. Performing lengthy processing directly in an ISR increases interrupt latency and delays other devices. Windows therefore separates immediate hardware acknowledgement from work that can safely be postponed to a later execution context.
Interrupt, DPC Queue and APC Delivery
A device interrupt invokes an ISR, which acknowledges the device and may queue a DPC. The DPC runs later at DISPATCH_LEVEL to complete time-sensitive deferred work. An APC is queued to a target thread and executes when delivery is permitted, subject to alertable waits and APC type restrictions.
Example of Completing a Network Interrupt
A network adapter signals that packets have arrived. Its ISR acknowledges the interrupt and schedules a DPC. The DPC processes or arranges further packet handling without keeping the processor at the device's interrupt level. Additional work may be queued for worker threads when blocking operations are required.
Latency and Execution Context Constraints
DPCs reduce time spent in high-priority interrupt handling, but lengthy DPC routines can still delay ordinary threads. APCs support thread-directed work, yet their delivery depends on the target thread's state. Neither mechanism should be confused with an ordinary user-mode callback or a general replacement for thread scheduling.
Misconceptions About APCs and DPCs
'A DPC runs at the same interrupt level as its ISR' is false because it executes later at DISPATCH_LEVEL. 'Every APC executes immediately when queued' ignores delivery conditions. 'A DPC routine can safely perform blocking waits' is incorrect because DPC execution cannot wait like a passive-level thread.
Exam Focus: ISR, DPC and APC Execution Order
Trace device interrupt, ISR acknowledgement, DPC queuing, and deferred processing. Distinguish DPC execution level from APC thread context and passive-level worker routines. Questions may ask why an ISR must remain short or identify which mechanism can perform thread-specific deferred work.
Key Terms of Windows Deferred Processing
- ISR - Interrupt Service Routine.
- DPC - Deferred Procedure Call.
- APC - Asynchronous Procedure Call.
- IRQL - Interrupt Request Level.
- DISPATCH_LEVEL - Execution level used for DPC routines.
📝 All Windows 7 Software interrupts: Asynchronous and deferred procedure calls MCQs
Q1. What is a Deferred Procedure Call (DPC) in the Windows kernel?
Q2. Why does the Windows kernel use DPCs instead of performing all work inside the interrupt service routine (ISR)?
Q3. How does the priority ordering of DPCs affect the handling of multiple asynchronous events arriving simultaneously?
Q4. A network driver receives a packet interrupt. Which sequence correctly uses a DPC to process the packet while keeping the ISR short?
Q5. A developer wants to schedule a periodic task that runs every 10 ms without blocking the timer interrupt. Which kernel mechanism should be used?
Q6. During debugging, a system crash occurs after a DPC runs for an extended period. Which of the following is the most likely cause?
Q7. Two drivers queue DPCs at the same priority level. Driver X's DPC must complete before Driver Y's DPC can safely access a shared buffer. Which synchronization technique should the developers use?
Q8. What distinguishes an asynchronous software interrupt from a synchronous software interrupt in Windows?