A Lock-free Atomic shared_ptr - Timur Doumler - CppNow 2022

#Boost​ #Cpp​ #CppNow​
Slides: https://github.com/boostcon
CppNow Website: https://www.cppnow.org​
CppNow Twitter: @CppNow​

A Lock-free Atomic shared_ptr - Timur Doumler - CppNow 2022

std::shared_ptr is a standard smart pointer utility widely used in modern C++. A commonly overlooked property of std::shared_ptr is that while its control block is thread-safe, the shared_ptr object itself is not. To overcome this limitation, C++20 introduced std::atomic std::shared_ptr.

A lock-free implementation of std::atomic std::shared_ptr would be immensely useful for sharing objects between threads in low-latency and real-time applications and as a building block for lock-free data structures. Unfortunately, all existing standard library implementations are not lock-free, rendering them useless for these use cases. Why is it so hard to provide a lock-free atomic shared_ptr, and what would it take to implement it?

In this talk, we discuss the motivation and use case, describe how std::shared_ptr works, and review the history of standardising std::atomic std::shared_ptr. We then look at several existing non-standard implementations. We discuss the different implementation strategies, their tradeoffs and limitations, and the underlying platform-specific mechanisms (32 vs. 64 bit, Intel vs. ARM). Finally, we present a new, free and open-source implementation of a lock-free atomic shared_ptr portable across these different platforms.

Timur Doumler

Timur Doumler is C++ Developer Advocate at JetBrains and an active member of the ISO C++ standard committee. As a developer, he worked many years in the audio and music technology industry and co-founded the music tech startup Cradle. Timur is passionate about building inclusive communities, clean code, good tools, low latency, and the evolution of the C++ language.

Videos Filmed & Edited By Bash Films https://bashfilms.com/
YouTube Channel Managed By Digital Medium Ltd: https://events.digital-medium.co.uk
Be the first to comment