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


Groups > comp.lang.python > #7473

Re: which threading libraries to use?

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'twisted,': 0.07; 'whichever': 0.07; 'http,': 0.09; 'likely.': 0.09; 'myself,': 0.09; 'pm,': 0.10; 'wrote:': 0.14; 'library': 0.15; 'angelico': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'occasionally': 0.16; 'snmp,': 0.16; 'threading': 0.16; 'worried': 0.16; 'class,': 0.16; 'preference': 0.16; 'starts': 0.20; 'work,': 0.20; 'header:In-Reply-To:1': 0.21; 'gil': 0.23; 'received:209.85.210.174': 0.23; 'received:mail- iy0-f174.google.com': 0.23; 'project,': 0.24; 'subject:use': 0.25; 'message-id:@mail.gmail.com': 0.28; 'subject:?': 0.29; 'besides': 0.29; "python's": 0.29; 'asynchronous': 0.30; 'sun,': 0.30; "they'll": 0.30; 'threads': 0.30; 'hi,': 0.31; 'to:addr:python- list': 0.33; 'things': 0.33; 'chris': 0.34; 'there': 0.35; 'switch': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.37; 'coding': 0.37; 'reasons': 0.37; 'think': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'unless': 0.39; 'easier': 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.39; 'best': 0.60; 'your': 0.60; 'waiting': 0.61; 'dennis': 0.77; 'about?': 0.84; 'licensing': 0.84; 'other?': 0.84; '\xa0most': 0.84; 'eliminates': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=cuzm1XYzC3/5vzq44JecNVkQDVntcWD0LpmHfeprbSY=; b=jKYxcLqNbZvRT4FqWHShj3no6xVmcyhkMimNK1ULFP/CeRCf8FU0BQ8WvF8DQIhgwh W1BZ/00h7GYiPB+juaRD6oPH0EPUYAjK/hwtdWG1tyKEjQrqTo7K+D3dgkaxC8GfnpTX JIzhn/YwicWnbigKCGk1NPXtJ9tbLW6kvumPU=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=azZGHw1pTRhk/cXJNvko5/TJpqOMF/MRjcLskv+oDRTSvOaKn5LezMKGMVFh2+q3U9 Qsn32ksk5DLwAqbDOqPHOosGWV30q375rocZmoMeuwB+qeOz7AD4aESF9+yXpk9+Pys4 7bbyksoSu5r/tGwBHxTr7gRy0Pa13lfeNC6xA=
MIME-Version 1.0
In-Reply-To <BANLkTin6Mx7m3PMnv9EFwDGeuwXk5GNJbg@mail.gmail.com>
References <BANLkTin6Mx7m3PMnv9EFwDGeuwXk5GNJbg@mail.gmail.com>
Date Sun, 12 Jun 2011 15:01:53 +1000
Subject Re: which threading libraries to use?
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.148.1307854917.11593.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 82.94.164.166
X-Trace 1307854917 news.xs4all.nl 49044 [::ffff:82.94.164.166]:54646
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7473

Show key headers only | View raw


On Sun, Jun 12, 2011 at 2:10 PM, Dennis <daodennis@gmail.com> wrote:
> Hi,
>
> Are there any reasons besides personal preference to use one
> particular threading library over the other?  Eventlet, Twisted, and
> Python's native Threading class, or are there even others?  Are there
> any licensing or redistribution restrictions that I should be worried
> about?  Which ones do you consider best documented?  Most thread-safe?
> Efficient?

I use the native Threading class, myself, largely because it's so easy
to switch to multiprocessing if the GIL starts to get in the way. YMMV
if you don't use CPython.

> Ultimately this will be used for asynchronous SNMP, HTTP, and WMI.  I
> don't think this will need to evolve into a multi-process project,
> unless of course that is much easier to do than multi-threading?

In all probability, your threads will spend 99% of their time waiting
for the network. This makes threads very effective, and largely
eliminates the GIL issues (if they occasionally have to take turns,
it's not going to affect things much). Pick whichever threading
library suits your coding style; they'll all work, most likely.

Chris Angelico

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


Thread

Re: which threading libraries to use? Chris Angelico <rosuav@gmail.com> - 2011-06-12 15:01 +1000

csiph-web