Rewrite section on concurrency
This commit is contained in:
@@ -57,16 +57,17 @@
|
|||||||
//! as the final optimized code, when executed, produces the same results as the one
|
//! as the final optimized code, when executed, produces the same results as the one
|
||||||
//! without optimizations.
|
//! without optimizations.
|
||||||
//!
|
//!
|
||||||
//! When multiprocessing is involved (either multiple CPU cores, or multiple
|
//! Due to the [concurrency] involved in modern computers, assumptions about
|
||||||
//! physical CPUs), access to global variables (which are shared between threads)
|
//! the program's execution order are often wrong. Access to global variables
|
||||||
//! could lead to nondeterministic results, **even if** compiler optimizations
|
//! can lead to nondeterministic results, **even if** compiler optimizations
|
||||||
//! are disabled.
|
//! are disabled, and it is **still possible** to introduce synchronization bugs.
|
||||||
//!
|
//!
|
||||||
//! Note that thanks to Rust's safety guarantees, accessing global (static)
|
//! Note that thanks to Rust's safety guarantees, accessing global (static)
|
||||||
//! variables requires `unsafe` code, assuming we don't use any of the
|
//! variables requires `unsafe` code, assuming we don't use any of the
|
||||||
//! synchronization primitives in this module.
|
//! synchronization primitives in this module.
|
||||||
//!
|
//!
|
||||||
//! [constant folding]: https://en.wikipedia.org/wiki/Constant_folding
|
//! [constant folding]: https://en.wikipedia.org/wiki/Constant_folding
|
||||||
|
//! [concurrency]: https://en.wikipedia.org/wiki/Concurrency_(computer_science)
|
||||||
//!
|
//!
|
||||||
//! ## Out-of-order execution
|
//! ## Out-of-order execution
|
||||||
//!
|
//!
|
||||||
|
|||||||
Reference in New Issue
Block a user