Skip to content

Commit 22cf4f6

Browse files
committed
Address feedback; add entry for native code
1 parent 568d201 commit 22cf4f6

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

Doc/glossary.rst

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ Glossary
307307

308308
concurrent modification
309309
When multiple threads modify shared data at the same time without
310-
proper synchronization. Concurrent modification can lead to
311-
:term:`data races <data race>` and corrupted data.
310+
proper synchronization. Concurrent modification can cause
311+
:term:`race conditions <race condition>`, and might also trigger a
312+
:term:`data race <data race>`, data corruption, or both.
312313

313314
context
314315
This term has different meanings depending on where and how it is used.
@@ -399,8 +400,10 @@ Glossary
399400
do not use any synchronization to control their access. Data races
400401
lead to :term:`non-deterministic` behavior and can cause data corruption.
401402
Proper use of :term:`locks <lock>` and other :term:`synchronization primitives
402-
<synchronization primitive>` prevents data races. See also
403-
:term:`race condition` and :term:`thread-safe`.
403+
<synchronization primitive>` prevents data races. Note that data races
404+
can only happen in native code, but that :term:`native code` might be
405+
exposed in a Python API. See also :term:`race condition` and
406+
:term:`thread-safe`.
404407

405408
deadlock
406409
A situation where two or more threads are unable to proceed because
@@ -716,7 +719,8 @@ Glossary
716719
variables, class variables, or C static variables in :term:`extension modules
717720
<extension module>`. In multi-threaded programs, global state shared
718721
between threads typically requires synchronization to avoid
719-
:term:`race conditions <race condition>`. In the
722+
:term:`race conditions <race condition>` and
723+
:term:`data races <data race>`. In the
720724
:term:`free-threaded <free threading>` build, :term:`per-module state`
721725
is often preferred over global state for C extension modules.
722726
See also :term:`per-module state`.
@@ -1075,6 +1079,13 @@ Glossary
10751079

10761080
See also :term:`module`.
10771081

1082+
native code
1083+
Code that is compiled to machine instructions and runs directly on the
1084+
processor, as opposed to code that is interpreted or runs in a virtual
1085+
machine. In the context of Python, native code typically refers to
1086+
C, C++, Rust of Fortran code in :term:`extension modules <extension module>`
1087+
that can be called from Python. See also :term:`extension module`.
1088+
10781089
nested scope
10791090
The ability to refer to a variable in an enclosing definition. For
10801091
instance, a function defined inside another function can refer to
@@ -1122,7 +1133,7 @@ Glossary
11221133
See also :term:`regular package` and :term:`namespace package`.
11231134

11241135
parallelism
1125-
The simultaneous execution of multiple operations on different CPU cores.
1136+
The simultaneous execution of operations on multiple processors.
11261137
True parallelism requires multiple processors or processor cores where
11271138
operations run at exactly the same time and are not just interleaved.
11281139
In Python, the :term:`free-threaded <free threading>` build enables
@@ -1476,7 +1487,7 @@ Glossary
14761487
:class:`~threading.Semaphore`, :class:`~threading.Condition`,
14771488
:class:`~threading.Event`, and :class:`~threading.Barrier`. Additionally,
14781489
the :mod:`queue` module provides multi-producer, multi-consumer queues
1479-
that are especially usedul in multithreaded programs. These
1490+
that are especially useful in multithreaded programs. These
14801491
primitives help prevent :term:`race conditions <race condition>` and
14811492
coordinate thread execution. See also :term:`lock` and
14821493
:term:`critical section`.
@@ -1541,8 +1552,8 @@ Glossary
15411552
to avoid shared mutable state entirely. In the
15421553
:term:`free-threaded <free threading>` build, built-in types like
15431554
:class:`dict`, :class:`list`, and :class:`set` use internal locking
1544-
to provide thread-safe operations, though this doesn't guarantee safety
1545-
for all use patterns. Code that is not thread-safe may experience
1555+
to make many operations thread-safe, although thread safety is not
1556+
necessarily guaranteed. Code that is not thread-safe may experience
15461557
:term:`race conditions <race condition>` and :term:`data races <data race>`
15471558
when used in multi-threaded programs.
15481559

0 commit comments

Comments
 (0)