Interrupt Synchronization

Writing reentrant code that executes at multiple IRQL levels requires attention to proper synchronization. This section examines the issues that arise in this kind of environment.

The Problem

If code executing at two different IRQLs attempts to access the same data structure simultaneously, the structure can become corrupted. Figure 5.1 illustrates the details of this synchronization problem.

To understand the exact problem, consider this sequence of events.

  1. Suppose code executing at a low IRQL decides to modify several fields in the foo data structure. For this example, the code executes to the point where the field foo.x is set to 1.

  2. An interrupt occurs and a higher-IRQL piece of code gets control of the processor. ...

Get Windows® 2000 Device Driver Book: A Guide for Programmers, Second Edition, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.