It is categorically true of
any locking mechanism that you:
- Must "acquire" the lock before making any examination whatsoever of the data structure.
- Must leave the data struture in a logically-complete and stable state before unlocking it.
- Must spend the minimum amount of time possible with the lock held ... you cannot yield-control.
- After acquiring the lock again, you must start over completely from-scratch. Nothing that you might have "remembered" is valid.
The
"Big Kernel Lock" idea is a poor one at-its-core: locks ought not to be "big." Nevertheless, it's easy to see how the lock came to be. "Big locks" are convenient when you are introducing them into logic that never had, nor needed, locks before... as the kernel itself didn't. But then they're quite difficult to get
rid of.