do not click

Meeting C++ 2025   |  Online   |  Training   |  Books   |  Survey   |  Job fair   |  Advertising   |  Jobposting   |  Login

Meeting C++ 2025 - Designing an SPSC Lock-free queue

Conference | Live Schedule | Talks | Get your ticket | Slides | Set your timezone

Designing an SPSC Lock-free queue

Join session

Quasar Chunawala

On Day 2 at 13:15 (CET/Berlin) in Track D online

I would like to present a short "back-to-the-basics" talk on designing a lock-free SPSC queue. I would like to briefly touch upon, why mutual exclusion and what race conditions are, mutex types and mutex managers in the C++ standard library. We look at the producer-consumer problem (its a different type of race-condition). Then, we code up a simple lock-based SPSC queue using condition variables. I also walk-through few examples of std::binary_semaphore, std::counting_semaphore, barriers and latches.

After the above brief refresher, I deep-dive into support for atomics, and the practical meaning of memory ordering. We spend a moment of CAS h/w instruction and finally try to design a lock-free SPSC queue.

Please login to comment

Copyright Meetingcpp GmbH Imprint Privacy Policy