New submission from Charles-Francois Natali <neolo...@free.fr>: Some posix module functions unnecessarily release the GIL. For example, posix_dup, posix_dup2 and posix_pipe all release the GIL, but those are non-blocking syscalls (the don't imply any I/O, only modifying the process file descriptors table). This leads to the famous convoy effect (see http://bugs.python.org/issue7946).
For example: $ cat /tmp/test_dup2.py import os import threading import sys import time def do_loop(): while True: pass t = threading.Thread(target=do_loop) t.setDaemon(True) t.start() f = os.open(sys.argv[1], os.O_RDONLY) for i in range(4, 1000): os.dup2(f, i) Whith GIL release/acquire: $ time ./python /tmp/test_dup2.py /etc/fstab real 0m5.238s user 0m5.223s sys 0m0.009s $ time ./python /tmp/test_pipe.py real 0m3.083s user 0m3.074s sys 0m0.007s Without GIL release/acquire: $ time ./python /tmp/test_dup2.py /etc/fstab real 0m0.094s user 0m0.077s sys 0m0.010s $ time ./python /tmp/test_pipe.py real 0m0.088s user 0m0.074s sys 0m0.008s ---------- title: some posix module functions -> some posix module functions unnecessarily release the GIL _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11382> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com