Will multithreading make python less popular?

Michele Simionato michele.simionato at gmail.com
Wed Feb 18 05:33:46 CET 2009


On Feb 18, 4:47 am, Graham Dumpleton <Graham.Dumple... at gmail.com>
wrote:
> It is also a mistaken belief that you cannot take advantage of multi
> cores with multiple threads inside of a single process using Python.
>
> What no one seems to remember is that when calls are made into Python
> extension modules implemented in C code, they have the option of
> releasing the Python GIL. By releasing the Python GIL at that point,
> it would allow other Python threads to run at the same time as
> operations are being done in C code in the extension module.

You are perfectly right and no one forgot this point,
I am sure. However I think we were answering to the question
"can pure Python code take advantage of multiple CPUs
via multithreading" and the answer is no. Of course a
C extension can do that, but that is beside the point.
It is still worth noticing - as you did -
that some well known Python (+C extension) library -
such as mod_wsgi - is already well equipped to manage
multithreading on multiple cores without any further
effort from the user. This is a good point.

                 Michele Simionato



More information about the Python-list mailing list