Lecture Notes | An Introduction to Wait-Free Algorithms in C++ – CppCon 2024

Lecture Notes | An Introduction to Wait-Free Algorithms in C++ - CppCon 2024

Welcome to Ethan’s Air Garden. This is dedicated to creating a computer technology column that can be read during commutes, meals, or before bed, which is both accessible and in-depth. The theme of the lecture is “Introduction to Wait-Free Algorithms in C++ Programming,” presented by Daniel Anderson from CMU. This article records and summarizes the … Read more

Understanding the ABA Problem in Lock-Free Data Structures

Understanding the ABA Problem in Lock-Free Data Structures

Recently, I studied the ABA problem in lock-free stacks, and I would like to share my insights.Lock-free data structures are data structures implemented using CAS (Compare and Swap). In contrast, traditional data structures use locks.On CPUs with multiple hardware threads, lock-free data structures improve performance as the number of threads increases; whereas, lock-based data structures … Read more

Advantages and Disadvantages of Lock-based and Lock-free Concurrency in Rust: Application Scenarios

Advantages and Disadvantages of Lock-based and Lock-free Concurrency in Rust: Application Scenarios

In Rust concurrent programming, lock-based and lock-free are two core strategies. Their advantages, disadvantages, and applicable scenarios can be summarized as follows: Feature Dimension Lock-based Concurrency Lock-free Concurrency Implementation Complexity Relatively simple and intuitive, easy to get started Complex implementation, requires deep understanding of memory models and atomic operations Performance Characteristics Performance significantly decreases under … Read more

Exploring Lock-Free Queues in C++: Various Implementations and Performance Comparisons

Exploring Lock-Free Queues in C++: Various Implementations and Performance Comparisons

Implementing a lock-free queue in C++ is a complex task because lock-free programming involves intricate memory operations and synchronization mechanisms, requiring a deep understanding of concurrent programming and hardware-level atomic operations. The advantage of lock-free queues is that they can provide better performance in high-concurrency scenarios, as they avoid the thread contention and context-switching overhead … Read more

Deep Dive into ConcurrentQueue: A High-Performance Lock-Free Concurrent Queue in C++

Deep Dive into ConcurrentQueue: A High-Performance Lock-Free Concurrent Queue in C++

1. Core Architecture and Design Principles ConcurrentQueue is a high-performance lock-free concurrent queue developed by moodycamel, with its core design based on several key innovations: Multi-Producer Multi-Consumer (MPMC) Model: Supports any number of producer and consumer threads operating simultaneously Lock-Free Algorithm: Achieves thread safety through atomic operations, avoiding performance bottlenecks caused by traditional locks Batch … Read more