Locks to be used for code that is not allowed to sleep (interrupt handlers), or that doesn't want to sleep (critical sections). Be very careful not to call functions which can sleep!
Originally intended for multiprocessor systems
Spinlocks never sleep and keep spinning
in a loop until the lock is available.
Spinlocks cause kernel preemption to be disabled
on the CPU executing them.
The critical section protected by a spinlock is not allowed to sleep.