Specifications
D
evice Driver Programming
9-18
Sleep Locks 9
Sleep locks are used for serializing access to shared resources when spin locks cannot be
used. At base level, basic locks and read/write locks cannot be used if there is a a possibil-
ity that the kernel might put the process to sleep while the lock is being held, as in the case
of a context switch. Sleep locks are blocking—the calling process is put to sleep until the
lock becomes available.
The sleep lock routines are as follows:
SLEEP_ALLOC(D3) Allocate and initialize a sleep lock
SLEEP_DEALLOC(D3) Deallocate an instance of a sleep lock
SLEEP_LOCK(D3) Acquire a sleep lock
SLEEP_LOCK_SIG(D3) Acquire a sleep lock (interruptible by signals)
SLEEP_LOCKAVAIL(D3) Query whether a sleep lock is available
SLEEP_LOCKOWNED(D3) Query whether a sleep lock is held by the caller
SLEEP_TRYLOCK(D3) Try to acquire a sleep lock
SLEEP_UNLOCK(D3) Release a sleep lock
Event Synchronization Primitives 9
Event synchronization primitives allow you to synchronize process execution with the
occurrence of a particular event. The kernel provides a set of routines that use a synchroni-
zation variable for this purpose. These routines are as follows:
SV_ALLOC(D3) Allocate and initialize a synchronization variable
SV_BROADCAST(D3) Wake up all processes sleeping on a synchronization
variable
SV_DEALLOC(D3) Deallocate an instance of a synchronization variable
SV_SIGNAL(D3) Wake up one process sleeping on a synchronization vari-
able
SV_WAIT(D3) Sleep on a synchronization variable
SV_WAIT_SIG(D3) Sleep on a synchronization variable (interruptible by a
signal)
Processor Priority Level Adjustment Routines 9
The kernel provides routines to block or allow servicing of hardware interrupts on a pro-
cessor. These routines prevent interrupts at or below a specified level from being serviced
on the processor on which the routine is called. By calling the routine spl3(), for exam-
ple, the driver prevents all interrupts at level 3 or lower from being received by the proces-