m-ou-se/rust-atomics-and-locks

Code examples, data structures, and links from my book, Rust Atomics and Locks.

Rust
This is stars and forks stats for /m-ou-se/rust-atomics-and-locks repository. As of 02 May, 2024 this repository has 999 stars and 83 forks.

This repository contains the code examples, data structures, and links from Rust Atomics and Locks. The examples from chapters 1, 2, 3, and 8 can be found in examples/. The data structures from chapters 4, 5, 6, and 9 can be found in src/. Chapter 1 — Basics of Rust Concurrency examples/ch1-01-hello.rs examples/ch1-02-hello-join.rs examples/ch1-03-spawn-closure.rs examples/ch1-04-scoped-threads.rs examples/ch1-05-rc.rs examples/ch1-06-cell.rs examples/ch1-07-refcell.rs examples/ch1-08-mutex.rs examples/ch1-09-sleep-before-unlock.rs examples/ch1-10-unlock-before-sleep.rs examples/ch1-11-thread-parking.rs examples/ch1-12-condvar.rs Chapter 2 — Atomics examples/ch2-01-stop-flag.rs examples/ch2-02-progress-reporting.rs examples/ch2-03-progress-reporting-unpark.rs examples/ch2-04-lazy-init.rs examples/ch2-05-fetch-add.rs examples/ch2-06-progress-reporting-multiple-threads.rs examples/ch2-07-statistics.rs examples/ch2-08-id-allocation.rs examples/ch2-09-id-allocation-panic.rs examples/ch2-10-id-allocation-subtract-before-panic.rs examples/ch2-11-increment-with-compare-exchange.rs examples/ch2-12-id-allocation-without-overflow.rs examples/ch2-13-lazy-one-time-init.rs Chapter 3 — Memory Ordering examples/ch3-01-relaxed.rs examples/ch3-02-spawn-join.rs examples/ch3-03-total-modification-order.rs examples/ch3-04-total-modification-order-2.rs examples/ch3-05-out-of-thin-air.rs examples/ch3-06-release-acquire.rs examples/ch3-07-release-acquire-unsafe.rs examples/ch3-08-lock.rs examples/ch3-09-lazy-init-box.rs examples/ch3-10-seqcst.rs examples/ch3-11-fence.rs Chapter 4 — Building Our Own Spin Lock src/ch4_spin_lock/s1_minimal.rs src/ch4_spin_lock/s2_unsafe.rs src/ch4_spin_lock/s3_guard.rs Chapter 5 — Building Our Own Channels src/ch5_channels/s1_simple.rs src/ch5_channels/s2_unsafe.rs src/ch5_channels/s3_checks.rs src/ch5_channels/s3_single_atomic.rs src/ch5_channels/s4_types.rs src/ch5_channels/s5_borrowing.rs src/ch5_channels/s6_blocking.rs Chapter 6 — Building Our Own “Arc” src/ch6_arc/s1_basic.rs src/ch6_arc/s2_weak.rs src/ch6_arc/s3_optimized.rs Chapter 7 — Understanding the Processor https://godbolt.org/ Chapter 8 — Operating System Primitives examples/ch8-01-futex.rs Chapter 9 — Building Our Own Locks src/ch9_locks/mutex_1.rs src/ch9_locks/mutex_2.rs src/ch9_locks/mutex_3.rs src/ch9_locks/condvar_1.rs src/ch9_locks/condvar_2.rs src/ch9_locks/rwlock_1.rs src/ch9_locks/rwlock_2.rs src/ch9_locks/rwlock_3.rs Chapter 10 — Ideas and Inspiration Wikipedia article on semaphores Stanford University course notes on semaphores Wikipedia article on the read-copy-update pattern LWN article "What is RCU, Fundamentally?" Wikipedia article on non-blocking linked lists LWN article "Using RCU for Linked Lists—A Case Study" Notes on the implementation of Windows SRW locks A Rust implementation of queue-based locks WebKit blog post, "Locking in WebKit" Documentation of the parking_lot crate Wikipedia article on Linux's Seqlock Rust RFC 3301, AtomicPerByte Documentation of the seqlock crate License You may use all code in this repository for any purpose. Attribution is appreciated, but not required. An attribution usually includes the book title, author, publisher, and ISBN. For example: "Rust Atomics and Locks by Mara Bos (O’Reilly). Copyright 2023 Mara Bos, 978-1-098-11944-7."
Read on GithubGithub Stats Page
repotechsstarsweeklyforksweekly
watchexec/cargo-watchRustRoffShell2.4k+11750
libreddit/libredditRustHTMLCSS4.9k02560
rust-bakery/nomRust8.4k+397760
LukeMathWalker/pavexRustShell9810260
winsecurity/Offensive-RustRust2520350
reacherhq/check-if-email-existsRustPLpgSQLOther3.9k02950
fltk-rs/fltk-rsRustShell1.3k01020
tessi/wasmexElixirRustWebAssembly4370210
obsidiansystems/ledger-app-provenanceRustNixTypeScript0020
cberner/redbRustOther2.2k01160