[Python-Dev] python running in several threads

"Martin v. Löwis" martin at v.loewis.de
Wed Jun 8 00:28:29 CEST 2005


Aahz wrote:
>>Under those limitations, do you think, an easy rewrite of execution
>>engine is possible to allow simultaneous run of all threads?
> 
> 
> Short answer: no
> 
> Longer answer: see previous threads about removing the GIL; if you still
> have questions, please post to comp.lang.python.

Or, as a medium-sized answer: google for "python free threading".
Removing the GIL is easy, but then the interpreter crashes in cases of
simultaneous accesses to dictionaries, reference counters, etc.

I also disagree with Martin Aliger's premises:

# This degrades performance IMHO, mainly on server installations
# (many web servers use python engine).

This is just not true. On a single-processor machine, the GIL does
*not* degrade performance. Instead, it increases throughput (and
thus performance).

On a multi-processor machine, you often use multiple operating
system processes to serve request (e.g. in CGI or Apache mpm-prefork,
or even the typical mpm-worker configuration). If you then have
different processes running Python, they don't interfere with
each other at all.

Regards,
Martin


More information about the Python-Dev mailing list