Rust aims to be a programming language in which fearless concurrency is possible. What does this mean? How does it work? In Chapter 2, Sequential Rust Performance Testing, we discussed the performance of sequential Rust programs, intentionally setting aside discussion of concurrent programs. In Chapter 3, The Rust Memory Model – Ownership, References and Manipulation, we saw an overview of the way Rust handles memory, especially with regard to composing high-performance structures. In this chapter, we'll expand on what we've learned previously and, at long last, dig in to Rust's concurrency story.
By the end of this chapter, we will have:
- Discussed the Sync and Send traits
- Inspected parallel races in a ring data structure with Helgrind
- Resolved this race with a mutex
- Investigated the use of the...