UNIX internals: the new frontiers
UNIX internals: the new frontiers
Eraser: a dynamic data race detector for multithreaded programs
ACM Transactions on Computer Systems (TOCS)
Operating System Concepts
Improving the FreeBSD SMP Implementation
Proceedings of the FREENIX Track: 2001 USENIX Annual Technical Conference
Locking in the multithreaded FreeBSD kernel
BSDC'02 Proceedings of the BSD Conference 2002 on BSD Conference
Fast IPsec: a high-performance IPsec implementation
BSDC'03 Proceedings of the BSD Conference 2003 on BSD Conference
Hi-index | 0.00 |
While the subject of SMP locking primitives has been well covered in the literature [Val][Schm][Bald][Leh], there has been relatively little discussion on the rationale and process behind the application of these locking primitives. This leads to an inverted problem where the bulk of the work in making a kernel SMP-safe lies above the locking primitives, yet there is little guidance on how and where to lock in the individual subsystems. In this paper, we will discuss our experiences with SMP locking in the FreeBSD kernel and illustrate some of the reasoning concerning the placement or non-placement of SMP locks in the kernel. We hope this will aid other developers in locking up the remaining subsystems and in understanding the locks that are already in place. We start with an overview of general locking strategies followed by many examples of race conditions caused by faulty SMP reasoning and give solutions for correctly locking up the affected piece of code. All our examples are taken from actual committed versions of the FreeBSD source.