Author kristjan.jonsson
Recipients beazley, kristjan.jonsson, pitrou
Date 2010-04-03.10:27:17
SpamBayes Score 1.64378e-06
Marked as misclassified No
Message-id <>
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, 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 :)
Date User Action Args
2010-04-03 10:27:25kristjan.jonssonsetrecipients: + kristjan.jonsson, beazley, pitrou
2010-04-03 10:27:25kristjan.jonssonsetmessageid: <>
2010-04-03 10:27:22kristjan.jonssonlinkissue8299 messages
2010-04-03 10:27:21kristjan.jonssoncreate