DEV Community

Discussion on: Explain python global interpreter lock (GIL) Like I'm Five

 
msoedov profile image
Alex Miasoiedov • Edited

Idan, I understand where you coming from. Oversimplified explanation might zoom out from all of this concrete details. Nevertheless it at least can explain thing for those who don't know what mutex is.

The GIL is a "hidden" lock it's applied automatically

The word hidden and applied automatically are kind of misleading. GIL is implementation detail of Cpython's reference counting garbage collector and it could be implemented without it.

Thread Thread
 
rachit_gupta_ profile image
Rachit Gupta • Edited

Hi Alex, i got some questions regarding this ?
1) it was fine when we were considering the Python only, the basic python3 which ships with linux, and i understand that GIL is applicable to multi-processing but not to multi-threading ? please correct me if i'm wrong ?

2) How do CPython comes into play with the standard Python and how differently GIL plays it's role in Python and as well as it's other implementations ?

3) Although, libraries like numpy and pandas are written in C, so do GIL will play it's role here as well ? so can we take advantage of multi-processing by default ( that is not implementing multi-processing module explicitly ) ?

Can you help me with this ?