Basics of atomic operations in C++

How to write lockless and data race free concurrent code

CMP
4 min readMar 29, 2024

Introduction

In C++11, the <atomic> header was added to the C++ standard, allowing programmers to perform so-called “atomic” operations. Like an atom in the context of chemistry, atomic operations are “indivisible” — meaning the operation will either appear to have been completed entirely or not happen at all, with no intermediate state visible to others. This article is a gentle introduction to the basic core concepts of atomic operations in C++…

--

--

CMP

Software engineer specializing in operating systems, navigating the intracicies of the C++ language and systems programming.