Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have a very naive question. Why does Python have a GIL? Is it because of the language design, or because of its implementation?

If it’s due to the language design, how will Mojo avoid a GIL, given its goal is to be a superset of Python?



> Is it because of the language design, or because of its implementation?

Bit of both? The language expects properties that lend themselves to having a GIL (i.e. attempts at removing it from CPython have turned out to make it slower in many cases), but it's not impossible for an implementation that does more advanced analysis to be able to figure out cases where it isn't needed.

Code written to massively parallelize will want to/have to keep accesses inside the thread context anyways, and thus won't hit cases the GIL serves, and if you allow language extensions they can make that explicit where needed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: