Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
About the author
Brian L. Troutwine is a software engineer with an interest in low-latency and high-scale software. He has worked at Rackspace Hosting, AdRoll, and Postmates. As his first book publishes, he will be starting at Unity Technologies.
He has delivered the following talks:
- The Charming Genius of the Apollo Guidance Computer
- Getting Uphill on a Candle: Crushed Spines, Detached Retinas, and One Small Step
- 10 Billion a Day, 100 Milliseconds Per: Monitoring Real-Time Bidding at AdRoll
- Fetching Moths from the Works: Correctness Methods in Software
- Build Good Software: Of Politics and Method
I'd like to thank Tom Santero for reading early drafts of this book. I'd like also to thank Miriam Pena, Sonny Scroggin, Irina Guberman, and Brian Mitchell for talking through what the book was and helping me find, thereby, what it could be. Special thanks to Chris Markiewicz for being an excellent roommate in high school.
What this book covers
The material that this book covers is very broad, and it attempts to go into that material at some depth. The material is written so that you can work straight through, but it's also expected that some readers will only be interested in a subset of the content.
, Preliminaries Machine Architecture and Getting Started with Rust, discusses modern CPU architectures, focusing specifically on x86 and ARM. These two architectures will be the focus of the book. The reader is assumed to be familiar with Rust, but we will also discuss verifying that your installation works as expected.
, Sequential Rust Performance and Testing, introduces inspecting the performance of a Rust program. The details of the underlying computer hardware are especially important in this: cache interactions, memory layout, and exploiting the nature of the problem domain are key to writing fast programs. However, fast doesn't matter if the results are inaccurate. This chapter also focuses on testing in Rust.
, The Rust Memory Model Ownership, References and Manipulation, discusses the memory model of Rust, focusing specifically on what makes Rust memory safe, how the language is constrained to achieve such safety and how these constraints influence the fundamental types' implementations. The reader will understand the borrow checker and its ways at the close of this chapter.
, Sync and Send the Foundation of Rust Concurrency, is the first in which notions of concurrency make their appearance. The chapter discusses the Sync and Send traits, both why they exist and their implications. The chapter closes with a concrete demonstration of a multithreaded Rust program. Not the last, either.
, Locks Mutex, Condvar, Barriers and RWLock, introduces the coarse synchronization methods available to the Rust programmer. Each is examined in turn and demonstrated in context of an industrial Rust project, hopper. The coarse synchronization methods are elaborated on in more detail in a series of smaller projects and data structures.
, Locks Mutex, Condvar, Barriers and RWLock.
, Atomics Safely Reclaiming Memory, discusses at length one of the key difficulties of atomic programming in any languagesafely deallocating memory. The main three methodsreference counting, hazard pointers, epoch-based reclamationare each discussed in great detail, and production-worthy codebases are investigated. Crossbeam, especially, is discussed in great detail.
, High-Level Parallelism Threadpools, Parallel Iterators andProcesses, motivates and explains the implementation of thread pooling. Having this knowledge in hand, the Rayon project is investigated and subsequently used in a complex project that benefits greatly from simple data parallelism.