Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #15781

Re: Multiple threads

References <31766634.4.1321451296410.JavaMail.geo-discussion-forums@yqcm23> <CAPTjJmoAWni4-wyKB4HgAJ5KvTbz42_BC3f22MOnugUmmXzVtA@mail.gmail.com> <CAAdqOWF=irJXFO2q2+o8jpM09GMLf8N+NTNGTOtMhwKgtG6jag@mail.gmail.com> <4EC3F298.1030604@davea.name>
Date 2011-11-16 09:55 -0800
Subject Re: Multiple threads
From Michael Hunter <tahoemph@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2776.1321466127.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Nov 16, 2011 at 9:27 AM, Dave Angel <d@davea.name> wrote:
> On 11/16/2011 12:00 PM, Jack Keegan wrote:
>[...] Processes [...] and the OS is generally better at scheduling them than it is at
> scheduling threads within a single process.  If you have multiple cores, the
> processes can really run simultaneously, frequently with very small
> overhead.  [...]

Maybe you are trying to simplify things but in a lot of cases this is
just false.  In at least some operating systems these days a thread is
the basic unit that is scheduled.  Processes are thread containers
that provide other things (fds, separate address space, etc.).  The
comment about multiple cores can be extended to multiple threads on a
core (CMT) but applies to threads as well as processes.  Switching
between processes tends to be heavier weight then switching between
threads in a process because of the needs to change the address space.

Just because Python sucks at threads doesn't make them heavier for the OS.

That doesn't mean you shouldn't use multiprocessing.  The problem
asked about seems a good fit to me to a single python process starting
and managing a set of external converter processes.

              Michael

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Multiple threads Eduardo Oliva <dutche@gmail.com> - 2011-11-16 05:48 -0800
  Re: Multiple threads Chris Angelico <rosuav@gmail.com> - 2011-11-17 00:55 +1100
  Re: Multiple threads Henrik Faber <hfaber@invalid.net> - 2011-11-16 15:07 +0100
  Re: Multiple threads Christian Heimes <lists@cheimes.de> - 2011-11-16 16:01 +0100
  Re: Multiple threads Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-11-16 17:45 +0100
    Re: Multiple threads Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-11-16 16:38 -0800
  Re: Multiple threads Dave Angel <d@davea.name> - 2011-11-16 12:27 -0500
  Re: Multiple threads Michael Hunter <tahoemph@gmail.com> - 2011-11-16 09:55 -0800
  Re: Multiple threads Dave Angel <d@davea.name> - 2011-11-16 13:06 -0500
  Re: Multiple threads Dave Angel <d@davea.name> - 2011-11-16 13:30 -0500
  Re: Multiple threads Miki Tebeka <miki.tebeka@gmail.com> - 2011-11-16 12:50 -0800

csiph-web