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

I know this is a joke, but you still need locks in Python


I didn't read it as a joke, you're just operating at a different abstraction level. The CPython interpreter famously uses a single global interpreter lock to protect the language internals and runtime, so it has trouble scaling beyond a single CPU on interpreter-heavy workloads. You're saying that threads in python scripts can be arbitrarily preempted, and so locking is required to protect them against each other, which is also true.


Theoretically not necessarily the referenced GIL, though. There are conceptually alternative models; see Microsoft doc[0] on apartment threading model, or Tcl[1].

[0] https://docs.microsoft.com/en-us/windows/win32/com/processes...

[1] https://stackoverflow.com/questions/45799121/runtimeerror-ca...




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

Search: