Skip to content

Commit d139b34

Browse files
committed
Add links to understand the GIL
1 parent f2a0af5 commit d139b34

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

docs/scenarios/speed.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ Context
1111
The GIL
1212
-------
1313

14+
`The GIL`_ (Global Interpreter Lock) is how Python allows multiple threads to operate at the same time. Python's
15+
memory management isn't entirely thread-safe, so the GIL is requried to prevents multiple threads from running
16+
the same Python code at once.
1417

18+
David Beazley has a great `guide`_ on how the GIL operates. He also covers the `new GIL`_ in Python 3.2. His
19+
results show that maximizing performance in a Python application requires a strong understanding of the GIL,
20+
how it affects your specific application, how many cores you have, and where your application bottlenecks are.
1521

1622
C Extentions
1723
------------
@@ -20,8 +26,8 @@ C Extentions
2026
The GIL
2127
-------
2228

23-
24-
29+
`Special care`_ must be taken when writing C extensions to make sure you register your threads
30+
with the interpreter.
2531

2632
C Extentions
2733
::::::::::::
@@ -56,4 +62,8 @@ Multiprocessing
5662
---------------
5763

5864

59-
.. _`PyPy`: http://pypy.org
65+
.. _`PyPy`: http://pypy.org
66+
.. _`The GIL`: http://wiki.python.org/moin/GlobalInterpreterLock
67+
.. _`Understanding GIL`: http://www.dabeaz.com/python/UnderstandingGIL.pdf
68+
.. _`New GIL`: http://www.dabeaz.com/python/NewGIL.pdf
69+
.. _`Thread State`: http://docs.python.org/c-api/init.html#threads

0 commit comments

Comments
 (0)