Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55422
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'scripts': 0.03; 'preference': 0.07; 'subject:script': 0.09; 'python': 0.11; 'cons': 0.16; 'fine.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'jython,': 0.16; 'processes.': 0.16; 'referencing': 0.16; 'script?': 0.16; 'subject:versus': 0.16; 'variables,': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'separate': 0.22; 'module,': 0.24; 'looks': 0.24; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; '(like': 0.30; 'message- id:@mail.gmail.com': 0.30; 'purely': 0.31; "they'll": 0.31; 'run': 0.32; 'running': 0.33; 'fri,': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'easily': 0.37; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'matter': 0.61; 'simply': 0.61; "you're": 0.61; 'details': 0.65; 'between': 0.67; 'suits': 0.84; '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 :content-type; bh=CrFNc1EK1Em5IzjiZWiqqG93h43fHgETeRIBjpmlP18=; b=ih3pGSOzo7m/5MwJYoP3L51dF0aPWC9Hq0+nmOhebnn/LiDrO437hC1QG/fK6BSNlE 0l3QhL5643Gc+efVrhRRgFWgELcmeHyxsH6lA6d2tihifN/vFGK6E6YiD6ybootFHe48 7MklF0xWIZZlwLlXx/9CEOmS4bsxWlpvlgmgmLaWQ0m+Run97mfcLP4BzYNETB6mocu/ vm2DEQEdavvbsAlpU2ZULMTGYH6OCy0PEEiLAQyFy/sarxbM8aLERooR8Dmflh6u8v8y mtLX7BDZv3PGWOytgrBVvHITRuXQxR351v4dUyPLsPmSt8Ng+A9/Svgcua3Cm6ea6iVP zShw== |
| MIME-Version | 1.0 |
| X-Received | by 10.68.192.195 with SMTP id hi3mr9631437pbc.18.1380818524727; Thu, 03 Oct 2013 09:42:04 -0700 (PDT) |
| In-Reply-To | <f01b2e7a-9fc7-4138-bb6e-447d31179f2d@googlegroups.com> |
| References | <f01b2e7a-9fc7-4138-bb6e-447d31179f2d@googlegroups.com> |
| Date | Fri, 4 Oct 2013 02:42:04 +1000 |
| Subject | Re: Multiple scripts versus single multi-threaded script |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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.682.1380818535.18130.python-list@python.org> (permalink) |
| Lines | 17 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1380818535 news.xs4all.nl 16003 [2001:888:2000:d::a6]:42048 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:55422 |
Show key headers only | View raw
On Fri, Oct 4, 2013 at 2:01 AM, JL <lightaiyee@gmail.com> wrote: > What is the difference between running multiple python scripts and a single multi-threaded script? May I know what are the pros and cons of each approach? Right now, my preference is to run multiple separate python scripts because it is simpler. (Caveat: The below is based on CPython. If you're using IronPython, Jython, or some other implementation, some details may be a little different.) Multiple threads can share state easily by simply referencing each other's variables, but the cost of that is that they'll never actually execute simultaneously. If you want your scripts to run in parallel on multiple CPUs/cores, you need multiple processes. But if you're doing something I/O bound (like servicing sockets), threads work just fine. As to using separate scripts versus the multiprocessing module, that's purely a matter of what looks cleanest. Do whatever suits your code. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Multiple scripts versus single multi-threaded script JL <lightaiyee@gmail.com> - 2013-10-03 09:01 -0700
Re: Multiple scripts versus single multi-threaded script Roy Smith <roy@panix.com> - 2013-10-03 12:41 -0400
Re: Multiple scripts versus single multi-threaded script Chris Angelico <rosuav@gmail.com> - 2013-10-04 02:50 +1000
Re: Multiple scripts versus single multi-threaded script Roy Smith <roy@panix.com> - 2013-10-03 14:28 -0400
Re: Multiple scripts versus single multi-threaded script Chris Angelico <rosuav@gmail.com> - 2013-10-04 04:36 +1000
Re: Multiple scripts versus single multi-threaded script Roy Smith <roy@panix.com> - 2013-10-03 15:53 -0400
Re: Multiple scripts versus single multi-threaded script Chris Angelico <rosuav@gmail.com> - 2013-10-04 08:22 +1000
Re: Multiple scripts versus single multi-threaded script Dave Angel <davea@davea.name> - 2013-10-03 18:40 +0000
Re: Multiple scripts versus single multi-threaded script Jeremy Sanders <jeremy@jeremysanders.net> - 2013-10-04 10:02 +0200
Re: Multiple scripts versus single multi-threaded script Grant Edwards <invalid@invalid.invalid> - 2013-10-04 16:38 +0000
Re: Multiple scripts versus single multi-threaded script Chris Angelico <rosuav@gmail.com> - 2013-10-04 02:42 +1000
csiph-web