Skip to content

Shared-Memory Concurrency

Threads communicate by reading and changing the same memory; synchronization makes those changes safe and visible.

flowchart LR J[Junior: protect state] --> M[Middle: order access] --> S[Senior: control contention] --> P[Professional: design the subsystem]
flowchart LR T1[Ingest thread] --> State[(Shared state)] T2[Flush thread] --> State State --> Sync[Mutex, atomic, or partitioning]
Level Guide You are done when
Junior Start You can identify shared mutable state.
Middle Apply You can establish a happens-before relationship.
Senior Operate You can reduce contention without weakening correctness.
Professional Design You can justify and verify a concurrency architecture.

Practice rule: First remove sharing; if sharing remains, name its owner and synchronization rule.

Mutex | Atomics | Message passing