# concurrency in rust

Published articles for concurrency in rust.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Fearless Concurrency Ep.7: Lock-Free Structures and Channels for Scalable Rust Code

DevFeed: [Fearless Concurrency Ep.7: Lock-Free Structures and Channels for Scalable Rust Code](<https://devfeed.tech/articles/fearless-concurrency-ep-7-lock-free-structures-and-channels-for-scalable-rust-code-22272.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2024/12/fearless-concurrency-ep7-lock-free-structures-and-channels-for-scalable-rust-code.html>)

Published: 2024-12-05T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Rust](<https://devfeed.tech/topics/rust.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Code](<https://devfeed.tech/topics/code.md>), [systems](<https://devfeed.tech/topics/systems.md>)

Tags: [advanced-rust-concurrency](<https://devfeed.tech/tags/advanced-rust-concurrency.md>), [alternatives](<https://devfeed.tech/tags/alternatives.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [concurrency-in-rust](<https://devfeed.tech/tags/concurrency-in-rust.md>), [crossbeam-crate-rust](<https://devfeed.tech/tags/crossbeam-crate-rust.md>), [efficient-multithreading-rust](<https://devfeed.tech/tags/efficient-multithreading-rust.md>), [fearless-concurrency-rust](<https://devfeed.tech/tags/fearless-concurrency-rust.md>), [lock-free](<https://devfeed.tech/tags/lock-free.md>), [lock-free-data-structures-rust](<https://devfeed.tech/tags/lock-free-data-structures-rust.md>), [managing-shared-resources-rust](<https://devfeed.tech/tags/managing-shared-resources-rust.md>), [mpsc-channels-rust](<https://devfeed.tech/tags/mpsc-channels-rust.md>), [one-shot-channels-rust](<https://devfeed.tech/tags/one-shot-channels-rust.md>), [optimizing-concurrency-in-rust](<https://devfeed.tech/tags/optimizing-concurrency-in-rust.md>), [performance](<https://devfeed.tech/tags/performance.md>), [robust-multithreaded-rust-apps](<https://devfeed.tech/tags/robust-multithreaded-rust-apps.md>), [rust](<https://devfeed.tech/tags/rust.md>), [rust-atomiccell](<https://devfeed.tech/tags/rust-atomiccell.md>), [rust-bounded-channels](<https://devfeed.tech/tags/rust-bounded-channels.md>), [rust-concurrency](<https://devfeed.tech/tags/rust-concurrency.md>), [rust-dashmap-dashset](<https://devfeed.tech/tags/rust-dashmap-dashset.md>), [rust-high-concurrency-techniques](<https://devfeed.tech/tags/rust-high-concurrency-techniques.md>), [rust-thread-multiplexing](<https://devfeed.tech/tags/rust-thread-multiplexing.md>), [rust-thread-safe-work-queues](<https://devfeed.tech/tags/rust-thread-safe-work-queues.md>), [rust-timeout-options](<https://devfeed.tech/tags/rust-timeout-options.md>), [scalable-rust-applications](<https://devfeed.tech/tags/scalable-rust-applications.md>), [thread](<https://devfeed.tech/tags/thread.md>), [thread-communication-rust](<https://devfeed.tech/tags/thread-communication-rust.md>)

### AI overview

The seventh and final episode of a Rust concurrency series covers lock-free data structures, channels for communication between threads, and techniques for managing shared resources. It discusses tools including DashMap, DashSet, Crossbeam, MPSC and one-shot channels, multiplexing, bounded channels, backpressure, memory usage, and timeouts.

### Source excerpt

Introduction: Welcome to Episode 7 of the Fearless Concurrency in Rust series! In this final episode, we explore advanced concurrency techniques that enable efficient, scalable, and robust multithreaded applications in Rust. The focus is on leveraging tools like lock-free data structures, channels for thread communication, and strategies for safely managing shared resources in complex systems. These approaches ensure developers can push the limits of Rust's concurrency model while maintaining safety and performance.

## Fearless Concurrency Ep.6: Understanding Rust ARC for Efficient Multithreading

DevFeed: [Fearless Concurrency Ep.6: Understanding Rust ARC for Efficient Multithreading](<https://devfeed.tech/articles/fearless-concurrency-ep-6-understanding-rust-arc-for-efficient-multithreading-22270.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2024/11/fearless-concurrency-ep6-understanding-rust-arc-for-efficient-multithreading.html>)

Published: 2024-11-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Rust](<https://devfeed.tech/topics/rust.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [data](<https://devfeed.tech/topics/data.md>)

Tags: [arc-best-practices](<https://devfeed.tech/tags/arc-best-practices.md>), [arc-for-performance](<https://devfeed.tech/tags/arc-for-performance.md>), [arc-in-rust](<https://devfeed.tech/tags/arc-in-rust.md>), [arc-memory-management](<https://devfeed.tech/tags/arc-memory-management.md>), [arc-ownership-model](<https://devfeed.tech/tags/arc-ownership-model.md>), [arc-shared-resources](<https://devfeed.tech/tags/arc-shared-resources.md>), [arc-vs-garbage-collection](<https://devfeed.tech/tags/arc-vs-garbage-collection.md>), [arc-with-mutex](<https://devfeed.tech/tags/arc-with-mutex.md>), [arc-with-rwlock](<https://devfeed.tech/tags/arc-with-rwlock.md>), [atomic](<https://devfeed.tech/tags/atomic.md>), [atomic-reference-counting](<https://devfeed.tech/tags/atomic-reference-counting.md>), [best-practices](<https://devfeed.tech/tags/best-practices.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [concurrency-in-rust](<https://devfeed.tech/tags/concurrency-in-rust.md>), [efficient-multithreading-rust](<https://devfeed.tech/tags/efficient-multithreading-rust.md>), [examples](<https://devfeed.tech/tags/examples.md>), [interior-mutability-arc](<https://devfeed.tech/tags/interior-mutability-arc.md>), [lightweight-memory-management](<https://devfeed.tech/tags/lightweight-memory-management.md>), [memory](<https://devfeed.tech/tags/memory.md>), [multithreading](<https://devfeed.tech/tags/multithreading.md>), [multithreading-with-arc](<https://devfeed.tech/tags/multithreading-with-arc.md>), [pitfalls](<https://devfeed.tech/tags/pitfalls.md>), [rust](<https://devfeed.tech/tags/rust.md>), [rust-arc-tutorial](<https://devfeed.tech/tags/rust-arc-tutorial.md>), [rust-arc-use-cases](<https://devfeed.tech/tags/rust-arc-use-cases.md>), [rust-concurrency-tools](<https://devfeed.tech/tags/rust-concurrency-tools.md>), [rust-shared-ownership](<https://devfeed.tech/tags/rust-shared-ownership.md>), [rust-thread-safe-programming](<https://devfeed.tech/tags/rust-thread-safe-programming.md>), [thread-safe-data-sharing](<https://devfeed.tech/tags/thread-safe-data-sharing.md>), [use-cases](<https://devfeed.tech/tags/use-cases.md>)

### AI overview

This tutorial explains Rust's Atomic Reference Counting (Arc) for sharing ownership of data across threads. It covers reference-counted memory management, cloning, performance implications, common pitfalls such as circular references, and use cases including shared configuration and database connection pools.

### Source excerpt

Introduction: Welcome to Episode 6 of the Fearless Concurrency in Rust series! In this episode, we explore the powerful concept of ARC (Atomic Reference Counting) and its critical role in managing shared resources in multithreaded Rust programs. By leveraging ARC, developers can safely share ownership of data across threads without relying on a traditional garbage collector, enabling efficient, flexible, and scalable concurrency. What is ARC?: Understanding Atomic Reference Counting as a lightweight, manual garbage collection system.

## Fearless Concurrency Ep.5: Ensuring Memory Safety with Mutexes and RwLocks in Rust

DevFeed: [Fearless Concurrency Ep.5: Ensuring Memory Safety with Mutexes and RwLocks in Rust](<https://devfeed.tech/articles/fearless-concurrency-ep-5-ensuring-memory-safety-with-mutexes-and-rwlocks-in-rust-22269.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2024/11/fearless-concurrency-ep5-ensuring-memory-safety-with-mutexes-and-rwlocks-in-rust.html>)

Published: 2024-11-08T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [Rust](<https://devfeed.tech/topics/rust.md>), [Memory Safety](<https://devfeed.tech/topics/memory-safety.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [advanced-concurrency-rust](<https://devfeed.tech/tags/advanced-concurrency-rust.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [concurrency-in-rust](<https://devfeed.tech/tags/concurrency-in-rust.md>), [concurrency-patterns-rust](<https://devfeed.tech/tags/concurrency-patterns-rust.md>), [concurrent-read-write-access-rust](<https://devfeed.tech/tags/concurrent-read-write-access-rust.md>), [data-sharing-in-multithreading](<https://devfeed.tech/tags/data-sharing-in-multithreading.md>), [deadlock-avoidance-rust](<https://devfeed.tech/tags/deadlock-avoidance-rust.md>), [embedding-mutex-in-structs](<https://devfeed.tech/tags/embedding-mutex-in-structs.md>), [fearless-concurrency-rust](<https://devfeed.tech/tags/fearless-concurrency-rust.md>), [interior-mutability-rust](<https://devfeed.tech/tags/interior-mutability-rust.md>), [managing-shared-data-rust](<https://devfeed.tech/tags/managing-shared-data-rust.md>), [memory-safety](<https://devfeed.tech/tags/memory-safety.md>), [mutex](<https://devfeed.tech/tags/mutex.md>), [mutexes-in-rust](<https://devfeed.tech/tags/mutexes-in-rust.md>), [optimizing-performance-rust-multithreading](<https://devfeed.tech/tags/optimizing-performance-rust-multithreading.md>), [rust](<https://devfeed.tech/tags/rust.md>), [rust-concurrency-best-practices](<https://devfeed.tech/tags/rust-concurrency-best-practices.md>), [rust-concurrency-tools](<https://devfeed.tech/tags/rust-concurrency-tools.md>), [rust-data-synchronization](<https://devfeed.tech/tags/rust-data-synchronization.md>), [rust-interior-mutability-examples](<https://devfeed.tech/tags/rust-interior-mutability-examples.md>), [rust-multithreading-performance](<https://devfeed.tech/tags/rust-multithreading-performance.md>), [rust-mutex-integration](<https://devfeed.tech/tags/rust-mutex-integration.md>), [rust-mutex-vs-rwlock](<https://devfeed.tech/tags/rust-mutex-vs-rwlock.md>), [rust-read-write-locks](<https://devfeed.tech/tags/rust-read-write-locks.md>), [rust-thread-management](<https://devfeed.tech/tags/rust-thread-management.md>), [rust-thread-safety](<https://devfeed.tech/tags/rust-thread-safety.md>), [rust-thread-safety-techniques](<https://devfeed.tech/tags/rust-thread-safety-techniques.md>), [rwlock-in-rust](<https://devfeed.tech/tags/rwlock-in-rust.md>), [rwlock-vs-mutex-rust](<https://devfeed.tech/tags/rwlock-vs-mutex-rust.md>), [sync-trait-in-rust](<https://devfeed.tech/tags/sync-trait-in-rust.md>), [sync-trait-rust](<https://devfeed.tech/tags/sync-trait-rust.md>), [synchronization](<https://devfeed.tech/tags/synchronization.md>), [thread](<https://devfeed.tech/tags/thread.md>), [thread-safe-structs-rust](<https://devfeed.tech/tags/thread-safe-structs-rust.md>)

### AI overview

Episode 5 of a Rust concurrency series explains RwLock for coordinating simultaneous reads and writes, along with interior mutability for embedding mutexes in structs. It advises limiting RwLock use to read-heavy cases, starting with mutexes to learn synchronization fundamentals, and avoiding deadlocks. The examples show how struct-level synchronization can simplify multithreaded code and reduce unnecessary serialization.

### Source excerpt

Introduction: Welcome to Episode 5 of Fearless Concurrency in Rust! In this episode, Herbert Wolverson dives into advanced concurrency tools, focusing on RwLock for managing simultaneous reads and writes and the powerful concept of interior mutability. These tools provide developers with greater control over data sharing in multithreaded environments, enabling them to optimize for both performance and code simplicity in Rust. Read-Write Locks (RwLock): Manage concurrent read and write access efficiently.

## Fearless Concurrency Ep.4: Understanding Mutexes and Thread Safety in Rust

DevFeed: [Fearless Concurrency Ep.4: Understanding Mutexes and Thread Safety in Rust](<https://devfeed.tech/articles/fearless-concurrency-ep-4-understanding-mutexes-and-thread-safety-in-rust-22261.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2024/10/fearless-concurrency-ep4-understanding-mutexes-and-thread-safety-in-rust.html>)

Published: 2024-10-25T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Rust](<https://devfeed.tech/topics/rust.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Deadlock](<https://devfeed.tech/topics/deadlock.md>)

Tags: [avoiding-race-conditions-in-rust](<https://devfeed.tech/tags/avoiding-race-conditions-in-rust.md>), [code](<https://devfeed.tech/tags/code.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [concurrency-and-memory-management-in-rust](<https://devfeed.tech/tags/concurrency-and-memory-management-in-rust.md>), [concurrency-in-rust](<https://devfeed.tech/tags/concurrency-in-rust.md>), [deadlock](<https://devfeed.tech/tags/deadlock.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [managing-shared-data-in-rust](<https://devfeed.tech/tags/managing-shared-data-in-rust.md>), [mutex](<https://devfeed.tech/tags/mutex.md>), [mutex-and-drop-trait-in-rust](<https://devfeed.tech/tags/mutex-and-drop-trait-in-rust.md>), [mutexes-in-rust](<https://devfeed.tech/tags/mutexes-in-rust.md>), [rust](<https://devfeed.tech/tags/rust.md>), [rust-concurrency-best-practices](<https://devfeed.tech/tags/rust-concurrency-best-practices.md>), [rust-concurrency-guide](<https://devfeed.tech/tags/rust-concurrency-guide.md>), [rust-drop-trait-in-concurrency](<https://devfeed.tech/tags/rust-drop-trait-in-concurrency.md>), [rust-multithreading-tutorial](<https://devfeed.tech/tags/rust-multithreading-tutorial.md>), [rust-mutex-example](<https://devfeed.tech/tags/rust-mutex-example.md>), [rust-mutex-vs-lock](<https://devfeed.tech/tags/rust-mutex-vs-lock.md>), [rust-ownership-and-borrowing-in-concurrency](<https://devfeed.tech/tags/rust-ownership-and-borrowing-in-concurrency.md>), [rust-thread-safety](<https://devfeed.tech/tags/rust-thread-safety.md>), [rust-thread-safety-without-garbage-collection](<https://devfeed.tech/tags/rust-thread-safety-without-garbage-collection.md>), [safety](<https://devfeed.tech/tags/safety.md>), [synchronization](<https://devfeed.tech/tags/synchronization.md>), [thread](<https://devfeed.tech/tags/thread.md>), [thread-synchronization-in-rust](<https://devfeed.tech/tags/thread-synchronization-in-rust.md>), [understanding-poisoned-mutexes-in-rust](<https://devfeed.tech/tags/understanding-poisoned-mutexes-in-rust.md>)

### AI overview

This episode explains how Rust's ownership and borrowing rules support thread-safe multithreaded programming. It covers sharing data with mutexes, mutual exclusion, automatic lock cleanup, poisoned mutexes, and how Rust helps prevent data races, undefined behavior, and some deadlock issues.

### Source excerpt

Introduction: Welcome to Episode 4 of Fearless Concurrency in Rust! In this episode, we explore how Rust's ownership and borrowing rules impact multithreaded programming, focusing on the complexities of managing memory in a concurrent environment. We'll break down how Rust's strict borrowing and ownership model ensures safety and prevents common pitfalls like data races and undefined behavior, making it an ideal choice for building reliable multithreaded applications. Thread Safety and Ownership: Managing variables across threads using Rust's ownership rules.

## Fearless Concurrency Ep.2: Managing Threaded Programs and Data Races in Rust

DevFeed: [Fearless Concurrency Ep.2: Managing Threaded Programs and Data Races in Rust](<https://devfeed.tech/articles/fearless-concurrency-ep-2-managing-threaded-programs-and-data-races-in-rust-22259.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2024/09/fearless-concurrency-ep2-managing-threaded-programs-and-data-races-in-rust.html>)

Published: 2024-09-26T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Rust](<https://devfeed.tech/topics/rust.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [data](<https://devfeed.tech/topics/data.md>), [Operating system](<https://devfeed.tech/topics/operating-system.md>)

Tags: [atomics](<https://devfeed.tech/tags/atomics.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [concurrency-in-rust](<https://devfeed.tech/tags/concurrency-in-rust.md>), [creating-threads-in-rust](<https://devfeed.tech/tags/creating-threads-in-rust.md>), [fundamentals](<https://devfeed.tech/tags/fundamentals.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [managing-threads-in-rust](<https://devfeed.tech/tags/managing-threads-in-rust.md>), [preventing-race-conditions-in-rust](<https://devfeed.tech/tags/preventing-race-conditions-in-rust.md>), [rust](<https://devfeed.tech/tags/rust.md>), [rust-atomic-operations](<https://devfeed.tech/tags/rust-atomic-operations.md>), [rust-borrow-checker-for-threads](<https://devfeed.tech/tags/rust-borrow-checker-for-threads.md>), [rust-concurrency-tutorial](<https://devfeed.tech/tags/rust-concurrency-tutorial.md>), [rust-concurrent-programming](<https://devfeed.tech/tags/rust-concurrent-programming.md>), [rust-data-race-prevention](<https://devfeed.tech/tags/rust-data-race-prevention.md>), [rust-join-handles](<https://devfeed.tech/tags/rust-join-handles.md>), [rust-multithreading](<https://devfeed.tech/tags/rust-multithreading.md>), [rust-ownership-system](<https://devfeed.tech/tags/rust-ownership-system.md>), [rust-thread-safety](<https://devfeed.tech/tags/rust-thread-safety.md>), [rust-threading-basics](<https://devfeed.tech/tags/rust-threading-basics.md>), [safety](<https://devfeed.tech/tags/safety.md>), [std-thread-spawn-in-rust](<https://devfeed.tech/tags/std-thread-spawn-in-rust.md>), [thread-lifecycle-in-rust](<https://devfeed.tech/tags/thread-lifecycle-in-rust.md>), [threads](<https://devfeed.tech/tags/threads.md>)

### AI overview

Episode 2 of a Rust concurrency series explains how to create and manage threads with std::thread, use join handles, and safely share or modify data across threads. It describes how Rust's ownership system and borrow checker prevent data races, and introduces atomics for shared state.

### Source excerpt

Introduction: Welcome to Episode 2 of the Fearless Concurrency in Rust series! In this episode, Herbert Wolverson dives into the fundamentals of threading in Rust, demonstrating how to use Rust's threading capabilities effectively while maintaining safety. The focus is on using std::thread to spawn threads, preventing data races, and ensuring efficient, reliable multithreaded execution. Creating Threads in Rust: How to spawn and manage operating system threads using std::thread::spawn. Handling Data Races: Rust's borrow checker and ownership system preventing unsafe data access across threads.