Chapter 8

Atomic Types and Operations

Abstract

A detailed discussion of the powerful atomic classes proposed by C++11 and TBB, as well as the Windows atomic services, is presented, with special emphasis on the way they can be used to implement efficient, custom synchronization utilities. First, lock-free algorithms are described, capable of enforcing thread safety in shared data accesses not using mutex locking. Next, the memory consistency constraints embedded in the atomic services are used to implement custom synchronization patterns based on “happens before” relations among operations in different threads. Two rather subtle examples are proposed, implementing synchronization utilities incorporated in the vath library.

Keywords

Atomic ...

Get Shared Memory Application Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.