[issue11382] some posix module functions unnecessarily release the GIL

Charles-Francois Natali report at bugs.python.org
Thu Mar 3 13:39:12 CET 2011


Charles-Francois Natali <neologix at free.fr> added the comment:

Well, those are contrived examples showing the effect of the convoy effect induced by those unneeded GIL release/acquire: releasing and re-acquiring the GIL comes with a cost (e.g. under Linux, futex are really fast in the uncontended case since handled in use space but much slower when there's contention), and subverts the OS scheduling policy (forcing the thread to drop/re-acquire the GIL make the thread block after having consumed a small amount of its time slice and increases the context switching rate). I think that releasing and re-acquiring the GIL should only be done around potentially blocking calls.

> Do you have loops which contain no other syscall than os.dup2()?

No, but it's not a reason for penalizing threads that use dup, dup2 or pipe.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11382>
_______________________________________


More information about the Python-bugs-list mailing list