On a single processor system, raising the IRQL to DISPATCH_LEVEL or higher would have the same effect, because the raising of the IRQL prevents the interruption of the code currently executing.
We're not going to get too much into Locks and Deadlocks here, but for the sake of our discussion, an example would be a driver using a spin lock to protect data accessible at DISPATCH_LEVEL.
Drivers should use a lock that raises the IRQL to the highest level at which any code that could access the data can run. Since more than one thread could attempt to access shared data at the same time, drivers should protect the shared data by using some method of synchronization. Since each processor can be running at a different IRQL, you could have a situation where one processor is running a driver routine (Device Interrupt Level - aka DIRQL), while another processor is running driver code at IRQL 0. On a multi-processor system, things get a little complicated.
So far, this is pretty straightforward - especially when we're talking about a single processor system. Since the scheduler runs at DISPATCH_LEVEL, and that interrupt level is now blocked off by the thread at a higher IRQL, the thread scheduler cannot run and schedule any other thread. So if there is a thread that has an IRQL greater than 2, that thread will have exclusive use of the processor. A system will schedule all threads to run at IRQL's below DISPATCH_LEVEL - this level is also where the thread scheduler itself will run. Therefore, a processor currently at DISPATCH_LEVEL can only be interrupted by a request from an IRQL greater than 2. When a processor is running at a given IRQL, interrupts at that IRQL and lower are blocked by the processor. IRQL 2 is used for deferred procedure calls (DPC) and thread scheduling. An IRQL of 1 means that the processor is running an Asynchronous Procedure Call (APC) or Page Fault. An IRQL of 0 means that the processor is running a normal Kernel or User mode process. Processes running at a higher IRQL will pre-empt a thread or interrupt running at a lower IRQL.
The number of IRQL's and their specific values are processor-dependent. In the Windows Driver Model, a thread running at a low IRQL can be interrupted to run code at a higher IRQL. An interrupt request level (IRQL) defines the hardware priority at which a processor operates at any given time. If you develop device drivers or spend a lot of time debugging, IRQL's are familiar territory for you. Instead we're going to talk about Interrupt Request Levels - aka IRQL's. However, we're not going to be taking a trip down Television's Memory Lane today. When people first hear the term IRQL (pronounced Er-kel) their thoughts sometimes turn to the sitcom "Family Matters" and Jaleel White's alter ego, Steve Urkel. First published on TECHNET on Jan 22, 2008