FREE Systems LESSON · Systems
Make concurrency explainable
Ownership, ordering, and synchronization
Concurrency bugs are violations of an ordering contract.
Threads, processes, interrupts, and distributed workers interleave operations while observing memory through synchronization rules. A mutex can protect an invariant, an atomic operation can make one transition indivisible, and a message queue can transfer ownership. The correct mechanism depends on what state is shared, which order must be visible, and whether blocking, failure, or duplication is allowed.
Start from the invariant and required order; choose the primitive last.
Removing a race can create a deadlock.
Adding locks without a global ownership and acquisition model can create circular wait, convoying, priority inversion, or latency collapse. Minimize shared mutable state, define lock order, keep critical sections bounded, and decide what cancellation or failure means while a resource is held. A system that is safe but never progresses is still broken.
Safety and liveness must be argued separately.