liveBook · Manning

Data race

As explained in Rust Servers, Services, and Apps

A data race is an unsynchronized concurrent access to shared data in which at least one access mutates the data.

A data race is an unsynchronized concurrent access to shared data where at least one access mutates that data. Rust prevents data races at compile time by combining ownership with thread-safety checks. section 1.2.2

Rust addresses data races through several related guarantees:

  • The compiler prevents sharing objects that are not thread-safe between threads. section 1.2.2
  • Ownership supplies a shared foundation for memory safety and thread safety. section 1.2.2
  • Thread-safe and thread-unsafe data types are distinguished and enforced by the type system. section 1.2.2

How Rust Servers, Services, and Apps covers it

How deep it goes
Defines the safety problem and identifies compiler enforcement, while deferring deeper treatment to Send and Sync traits and concurrency references.
Examples
Uses cross-thread sharing of non-thread-safe objects as the concrete failure case.
What you can do after
Evaluate multithreaded Rust designs through compiler-enforced ownership and thread-safety guarantees.
How it connects
Connects data races with ownership, memory safety, thread safety, and Send and Sync traits.

Also explained in

Compare how 4 books explain data race →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.