3 ms·
GIL may and does get released in the interpreter (on I/O) and C extensions such as regex, lxml, numpy. Performance sensitive extensions may even use multiple CP
by d0mine 10y ago
GIL may and does get released in the interpreter (on I/O) and C extensions such as regex, lxml, numpy. Performance sensitive extensions may even use multiple CPU cores implicitly e.g., as numpy.dot() can do for large enough input without changing the code in any way.
- retrogradeorbit 10y agoYes, leading to C extensions that are not thread safe and so can't be used in multi-threaded code at all. An example I'm familiar with is pylibmc.
- d0mine 10y agoWrong. GIL does NOT necessarily make your Python/C code thread-safe and in reverse releasing GIL does not prevent you from writing a thread-safe code.