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


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:

Before Posting...

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

How device scope affect Queues dispatching mode

remyavu10remyavu10 Member Posts: 58

I read that "device scope results in serialized calls to the I/O event callbacks for an individual device object".
If parallel dispatching mode is set for the queue, Would this 'device scope' causes serialized calls (sequential) calls to the I/O callbacks which driver registered for read, write and control?


  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,499


    Sync Scope Device locates a lock at the device level. Before calling any of your driver’s EvtIo Event Processing Callbacks, the Framework acquires this lock exclusive. That means that while one of your EvtIo callbacks (EvtIoRead, for example) is running no other such callback EvtIo callback can be made active. When it’s about to call, the Framework will just wait to acquire the lock.

    Note the lock is only held while the callback is in progress. As soon as the EvtIo routine holding the lock returns, the lock is release, and the next (one) such callback can run.

    And, let me add, that Sync Scope Device is rarely the right answer to anything. In most drivers where I’ve seen it used, it’s the result of the dev not really understanding the synchronization needs of their driver. I’m not saying I’ve never used it (I have... in a very complex driver I wrote last year). I’m just saying it’s rarely the best option (and, truth be told, if I had more time to work on that driver that I wrote where I used it, I wouldn’t have used it there either).


    Peter Viscarola

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,972

    Yes. One of the things I learned very early in my experience with KMDF is that the framework makes it very easy to oversynchronize yourself. Before I figured out their scheme, I had some very nasty hangs .

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • remyavu10remyavu10 Member Posts: 58
    edited August 2020
    Thanks all.
    Suppose, I have three different queues with sequential dispatching (for read, write and control). Does this device scope means, only one IO event callback function shall be in progress at anytime?
  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,499

    Does this device scope means, only one IO event callback function shall be in progress at anytime

    Yes. That’s what it means.

    Apparently I did not do a good job of explaining that in my initial reply.


    Peter Viscarola

  • remyavu10remyavu10 Member Posts: 58


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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!
Developing Minifilters 24 May 2021 Live, Online
Writing WDF Drivers 14 June 2021 Live, Online
Internals & Software Drivers 27 September 2021 Live, Online
Kernel Debugging 15 November 2021 Live, Online