Recognizing critical sections within a piece of kernel code is of critical importance; how can you protect it if you can't even see it? The following are a few guidelines to help you, as a budding kernel/driver developer, recognize where concurrency concerns – and thus critical sections – may arise:
- The presence of Symmetric Multi-Processor (SMP) systems (CONFIG_SMP)
- The presence of a preemptible kernel
- Blocking I/O
- Hardware interrupts (on either SMP or UP systems)
These are critical points to understand, and we will discuss each in this section.