You can get rid of the GIL in the same way that the Linux guys got rid of Big Kernel locks: just add a lot of finer-grained locks or use atomic primitives that don't need locks.
The downside and the main reason that Python doesn't do this is performance. For example, the Tcl interpreter does not have a GIL, but can be compiled with a stream and non-threaded, if you use the stream version, you get 10-20% less performance than in the single-threaded case. Therefore, if you do not use threads, this is slower. There were Python fixes for adding small locks, but they had even worse performance implications, so they were rejected.
This is just a compromise, the python developers decided that the performance of a single thread (and backward compatibility with C-extensions) is much more important than the ability to use many threads at the python level. You can still freely use streams inside the C-extension, not to mention the value of the python language level.
schlenk
source share