From: Lou on
Can anyone tell me how easy it is to do multi-threading in Python?
This has probably been brought up already, so if it has, thanks anyway
From: Adam Tauno Williams on
On Tue, 2010-05-18 at 07:35 -0700, Lou wrote:
> Can anyone tell me how easy it is to do multi-threading in Python?

Very easy. Or as easy as in any other platform - and as easy to screw
up. Personally I prefer to use multiprocessing [which is a module that
'simulates' threads using separate processes]. IMO, it is hard to screw
up as you don't get any shared-state for free.

> This has probably been brought up already, so if it has, thanks anyway

--
Adam Tauno Williams <awilliam(a)whitemice.org> LPIC-1, Novell CLA
<http://www.whitemiceconsulting.com>
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba

From: geremy condra on
On Tue, May 18, 2010 at 7:35 AM, Lou <lourosas(a)gmail.com> wrote:
> Can anyone tell me how easy it is to do multi-threading in Python?
> This has probably been brought up already, so if it has, thanks anyway
> --
> http://mail.python.org/mailman/listinfo/python-list

It's very easy, but it's probably best to use multiple processes to take
advantage of multiple cores. Take a look at the threading and
multiprocessing modules.

Geremy Condra
From: Terry Reedy on
On 5/18/2010 11:29 AM, Sandy Ydnas wrote:

> can help to find some examples of multiprocessing

Multiprocessing is designed to be api-compatible with threading.
Search the archives of this list/newsgroup for several examples.


From: Adam Tauno Williams on
On Tue, 2010-05-18 at 20:29 +0500, Sandy Ydnas wrote:
> great
> can help to find some examples of multiprocessing

There is the reasonably good documentation at:
<http://docs.python.org/library/multiprocessing.html>

I did a Multiprocessing presentation recently:
<http://groups.google.com/group/grpug/web/Multiprocessing.pdf>

And I use multiprocessing in my project; but less than previously as I
now use AMQ for the IPC and multiprocessing only for the process
management.
<http://coils.hg.sourceforge.net/hgweb/coils/coils/file/af60dd17fa0e>
But an entire project is quite a bit to pick through.

> > Subject: Re: Multi-Threading in Python
> > From: awilliam(a)whitemice.org
> > To: python-list(a)python.org
> > Date: Tue, 18 May 2010 10:45:11 -0400
> >
> > On Tue, 2010-05-18 at 07:35 -0700, Lou wrote:
> > > Can anyone tell me how easy it is to do multi-threading in Python?
> >
> > Very easy. Or as easy as in any other platform - and as easy to
> screw
> > up. Personally I prefer to use multiprocessing [which is a module
> that
> > 'simulates' threads using separate processes]. IMO, it is hard to
> screw
> > up as you don't get any shared-state for free.
> >
> > > This has probably been brought up already, so if it has, thanks
> anyway
> >
> > --
> > Adam Tauno Williams <awilliam(a)whitemice.org> LPIC-1, Novell CLA
> > <http://www.whitemiceconsulting.com>
> > OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
>
>
> ______________________________________________________________________
> Hotmail: Free, trusted and rich email service. Get it now.