Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!news.albasani.net!news2.arglkargh.de!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.062 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'subject:Python': 0.06; 'sockets': 0.09; 'cpython,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'gil,': 0.16; 'thread.': 0.16; 'threading': 0.16; 'received:209.85.210.174': 0.19; 'received :mail-iy0-f174.google.com': 0.19; 'header:In-Reply-To:1': 0.22; 'code.': 0.22; 'code': 0.24; 'lee': 0.28; 'process,': 0.28; 'message-id:@mail.gmail.com': 0.28; 'variables': 0.29; 'problem': 0.29; 'object': 0.30; 'separate': 0.31; 'changes': 0.31; 'words,': 0.32; 'to:addr:python-list': 0.34; 'there': 0.34; 'latter': 0.35; 'replacement': 0.35; 'running': 0.35; 'subject:/': 0.36; 'but': 0.37; 'could': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'think': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'your': 0.60; 'matter': 0.61; 'making': 0.66; 'exact': 0.69; 'guaranteed': 0.77; '(network': 0.84; 'realm': 0.84; 'signals,': 0.84 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=PJlWn73iVUVsoapcHD+l90xeHcqlmXRT+CYpkP3RAMY=; b=QoyI2U8Y0n8zqzu7xNgEUFrvBWdN1LH4bXpKFO44k3dlUYYz1arep1XuOzop935Yg5 /9Z/hVdHWM83KOIEYyUeU6TBkmMv3bFXaLgTENTmMfX9c4cij1/weQ5H6+2Y9igYV7zr RqG++PsKZKNDiw7dTUwB8QfvdIqOVB6jHxP14= MIME-Version: 1.0 In-Reply-To: References: Date: Sat, 16 Jul 2011 09:34:40 +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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310772884 news.xs4all.nl 23927 [2001:888:2000:d::a6]:54205 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9582 2011/7/16 Lee Harr : > I am not a multiprocessing expert, but I think the problem you > are having is that Process is running your code in a separate > process, so there is no way you could see those object changes > in your main line code. > > In other words, Process is not an exact replacement for Thread. > That's correct; inter-process communication is the realm of sockets (network or Unix), pipes, signals, etc - but inter-thread communication is a matter of making sure you don't tread on each other's toes. In CPython, the latter is guaranteed by the GIL; the specific advantage of multiprocessing over threading is that each process has a separate GIL, and that's because all variables are separate. ChrisA