Dispatcher database

Dispatcher database

Post by alex » Wed, 11 Mar 2009 23:10:28

from the documentation of KeSetEvent() routine, about the Wait parameter:

"If the Wait parameter is TRUE, the return to the caller is executed
without lowering IRQL or releasing the dispatcher database spin lock."

I know what a spinlock is, but I'm wondering about the structure it
protects. What is the dispatcher database? Looking at other docs,
"Locks, Deadlocks, and Synchronization" on MSDN, for instance, I read:

"The operating system manages all kernel dispatcher objects in the
kernel's dispatcher database (hence their name). To manipulate any of
these objects, the system must raise the IRQL to DISPATCH_LEVEL and
acquire the system-wide dispatcher lock, which protects the dispatcher

But it doesn't explain what the dispatcher database is. Can anyone shed
some light on it?


Dispatcher database

Post by Pavel A » Thu, 12 Mar 2009 00:49:36

This is a bunch of data that holds information
about threads and processors. Nothing more.

-- pa


Dispatcher database

Post by Volodymyr » Thu, 12 Mar 2009 20:51:37

The best way to answer this question is to analyze calls to
KiLockDispatcherDatabase in kernel, but since this function is not exported
it is problematic.

Truly speaking, I was unable to find something called struct DISP_DATABASE,
the database is spreaded over different structures in kernel. An example is
PRKPRCB (KeGetCurrentPrcb()), ExWorkerQueue, different fields in PKTHREAD,
more specifically: PriorityDecrement, Priority, BasePriority, DecrementCount
, Quantum etc.

Volodymyr M. Shcherbyna, blog: http://www.yqcomputer.com/
(This posting is provided "AS IS" with no warranties, and confers no

Dispatcher database

Post by Doron Hola » Fri, 13 Mar 2009 02:30:14

also note that this lock was completely removed for win7 so do not rely on
its existence in the future



This posting is provided "AS IS" with no warranties, and confers no rights.