[Python-Dev] Removing the GIL (Me, not you!)

"Martin v. Löwis" martin at v.loewis.de
Tue Sep 11 10:33:17 CEST 2007


> 1. Some global interpreter state/modules are protected (where are these
> globals at?)

It's the interpreter and thread state itself (pystate.h), for the thread
state, also _PyThreadState_Current. Then there is the GC state, in
particular "generations". There are various caches and counters also.

> 2. When writing C extensions I can change the state of my python object
> without worrying about synchronization
> 3. When writing C extensions I can change my own internal C state
> without worrying about synchronization (unless I have other, non-python
> threads running)
4. The builtin container types are protected by the GIL, and various
   other builtin objects
5. Reference counting is protected by the GIL
6. PyMalloc is protected by the GIL.

> Does anyone know of a place where the GIL is required when not operating
> on a python object?

See 6 above, also (obviously) 1.

> I've only started looking at the code recently, so please forgive my
> naivety. I'm still learning how the interpreter works on a high level,
> let alone all the nitty gritty details!

Good luck!

Martin


More information about the Python-Dev mailing list