Python threading (was: Re: global interpreter lock not working as it should)

Armin Steinhoff a-steinhoff at
Wed Aug 7 04:34:23 EDT 2002

brueckd at wrote in message news:<mailman.1028668676.11567.python-list at>...
> On 6 Aug 2002, Armin Steinhoff wrote:
> > Hi All,
> > 
> > after modifying ceval.c and the lock support for POSIX systems ... here some
> > results.
> > 
> > The number of thread switches is 10 times higher with the new lock routines.
> > 
> > After including a conditional sched_yield() .. the thread switches speeds up 
> > by the factor 23 :) 
> So now the big question is: how does this affect the performance of Python 
> programs that already work great (i.e. multithreaded Python programs that 
> actually do real work)?

Don't worry ... these changes are made and tested on my desk as a
proof of concept, nothing else.

To have an accepptable  ->thread performance<- for POSIX systems I
would propose to do a separation of the lock handling at application
(thread) level
and the handling of the GIL at system level ... just to cleanup the
internal design!

In the moment it makes no sense to use the 'Python threads' for POSIX
'if and only if' you need performance (or real-time performance).

However ... if there is time I will try to implement the GIL handling
at system level without using the routines of the threadmodule.



> -Dave

More information about the Python-list mailing list