Threads and pthreads
Threads share the same address space but have separate stacks. pthread_create() spawns a thread, pthread_join() waits for it. Shared mutable state requires synchronization: mutexes (pthread_mutex_t) for mutual exclusion, condition variables (pthread_cond_t) for signaling between threads. Data races (unsynchronized concurrent access where at least one is a write) are undefined-behaviour. atomics (stdatomic.h, C11) provide lock-free primitives for simple cases. ThreadSanitizer catches races at runtime.