GIL (Global interpreter Lock)
We know that multi-process (mutilprocess) and multi-threaded (threading) are designed to be accessed by multiple CPUs to improve program execution efficiency. But within Python there is a mechanism (GIL) that allows only one thread to access the CPU at the same time at multiple threads.
The GIL is not a Python feature, it is a concept introduced when implementing the Python parser (CPython). Just like C + + is a set of language (syntax) standards, but can be compiled into executable code with different compilers. Well-known compilers such as Gcc,intel c++,visual C + +.
Python is the same, and the same piece of code can be executed through different Python execution environments such as Cpython,pypy,psyco. Like the Jpython there is no Gil. However, because CPython is the default Python execution environment for most environments. So in a lot of people's concept CPython is Python, also take for granted the GIL to the Python language flaw. So let's be clear here: Gil is not a Python feature, and Python can be completely independent of the Gil.
Although Python supports multithreading, because of the Gil's limitations, when the program is actually running, multiple threads are opened, but only one thread can be executed by the CPU after the Gil.
GIL (Global interpreter Lock)