Gil should be a regular interview question, what is
Gil? The Gil is the whole of global interpre lock (Universal interpreter lock). Not a Gil in Python, but a global interpreter lock in CPython. (No Gil in Jpython) The Gil is a mutex, CPython is not a thread-safe when executing multithreading, and the global interpreter lock is considered for the security of the program. Each CPU can only execute one thread at a time. Under Python multithreading, the execution of each thread requires a lock competition, and only the thread that gets the Gil can execute. Because of the Gil's existence, a process in Python can always execute only one thread at a time, which is why the multithreading efficiency of Python is not high on multicore CPUs. Because of the Gil, Python's multithreading is not friendly to CPU-intensive code, and is more friendly to IO-intensive code. 1 because of computationally intensive programs, you need to consume system resources.
the existence of the Gil is equivalent to the constant single-threaded operation, which is slow. The reason why 2.IO-intensive has little effect, io,input/output, these two words indicate that the bottleneck of the program is the input
The time spent, the threads wait most of the time, so they are multiple together (multithreading) or single (single threaded) no matter
Multithreading is shared memory, which means that these threads share a single memory address. The advantage is that it facilitates data communication between threads
and data synchronization
Multi-process, each process address is a separate memory address. So there's no communication between addresses.
Python Global Interpreter Lock (GIL)