What are spin locks?
Spin locks are the fundamental and most common synchronization primitives used in in drivers. Three types of spin locks are supported for DDI drivers: (1) Simple (mutex) spin locks Spin locks are the fundamental and most common locking primitive provided by DDI; they are also sometimes known as simple locks, basic locks, or mutex locks. The context contending for the lock busy-waits until the lock is acquired at the requested IPL. Spin locks are non-recursive and provide access to shared resources where the context holding the lock cannot block. And in cases where the expected wait time does not warrant a context switch. Spin locks can be used to guard critical code regions that are relatively long if there is low contention for the resource protected by the lock. Spin locks must not be held when there is a possibility of a context switch. (2) Read/write spin locks Read/write spin locks are used when distinguishing the nature of access can enhance concurrency. Read locks permit multipl