[PyQt] Multi-tasking and GIL

Arnold Krille arnold at arnoldarts.de
Tue Aug 4 11:25:21 BST 2009


Hi,

On Tuesday 04 August 2009 11:45:49 NARCISO, Rui wrote:
> I have a quad-core linux machine and I would like to take advantage of all
> these extra cores to perform multiple heavy tasks simultaneously.
> If i understood it correctly, the GIL will prevent me from multi-threading
> this heavy tasks in order to make them run in parallel.
> My question is then, how to do this? Will QProcess be the solution? (the
> heavy tasks can either be ran by direct python acess through a run()
> function or in stand-alone when launched from the command line)

There are at least two solutions:

1) If the work-threads need to use python, run them as independant processes 
(via QProcess or process-module). Communication can then go via std-io, named 
pipes, sockets or if you don't want to invent everything from scratch, via 
dbus or similar protocols.
2) If the heavy work heavy enough to allow writing it in C++, create all the 
work-stuff as C++ classes and use them in python via SIP. That way the real 
running of the C++-code should unlock the GIL.

> The information in this e-mail is confidential. The contents may not be
> disclosed or used by anyone other then the addressee. Access to this e-mail
> by anyone else is unauthorised. If you are not the intended recipient,
> please notify Airbus immediately and delete this e-mail. Airbus cannot
> accept any responsibility for the accuracy or completeness of this e-mail
> as it has been sent over public networks. If you have any concerns over the
> content of this message or its Accuracy or Integrity, please contact Airbus
> immediately. All outgoing e-mails from Airbus are checked using regularly
> updated virus scanning software but you should take whatever measures you
> deem to be appropriate to ensure that this message and any attachments are
> virus free.

I know some companies lawyers think these disclaimers are actually useful and 
needed. But could you separate them with a signature-mark ("-- " in one line)?
That way people answering wouldn't have to delete that part by hand.

Have fun,

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090804/6c4e3c4b/attachment.bin


More information about the PyQt mailing list