←back to thread

256 points rbanffy | 1 comments | | HN request time: 0.224s | source
Show context
pansa2 ◴[] No.44004148[source]
Does removal of the GIL have any other effects on multi-threaded Python code (other than allowing it to run in parallel)?

My understanding is that the GIL has lasted this long not because multi-threaded Python depends on it, but because removing it:

- Complicates the implementation of the interpreter

- Complicates C extensions, and

- Causes single-threaded code to run slower

Multi-threaded Python code already has to assume that it can be pre-empted on the boundary between any two bytecode instructions. Does free-threaded Python provide the same guarantees, or does it require multi-threaded Python to be written differently, e.g. to use additional locks?

replies(4): >>44004334 #>>44004386 #>>44007874 #>>44011862 #
1. btilly ◴[] No.44007874[source]
It makes race conditions easier to hit, and that will require multi-threaded Python to be written with more care to achieve the same level of reliability.