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


Groups > comp.lang.python > #61755

Re:

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <drsalists@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.036
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'cpython': 0.05; 'interpreter': 0.05; '(especially': 0.07; 'concurrently': 0.07; 'pypy': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; 'thread': 0.14; 'cc:name:python list': 0.16; 'ironpython': 0.16; 'machine?': 0.16; 'merely': 0.16; 'thread,': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'python?': 0.22; 'cc:addr:python.org': 0.22; 'closely': 0.24; 'module,': 0.24; 'guys': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'switch': 0.26; 'least': 0.26; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'dec': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'probably': 0.32; 'run': 0.32; 'advice': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'two': 0.37; 'list': 0.37; 'starting': 0.37; 'tasks': 0.38; '12,': 0.39; 'how': 0.40; 'experts': 0.60; 'problems.': 0.60; 'hope': 0.61; 'today.': 0.61; 'new': 0.61; 'term': 0.63; 'soon': 0.63; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'note:': 0.66; 'between': 0.67; 'introduce': 0.78; 'distinguish': 0.84; 'protects': 0.84; 'stm': 0.84; 'subject::': 0.85; 'browsing': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=lTsWpo4jOPtdSBTXCZHud5ny243i4tsiJzIISE9y7S4=; b=rNk5IiyqMhu6dHQ++GyJHk3HntVzeTFzMf++9M7xUGs6xBRdXHGM2Q/MLH5ypIXdi1 xyepBQRdLJqaRmYClEW1hCYssD5l9eqF0B7Z0Mq61UiGkNZ3owEm1ixV3OX6SpO5nQfJ kxWIdLceNxwnuFS3Na8nmioY0ay7PfTzcFm/2cH2JJdvm5q6ylVJ8nvZO/7EtIreCi6I JZRwEfCUQu+cxqaWeW0E4k35QSV0RVqH4PYCqJXSjX1njQro/LpwCGZcpVbSiFTwM4Jx FJEcU5QyeN1j+S1+jSSgWEbgpQOi0ZNdlRL2fh0jPAblk2uMC80xOGsg0VIOjxV8Xs8D 9VgA==
MIME-Version 1.0
X-Received by 10.180.211.212 with SMTP id ne20mr31024836wic.31.1386882906290; Thu, 12 Dec 2013 13:15:06 -0800 (PST)
In-Reply-To <6si4t0hdjeddqflqos0hd9tu.1386835600560@email.android.com>
References <6si4t0hdjeddqflqos0hd9tu.1386835600560@email.android.com>
Date Thu, 12 Dec 2013 13:15:06 -0800
Subject Re:
From Dan Stromberg <drsalists@gmail.com>
To marcinmltd <marcinmltd@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Cc Python List <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4024.1386882907.18130.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386882907 news.xs4all.nl 2883 [2001:888:2000:d::a6]:53931
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61755

Show key headers only | View raw


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.

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


Thread

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

csiph-web