Day60 — Atomics and Memory Ordering¶
Objectives¶
Understand synchronization behavior through experiments.
Lab1¶
Race condition.
Experiment¶
Two threads:
Observe inconsistent result.
Lab2¶
Atomic counter.
APIs¶
Compare correctness.
Lab3¶
Spin lock.
APIs¶
Implement:
Observe:
- CPU usage
- contention
Lab4¶
Memory ordering.
Producer¶
Consumer¶
Observe visibility guarantees.
Validation¶
Expected:
Related Notes¶
- atomics-memory-ordering
- synchronization-primitives-selection
Related APIs¶
- c11-atomics