Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Re: About time spend when processing Dispatch routine-?

OSR_Community_UserOSR_Community_User Member Posts: 110,217
From: "Roddy, Mark" <[email protected]>
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
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 January 2023 Live, Online
Developing Minifilters 20 March 2023 Live, Online
Writing WDF Drivers TBD 2023 Live, Online
Internals & Software Drivers 17 April 2023 Live, Online