Spinlocks are used to protect short code sections that comprise just a few C statements and are therefore quickly executed and exited. Most kernel data structures have their own spinlock that must be acquired when critical elements in the structure are processed. Although spinlocks are omnipresent in the kernel sources, I omit them in most pieces of code shown in this book. They do not provide any valuable insight into how the kernel functions but make the code more difficult to read, as explained above. Nevertheless, it is important that code is equipped with appropriate locks!

Continue reading here: Data Structures and Usage

Was this article helpful?

0 0