Commits

Bruce Eckel committed d33a413

Added notes on "why the GIL"

Comments (0)

Files changed (1)

src/CoroutinesAndConcurrency.rst

 Coroutines, Concurrency & Distributed Systems
 ********************************************************************************
 
+[[ Will probably need to expand this to multiple chapters:
+
+1. Concurrency Concepts
+2. Coroutines
+3. Processes
+4. Threads
+
+(this isn't final; may need different organization or finer grained. However, it should start
+with simpler concepts and progress to the more difficult ones, as above.)
+
+]]
+
 Primary focus should be on:
 
 1) Using ``yield`` to create coroutines
 
 foo bar :func:`input` baz.
 
+The GIL
+===============================================================================
+
+The GIL prevents context switches from
+happening in the middle of C code. Basically, it makes any C
+code into a critical section, except when that C code explicitly releases
+the GIL. This greatly simplifies the task of writing extension
+modules as well the Python core. 
+
+The designers of Python made a design decision
+that extension writers would not have to take care of locking.
+Thus, Python is intended to be simple/easy to integrate with any C
+library.  In order to remove the GIL, you'd have to go into all existing
+C code and write explicit locking/unlocking code, and you'd have to do this with
+every new C library as well.
+
+[[ Description of how it supports/impacts reference-counted garbage collection]]
+
 Multiprocessing
 ===============================================================================
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.