Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'socket': 0.04; 'cpython': 0.05; 'subject:Python': 0.06; 'core,': 0.07; 'python': 0.08; 'wrote:': 0.15; '(eg': 0.16; 'bieber': 0.16; 'core.': 0.16; 'cores': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'gil,': 0.16; '16,': 0.16; 'pm,': 0.16; 'onto': 0.19; 'received:209.85.210.174': 0.19; 'received:mail- iy0-f174.google.com': 0.19; 'header:In-Reply-To:1': 0.22; 'once.': 0.23; 'code': 0.24; 'modules': 0.25; 'lee': 0.28; 'sat,': 0.28; 'message-id:@mail.gmail.com': 0.28; 'bound': 0.29; '(so': 0.30; 'i/o': 0.30; 'threads': 0.30; 'separate': 0.31; 'to:addr:python- list': 0.34; 'calling': 0.34; "can't": 0.34; 'set.': 0.35; 'running': 0.35; 'actual': 0.35; 'subject:/': 0.36; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'too,': 0.38; 'two': 0.38; 'put': 0.38; 'run': 0.39; 'either': 0.39; 'to:addr:python.org': 0.39; 'might': 0.39; 'received:209': 0.40; 'it)': 0.67; 'share': 0.68; 'dennis': 0.77; 'claim': 0.77; 'safer': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=sbRIoaCY/AQh0VwfDrRChUXT81mpGsfXfQAfJdEEekE=; b=OG3/cZ8Fi+PG4ZzxEirUyflIEShJwzPwVleK5M1zOZCwNyGnW6A8RkqwISeECL3sCN JOcHsDvJlBSKOnAOfdIBxsbNKwT+pvvxveeEZkdh3q//hOnrDLe6zVJ1HViMN9LbbAaY yljOhUDyGCTKsb+wiImTYLhCUvV5usDcLTL54= MIME-Version: 1.0 In-Reply-To: References: Date: Sat, 16 Jul 2011 15:19:21 +1000 Subject: Re: Python threading/multiprocessing issue. From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310793564 news.xs4all.nl 23849 [2001:888:2000:d::a6]:36602 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9600 On Sat, Jul 16, 2011 at 3:15 PM, Dennis Lee Bieber wrote: > And (so far as I understand it) each process can claim its own CPU > core, whereas threads share the active core. Threads can be put onto separate cores too, and can have their affinities set. But because of the GIL, actual CPython code can't run on two cores at once. You might be able to have two Python threads running at once if they're calling into C modules most of the time, but it's much safer to either go multiprocessing or to use I/O bound threads (eg socket handlers). ChrisA