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

Bengt Richter bokr at oz.net
Wed Aug 7 19:59:09 EDT 2002


On 07 Aug 2002 14:03:50 +0200, loewis at informatik.hu-berlin.de (Martin v. =?iso-8859-15?q?L=F6wis?=) wrote:

>a-steinhoff at web.de (Armin Steinhoff) writes:
>
>> In the moment it makes no sense to use the 'Python threads' for
>> POSIX systems 'if and only if' you need performance (or real-time
>> performance).
>
>Whatever changes you make, they can't increase the performance. If you
>need performance, you better avoid threads. On a single processor,
>threads can only slow down the entire computation.
>
If you're talking about the compute-bound situation, as we have been,
yes, but typically all is not computation. I don't expect you mean that
in general multithreading always slows down a *system* ;-)

I.e., system throughput depends on timely cooperation with hardware,
and a good threading system makes that easier to program. Even a suboptimal
threading implementation can beat a single thread if the latter doesn't poll
adequately (i.e., in place of ceval's polling, thereby effectively doing its
own multithreading), or have signal handler help, etc. And polling adequately
can't beat non-polling event-driven help from an OS (with some exceptions for
high fequency polling).

Regards,
Bengt Richter



More information about the Python-list mailing list