Locks, Deadlocks, and Synchronization

This paper explains how to use synchronization mechanisms to protect shared memory locations in kernel-mode drivers for the Microsoft Windows family of operating systems. By following the guidelines in this paper, driver writers will be able to determine when synchronization is required, what synchronization mechanisms are provided by the operating system, and how each type of synchronization mechanism is used.

Updated: April 5, 2006

File name: Locks.doc

328 KB

Microsoft Word file

Get Office File Viewers

click here to download


This paper builds on topics that are introduced in the companion white paper, Scheduling, Thread Context, and IRQL. Readers of this paper should be familiar with the information presented there. Included in this white paper:

  • Choosing a Synchronization Mechanism
  • Summary of Windows Synchronization Mechanisms
  • InterlockedXxx and ExInterlockedXxx Routines
  • Spin Locks
  • Fast Mutexes
  • Kernel Dispatcher Objects
  • Executive Resources
  • Callback Objects
  • Driver-defined Locks
  • Simultaneous Use of Multiple Synchronization Mechanisms
  • Preventing Deadlocks
  • Security Issues
  • Performance Issues
  • Best Practices for Driver Synchronization



Send comments about this topic to Microsoft