Unreliable Guide To Locking
Paul Rusty Russell
rusty@rustcorp.com.au
Copyright
© 2000 by
Paul Russell
Table of Contents
1.
Introduction
The Problem With Concurrency
2.
Two Main Types of Kernel Locks: Spinlocks and Semaphores
Locks and Uniprocessor Kernels
Read/Write Lock Variants
Locking Only In User Context
Locking Between User Context and BHs
Locking Between User Context and Tasklets/Soft IRQs
Locking Between Bottom Halves
The Same BH
Different BHs
Locking Between Tasklets
The Same Tasklet
Different Tasklets
Locking Between Softirqs
The Same Softirq
Different Softirqs
3.
Hard IRQ Context
Locking Between Hard IRQ and Softirqs/Tasklets/BHs
4.
Common Techniques
No Writers in Interrupt Context
Deadlock: Simple and Advanced
Preventing Deadlock
Overzealous Prevention Of Deadlocks
Per-CPU Data
Big Reader Locks
Avoiding Locks: Read And Write Ordering
Avoiding Locks: Atomic Operations
Protecting A Collection of Objects: Reference Counts
Macros To Help You
Things Which Sleep
The Fucked Up Sparc
Racing Timers: A Kernel Pastime
5.
Further reading
6.
Thanks
Glossary
List of Tables
1-1.
Expected Results
1-2.
Possible Results
4-1.
Consequences
Next
Introduction