Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Python GIL really per interpreter?

I often see people talking that the GIL is per Python Interpreter (even here on stackoverflow).

But what I see in the source code it seems to be that the GIL is a global variable and therefore there is one GIL for all Interpreters in each python process. I know they did this because there is no interpreter object passed around like lua or TCL does, it was just not designed well in the beginning. And thread local storage seems to be not portable for the python guys to use.

Is this correct? I had a short look at the 2.4 version I'm using in a project here.

Had this changed in later versions, especially in 3.0?

like image 612
Lothar Avatar asked Oct 18 '09 15:10

Lothar


1 Answers

The GIL is indeed per-process, not per-interpreter. This is unchanged in 3.x.

like image 64
Martin v. Löwis Avatar answered Oct 02 '22 01:10

Martin v. Löwis