multi threading in multi processor (computer)
Jeremy Jones
zanesdad at bellsouth.net
Wed Feb 9 10:35:00 EST 2005
Pierre Barbier de Reuille wrote:
> ajikoe at gmail.com a écrit :
>
>> Hello,
>>
>> Is anyone has experiance in running python code to run multi thread
>> parallel in multi processor. Is it possible ?
>>
>> Can python manage which cpu shoud do every thread?
>>
>> Sincerely Yours,
>> Pujo
>>
>
> There's just no way you can use Python in a multi-processor environment,
This isn't exactly correct. There is no way with plain, out of the box
Python (and writing plain Python code) to take full advantage of
multiple processors using a single process. A single plain vanilla
Python process will saturate at most one CPU. I think that's what you
were trying to express, but I thought it would be best to clarify. The
machine I'm running on right now is a dual-CPU machine. I can
*definitely* run Python on it. I haven't tried threading just yet since
it's a new-to-me machine. But if I were to watch gkrellm, I would
expect to see a CPU intensive (multithreaded) process flip back and
forth between the two CPUs, taking its turn totally saturating both of
them, one at a time.
> because the GIL (Global Interpreter Lock) will prevent two threads
> from running concurrently. When I saw this discussed, the Python
> developper were more into multi-process systems when it comes to
> multi-processors.
> I think I even heard some discussion about efficient inter-process
> messaging system, but I can't remember where :o)
>
> Hope it'll help.
>
> Pierre
Jeremy Jones
More information about the Python-list
mailing list