Certain executive interlocked operations silently ignore the spinlock when possible. For example, the
Low-IRQL Synchronization
Executive software outside the kernel also needs to synchronize access to global data structures in a multiprocessor environment. For example, the memory manager has only one page frame database, which it accesses as a global data structure, and device drivers need to ensure that they can gain exclusive access to their devices. By calling kernel functions, the executive can create a spinlock, acquire it, and release it.
Spinlocks only partially fill the executive’s needs for synchronization mechanisms, however. Because waiting for a spinlock literally stalls a processor, spinlocks can be used only under the following strictly limited circumstances:
The protected resource must be accessed quickly and without complicated interactions with other code.
The critical section code can’t be paged out of memory, can’t make references to pageable data, can’t call external procedures (including system services), and can’t generate interrupts or exceptions.
These restrictions are confining and can’t be met under all circumstances. Furthermore, the executive needs to perform other types of synchronization in addition to mutual exclusion, and it must also provide synchronization mechanisms to user mode.
There are several additional synchronization mechanisms for use when spinlocks are not suitable:
Kernel dispatcher objects
Fast mutexes and guarded mutexes
Pushlocks
Executive resources
Additionally, user-mode code, which also executes at low IRQL, must be able to have its own locking primitives. Windows supports various user-mode-specific primitives:
Condition variables (CondVars)
Slim Reader-Writer Locks (SRW Locks)
Run-once initialization (InitOnce)
Critical sections
We’ll take a look at the user-mode primitives and their underlying kernel-mode support later; for now, we’ll focus on kernel-mode objects. Table 3-18 serves as a reference that compares and contrasts the capabilities of these mechanisms and their interaction with kernel-mode APC delivery.
Exposed for Use by Device Drivers
Disables Normal Kernel-Mode APCs
Disables Special Kernel-Mode APCs
Supports Recursive Acquisition
Supports Shared and Exclusive Acquisition
Kernel dispatcher mutexes
Yes
Yes
No
Yes
No
Kernel dispatcher semaphores or events
Yes
No
No
No
No
Fast mutexes
Yes
Yes
Yes
No
No
Guarded mutexes
Yes
Yes
Yes
No
No
Pushlocks
No
No
No
No
Yes
Executive resources
Yes
No
No
Yes
Yes
Kernel Dispatcher Objects
The kernel furnishes additional synchronization mechanisms to the executive in the form of kernel objects, known collectively as
One other type of executive synchronization object worth noting is called an
Вильям Л Саймон , Вильям Саймон , Наталья Владимировна Макеева , Нора Робертс , Юрий Викторович Щербатых
Зарубежная компьютерная, околокомпьютерная литература / ОС и Сети, интернет / Короткие любовные романы / Психология / Прочая справочная литература / Образование и наука / Книги по IT / Словари и Энциклопедии