Tag: atomic
3 posts
-
C++ Lock-Free Programming: CAS, ABA, and Memory Order
Replace mutex hot spots with atomics and CAS: a lock-free stack, Michael-Scott and SPSC queues, picking a memory_order, and fixing ABA with tagged pointers.
-
C++ Multithreading Crashes: Data Races, mutex, and atomic
Fix intermittent multithreaded crashes: data races vs race conditions, std::mutex, atomics, false sharing basics, condition variables.
-
C++ std::atomic: Atomic Operations, Memory Order, and compare_exchange
How std::atomic prevents data races in C++: load/store/fetch_add, compare_exchange_weak vs strong, the memory orders relaxed, acquire/release and seq_cst, and when a mutex is still the better tool.