L
Luis P Caamano
global interpreter lock
The lock used by Python threads to assure that only one thread
can be run at a time. This simplifies Python by assuring that no
two processes can access the same memory at the same time. Locking
the entire interpreter makes it easier for the interpreter to be
multi-threaded, at the expense of some parallelism on
multi-processor machines.
Some parallelism??? Wouldn't it be more accurate to say
"at the expense of parallelism?" The GIL doesn't eliminate
"some" paralellism, it completely eliminates any chance of
parallelism within the same interpreter.
Efforts have been made in the past to create a "free-threaded"
interpreter (one which locks shared data at a much finer
granularity), but performance suffered in the common
single-processor case.
This is true for kernels too, which is why you see at least
two versions of the linux kernel in red hat distributions,
one with SMP enabled and one without it.
Why not have a python_smp interpreter that allows parallelism
(and scalability) on SMP machines and another for uniprocessor
machines where paralellism is not possible?
Yeah, yeah, I know what you're going to say ...
"Please submit a patch."
Sigh, ... if only I had the time ... :-(