Re: About time spend when processing Dispatch routine-?

From: “Roddy, Mark”
Sent: Tuesday, May 30, 2000 9:00 AM

[snip]

> Likewise, outside of J. Hanrahan, I have never heard of or seen a driver
> that considers the time spent inside its DPC routine. About the last thing
I
> would put into my dpc ‘loop’ is a test for elapsed time.

[snip]

Just a point of clarification for the original poster, Boris:

Dispatch Routine != DISPATCH_LEVEL

That is, if by “Dispatch routine”, you’re referring to a driver’s handler
functions for dispatching the various IRP_MJ_* function codes, note that
there is no relation between these routines and DISPATCH_LEVEL. This is a
just an unfortunate confusion of namings. The word “dispatch” has two
different meanings here.

IRP dispatch routines, especially those in top-level drivers, in fact mostly
execute at PASSIVE_LEVEL. Execution at DISPATCH_LEVEL usually occurs in
other kinds of driver routines, such as Completion Routines and obviously
Deferred Procedure Calls (DPCs).

So, Boris, what kind of driver routine exactly, did you mean to refer to by
the phrase “Dispatch routine”?

In any case, in general drivers should spend as little time as possible at
DISPATCH_LEVEL (or any IRQL above PASSIVE_LEVEL). All pre-emption
(threading) is disabled while at DISPATCH_LEVEL (at least for the current
CPU). This effectively suspends all threads while while your driver code
executes. The only thing that can pre-empt DISPATCH_LEVEL execution is a
hardware interrupt.

- Matt