(original) (raw)

Hi,

I had a whole long email about exactly what I was doing, but I think I'll get to the point instead. I'm trying to implement a python concurrency API and would like to use cpython to do it. To do that, I would like to remove the GIL.


So, since I'm new to interpreter hacking, some help would be appreciated. I've listed what I think the GIL does; if you guys could add to this list or refine it, I would very much appreciate it.

Roles of the GIL:

1. Some global interpreter state/modules are protected (where are these globals at?)
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)


Does anyone know of a place where the GIL is required when not operating on a python object? It seems like this would never happen, and would make replacing the GIL somewhat easier.

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!


Thanks,
Justin