更新时间:2021-06-25 21:12:18
封面
版权信息
Dedication
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
Preliminaries – Machine Architecture and Getting Started with Rust
Technical requirements
The machine
The CPU
Memory and caches
Memory model
Getting set up
The interesting part
Debugging Rust programs
Summary
Further reading
Sequential Rust Performance and Testing
Diminishing returns
Performance
Standard library HashMap
Naive HashMap
Testing with QuickCheck
Testing with American Fuzzy Lop
Performance testing with Criterion
Inspecting with the Valgrind Suite
Inspecting with Linux perf
A better naive HashMap
The Rust Memory Model – Ownership References and Manipulation
Memory layout
Pointers to memory
Allocating and deallocating memory
The size of a type
Static and dynamic dispatch
Zero sized types
Boxed types
Custom allocators
Implementations
Option
Cell and RefCell
Rc
Vec
Sync and Send – the Foundation of Rust Concurrency
Sync and Send
Racing threads
The flaw of the Ring
Getting back to safety
Safety by exclusion
Using MPSC
A telemetry server
Locks – Mutex Condvar Barriers and RWLock
Read many write exclusive locks – RwLock
Blocking until conditions change – condvar
Blocking until the gang's all here - barrier
More mutexes condvars and friends in action
The rocket preparation problem
The rope bridge problem
Hopper—an MPSC specialization
The problem
Hopper in use
A conceptual view of hopper
The deque
The Receiver
The Sender
Testing concurrent data structures
QuickCheck and loops
Searching for crashes with AFL
Benchmarking
Atomics – the Primitives of Synchronization
Linearizability
Memory ordering – happens-before and synchronizes-with
Ordering::Relaxed
Ordering::Acquire
Ordering::Release
Ordering::AcqRel