The Wayback Machine - https://web.archive.org/web/20090424065603/http://msdn.microsoft.com:80/en-us/library/ms795178.aspx
Windows Driver Kit: Kernel-Mode Driver Architecture
Introduction to Threaded DPCs

Threaded DPCs are available on Windows Vista and later versions of the Windows operating systems.

A threaded DPC is a DPC that the system executes at IRQL = PASSIVE_LEVEL. Threaded DPCs are enabled by default, but you can disable them by setting the HKLM\System\CCS\Control\SessionManager\Kernel\ThreadedDpcEnable registry key to zero. When threaded DPCs are disabled, they execute as ordinary DPCs.

An ordinary DPC preempts the execution of all threads, including real-time threads. If the system has a large number of ordinary DPCs queued, or if one of those DPCs runs for a long time, every thread will remain paused for an arbitrarily long time. Thus, each ordinary DPC increases system latency, which can hurt the performance of time-sensitive applications, such as audio or video playback.

Conversely, a threaded DPC can be preempted by a real-time thread that has a high-enough priority. Therefore, you should use threaded DPCs rather than an ordinary DPCs—unless a particular DPC must not be preempted even by real-time threads. (Threaded DPCs are preempted only by real-time threads, not by ordinary threads.) On server systems, where overall system performance is more important than system latency, threaded DPCs work in the identical manner as ordinary DPCs do. It is only on client systems, where a high system latency causes the system to appear unresponsive, that threaded DPCs can be preempted by real-time threads.

The system represents threaded DPCs (and ordinary DPCs) as KDPC structures. To initialize a KDPC structure for a threaded DPC, call the KeInitializeThreadedDpc routine, and pass it a CustomThreadedDpc routine that performs the action of the DPC.

Since a CustomThreadedDpc routine can execute at either PASSIVE_LEVEL or DISPATCH_LEVEL, you must ensure that your CustomThreadedDpc routine correctly synchronizes at both IRQLs. For more information about how to do so, see Synchronization And Threaded DPCs.

You must also ensure that your CustomThreadedDpc routine obeys all the restrictions for DISPATCH_LEVEL code. For more information, see Writing DPC Routines.

To add a threaded DPC to the DPC queue, call KeInsertQueueDpc. To remove a threaded DPC from the queue before it executes, call KeRemoveQueueDpc.



MSDN Library
Win32 and COM Development
Windows Driver Kit
Kernel-Mode Driver Architecture
Design Guide
Writing WDM Drivers
Managing Input/Output for Drivers
Servicing Interrupts
DPC Objects and DPCs
Threaded DPCs
Introduction to Threaded DPCs
Tags: 
 
Community Content