ELI5: Explain Like I'm 5

Global interpreter lock

Have you ever played a game with lots of players that involves taking turns to do something? Let's say you're playing a game where you pass a toy to the next person and they do the same until everyone has had a turn. And while one person is holding the toy, they get to do a special action like drawing a picture or dancing.

The Global Interpreter Lock (GIL) is like a rule saying that only one person can hold the toy and do a special action at a time. So, even if two people finish their turn at the same time, only one of them can do the special action while the other has to wait.

In computer programming, when we write code in a language like Python, there's a "toy" called a thread that runs the code. And just like in the game, only one thread can run at a time and do a "special action" like accessing a file or sending a message.

The GIL is like the rule that says only one thread can run at a time, even if there are multiple threads that are ready to run. This can slow down some programs because it means that the computer can't use all of its processors (like players in the game) at the same time to do multiple things.

So, while the GIL keeps things simple by making sure that only one thread is running at once, it also means that some programs might not be as fast as they could be.
Related topics others have asked about: