Writing SynchCritSection Routines
Drivers use their SynchCritSection routines for either of two basic purposes:
Programming a device for an I/O operation
Accessing shared state information
Like an ISR, a SynchCritSection routine must execute as quickly as possible, doing only what is necessary to set up device registers or update context data, before returning.
Because KeSynchronizeExecution holds a device driver's interrupt spin lock while its SynchCritSection routine runs, the driver's ISR cannot execute until the SynchCritSection routine returns control.
For any received IRP, a device driver should do as much I/O processing as possible either at IRQL PASSIVE_LEVEL in its dispatch routines (or possibly device-dedicated threads), or at IRQL DISPATCH_LEVEL in its StartIo routine and DPC routines.
For additional information about how critical sections are synchronized, see Using Spin Locks: An Example.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for