New submission from Kristján Valur Jónsson <krist...@ccpgames.com>:
This patch does several things: 1) Creates a separate lock type PyThread_type_gil and locking functions for that. This allows tweaking of the GIL without affecting regular lock behaviour. 2) Creates a uniform implementation of the GIL on windows/pthreads using macros, with emulated condition variables on windows (Lifted Antoine's code from py3k, adding own improvements to the slightly problematic windows implementation). This makes the GIL behave the same on windows and pthreads platforms, if we so choose, and allows cross-platform development. 3) provide three GIL implementations: a) legacy gil, which is the same as the one used on pthreads b) a roundrobin gil, which fixes the multicore problem on pthreads and exhibits the same behaviour as the legacy GIL on windows did (no jumping the gil queue) c) a priority based gil, with n given priority levels, and optionally, the ability to request immediate GIL drop by the ceval.c loop. See thread_gil.h for details of the three modes. In my experiments using David Beazley's scripts from http://www.dabeaz.com/blog/dablog.html, implementation "b" fixed the performance problems encountered on multicore machines. This is, I believe, the original impetus for Antoine Pitrou's work on the new GIL. Implementation "c" improved data transfer still, by allowing faster wakeup of completed IO. Please note that I was not able to test this patch on a pthreads machine, I can only hope that it compiles :) ---------- components: Interpreter Core files: gil.patch keywords: patch, patch messages: 102234 nosy: beazley, krisvale, pitrou severity: normal status: open title: Improve GIL in 2.7 type: performance versions: Python 2.7 Added file: http://bugs.python.org/file16744/gil.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8299> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com