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


Groups > comp.lang.python > #61755 > unrolled thread

Re:

Started byDan Stromberg <drsalists@gmail.com>
First post2013-12-12 13:15 -0800
Last post2013-12-12 13:15 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Dan Stromberg <drsalists@gmail.com> - 2013-12-12 13:15 -0800

#61755 — Re:

FromDan Stromberg <drsalists@gmail.com>
Date2013-12-12 13:15 -0800
SubjectRe:
Message-ID<mailman.4024.1386882907.18130.python-list@python.org>
On Thu, Dec 12, 2013 at 12:06 AM, marcinmltd <marcinmltd@gmail.com> wrote:
> Hello,
>
> I'm big fan of multiprocessing module, but recently I started looking at
> threading in Python more closely and got couple of questions I hope You can
> help me with:
>
> 1. When I run two or more threads in my python process are they really run
> concurrently on mulicore machine?
>
> 2. Browsing through documentation it looks like python interpreter protects
> its sensitive states by using GIL. Can you guys list situations when this
> happens?
>
> 2. What would be general advice from python experts on when to use threadng
> and when switch to multliprocessing in python? Is the decision still
> influenced by how often we need to comunicate between the tasks as it's in
> C\C++?

Jython and IronPython reportedly thread well generally.

CPython threads I/O-bound tasks well, but as soon as you introduce one
CPU-bound thread, the other threads start to have problems.  Pypy is
probably the same as CPython, at least until they get their STM
working well.

Multiprocessing can do CPU-bound and I/O-bound workloads, but starting
a new process takes longer than starting a new thread (especially on
Windows).  Inter-thread/process communication is likely slower on
multiprocessing than multithreading as well, but this is merely my
inference.

Note: CPython is what a lot of people call "Python"; CPython is a new
term for the original implementation to distinguish it from the other
implementations that exist today.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web