Program order
The order in which instructions appear in source code, which defines a happens-before relation between operations within a single thread.
Program order is fundamental to memory models. Within a single thread, program order establishes a total order on operations: if A is written before B in code, then A happens-before B. But processor optimization, cache reordering, and compiler optimizations can break this order as seen from main memory, which is why explicit barriers are needed when multiple threads interact.
Program order applies within a thread. Between threads, explicit synchronization is required to establish order, via acquire-release, mutexes, or other primitives.