[PyKDE] Threading and multiple processors, any change?

V. Armando Sole sole at esrf.fr
Fri Mar 2 07:23:28 GMT 2007


At 12:18 01/03/2007 -0800, Kevin Cureton wrote:
>Summary: It is worthwhile using threads if you do a lot of
>computation that takes time from the UI. The abstraction makes it
>easy to move compute intensive code into a thread and then
>communicate with the main GUI thread when needed (via signals or
>events). You can even give your threads their own event loop, which
>creates opportunities for a more refined communication between
>threads in your application.

I have a calculation thread and a GUI thread. The calculation thread can be 
summarized as a loop in which the calculations of one loop iteration have 
nothing to do with the other iterations. My problem is that I would like to 
split the calculation thread into several threads in order profit from all 
the available CPUs. If I just use python threads (not multiple processes) 
and because of the GIL that is not possible (or I have missed something). 
On UNIX I can start different processes and let them communicate thru 
shared memory but I do not know how to do it on windows. I just wanted to 
know if with the latest changes one could split the calculations without 
going into C or C++ code, but following Phil's answer the GIL issues are 
still there.

Thanks a lot for all your answers.

Armando


On Mar 1, 2007, at 3:16 AM, Phil Thompson wrote:

>On Thursday 01 March 2007 10:47 am, V. Armando Sole wrote:
>>Hello,
>>
>>I just have a simple question (that does not imply a simple answer).
>>
>>With all the new options/possibilities recently discussed
>>concerning the
>>GIL handling, is it possible to profit of multiple processors in
>>Python
>>using QThreads thru PyQt4?
>
>The issues of a single GIL haven't gone away. The only difference
>is that the
>GIL is (probably) released much more frequently than it was before.
>The
>changes are to do with correctness (specifically deadlock
>avoidance) rather
>than performance.






More information about the PyQt mailing list