Locking and interrupts
So far, we have learned how to use the mutex lock and, for the spinlock, the basic spin_[un]lock()
APIs. A few other API variations on the spinlock exist, and we shall examine the more common ones here.
In this section, there’s a bit more advanced coverage, and it will definitely help if you understand at least the basics of writing a (char) device driver and hardware interrupt handling on Linux (typically in the device driver context). These topics are covered in depth in this book’s companion volume Linux Kernel Programming - Part 2, in Chapter 1, Writing a Simple misc Character Device Driver and Chapter 4, Handling Hardware Interrupts (the LKP-2 e-book is freely downloadable). Also, as a quick guide/refresher, we have provided a sub section titled: Interrupt handling on Linux - a summary of key points, that comes later in this section. (If you’re unfamiliar with interrupt handling concepts on Linux, we suggest you first take...