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.
100 Go Mistakes and How to Avoid ThemA data race is a concurrency error in which multiple executions access the same memory concurrently, at least one access is a write, and the accesses are not properly ordered or synchronized.
Learn Go with Pocket-Sized ProjectsA data race is a concurrency defect in which multiple execution contexts access the same memory concurrently and at least one access modifies it without adequate synchronization.
C++ Concurrency in Action, Second EditionA data race occurs when concurrent operations access the same memory location, at least one operation modifies it, and the operations are not properly synchronized.
lockingaddressed by · Locking is a synchronization technique that restricts concurrent access to shared resources or protected operations.
race conditionkind of · A race condition is a concurrency defect in which program behavior or results depend on the relative timing or ordering of interacting operations.
undefined behaviorproduces · Undefined behavior is program execution for which the applicable language or system specification imposes no requirements on the resulting behavior or effects.
race-condition detectionmeasured by · Race-condition detection is dynamic analysis of concurrent program execution that identifies conflicting unsynchronized accesses to shared data.
slice copyaddressed by · A slice copy is the technique of copying selected elements into a separately allocated slice so the result does not retain the source array.
memory orderingaddressed by · Memory ordering is the set of rules governing the permitted ordering and visibility of memory operations across concurrent execution contexts.
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.