Rust Atomics and Locks

Low-Level Concurrency in Practice

Paperback Engels 2023 1e druk 9781098119447
€ 66,80
Levertijd ± 16 werkdagen
Gratis verzonden

Samenvatting

The Rust programming language is extremely well suited for concurrency, and its ecosystem has many libraries that include lots of concurrent data structures, locks, and more. But implementing those structures correctly can be very difficult. Even in the most well-used libraries, memory ordering bugs are not uncommon.

In this practical book, Mara Bos, leader of the Rust library team, helps Rust programmers of all levels gain a clear understanding of low-level concurrency. You'll learn everything about atomics and memory ordering and how they're combined with basic operating system APIs to build common primitives like mutexes and condition variables. Once you're done, you'll have a firm grasp of how Rust's memory model, the processor, and the role of the operating system all fit together.

With this guide, you'll learn:
- How Rust's type system works exceptionally well for programming concurrency correctly
- All about mutexes, condition variables, atomics, and memory ordering
- What happens in practice with atomic operations on Intel and ARM processors
- How locks are implemented with support from the operating system
- How to write correct code that includes concurrency, atomics, and locks
- How to build your own locking and synchronization primitives correctly

Specificaties

ISBN13:9781098119447
Taal:Engels
Bindwijze:paperback
Aantal pagina's:150
Uitgever:O'Reilly
Druk:1
Verschijningsdatum:17-2-2023
Hoofdrubriek:IT-management / ICT

Lezersrecensies

Wees de eerste die een lezersrecensie schrijft!

Inhoudsopgave

Foreword
Preface
Who This Book Is For
Overview of the Chapters
Code Examples
Conventions Used in This Book
Contact Information
Acknowledgments

1. Basics of Rust Concurrency
Threads in Rust
Scoped Threads
Shared Ownership and Reference Counting
Statics
Leaking
Reference Counting
Borrowing and Data Races
Interior Mutability
Cell
RefCell
Mutex and RwLock
Atomics
UnsafeCell
Thread Safety: Send and Sync
Locking: Mutexes and RwLocks
Rust’s Mutex
Lock Poisoning
Reader-Writer Lock
Waiting: Parking and Condition Variables
Thread Parking
Condition Variables
Summary

2. Atomics
Atomic Load and Store Operations
Example: Stop Flag
Example: Progress Reporting
Example: Lazy Initialization
Fetch-and-Modify Operations
Example: Progress Reporting from Multiple Threads
Example: Statistics
Example: ID Allocation
Compare-and-Exchange Operations
Example: ID Allocation Without Overflow
Example: Lazy One-Time Initialization
Summary

3. Memory Ordering
Reordering and Optimizations
The Memory Model
Happens-Before Relationship
Spawning and Joining
Relaxed Ordering
Release and Acquire Ordering
Example: Locking
Example: Lazy Initialization with Indirection
Consume Ordering
Sequentially Consistent Ordering
Fences
Common Misconceptions
Summary
Afgekapt op 61 regels

Managementboek Top 100

€ 66,80
Levertijd ongeveer 16 werkdagen
Gratis verzonden

Rubrieken

Producten

    Auteurs

      Trefwoorden

        Artikelen

          Rust Atomics and Locks