@@ -419,17 +419,28 @@ thread, it may grow to run in multiple. Not all platforms support
419419threads, but most do. For those that do, all threads in a process
420420share all the process' resources, including memory.
421421
422- Each thread does * run * independently, at the same time as the others.
423- That may be only conceptually at the same time ("concurrently") or
424- physically ("in parallel"). Either way, the threads run at a
425- non-synchronized rate, which means global state isn't guaranteed
426- to stay consistent for any given thread .
422+ The fundamental point of threads is that each thread does * run *
423+ independently, at the same time as the others. That may be only
424+ conceptually at the same time ("concurrently") or physically
425+ ("in parallel"). Either way, the threads effectively run
426+ at a non-synchronized rate .
427427
428428.. note ::
429429
430- The way they share resources is exactly what can make threads a pain:
431- two threads running at the same time can accidentally interfere with
432- each other's use of some shared data.
430+ That non-synchronized rate means none of the global state is
431+ guaranteed to stay consistent for the code running in any given
432+ thread. Thus multi-threaded programs must take care to coordinate
433+ access to intentionally shared resources. Likewise, they must take
434+ care to be absolutely diligent about not accessing any *other *
435+ resources in multiple threads; otherwise two threads running at the
436+ same time might accidentally interfere with each other's use of some
437+ shared data. All this is true for both Python programs and the
438+ Python runtime.
439+
440+ The cost of this broad, unstructured requirement is the tradeoff for
441+ the concurrency and, especially, parallelism that threads provide.
442+ The alternative generally means dealing with non-deterministic bugs
443+ and data corruption.
433444
434445The same layers apply to each Python program, with some extra layers
435446specific to Python::
0 commit comments