Why is a Python I/O bound task not blocked by the GIL?

All of Python’s blocking I/O primitives release the GIL while waiting for the I/O block to resolve — it’s as simple as that! They will of course need to acquire the GIL again before going on to execute further Python code, but for the long-in-terms-of-machine-cycles intervals in which they’re just waiting for some I/O syscall, they don’t need the GIL, so they don’t hold on to it!

Leave a Comment