Skip to Main Content
Effective Concurrency in Go
book

Effective Concurrency in Go

by Burak Serdar
April 2023
Intermediate to advanced content levelIntermediate to advanced
212 pages
4h 47m
English
Packt Publishing
Content preview from Effective Concurrency in Go

9

Atomic Memory Operations

Atomic memory operations provide the low-level foundation necessary to implement other synchronization primitives. In general, you can replace all atomic operations of a concurrent algorithm with mutexes and channels. Nevertheless, they are interesting and sometimes confusing constructs, and you should know how they work. If you use them carefully, they can become good tools for code optimization without increasing complexity.

In this chapter, we will explore the following topics:

  • Memory guarantees of atomic memory operations
  • The compare-and-swap operation
  • Practical uses of atomics, including counters, heartbeats/progress meters, cancellations, and detecting change

Technical Requirements

The source code for this ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Concurrency in Go

Concurrency in Go

Katherine Cox-Buday

Publisher Resources

ISBN: 9781804619070Supplemental Content