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


Groups > comp.lang.python > #57344

Re: Global Variable In Multiprocessing

References <F9D8DC52CB96E24D8C7AA5F8E9781E881E3DBFEE@BLRKECMBX23.ad.infosys.com>
Date 2013-10-23 17:44 +1100
Subject Re: Global Variable In Multiprocessing
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1397.1382510683.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Oct 23, 2013 at 5:22 PM, Chandru Rajendran
<Chandru_Rajendran@infosys.com> wrote:
>
> I am newbie to python. Please give me an idea to use Global Variable In multiprocessing with examples. Also give me an best practices of multiprocessing.

Fundamentally, you can't have mutable globals in multiprocessing
(though you can have immutables - they'll get copied into each
subprocess). Instead, look into the various data structures like the
queue, which can transfer information from one process to another. The
best option depends a lot on what you're doing - but you can find some
tips and ideas in the multiprocessing module's documentation. (You
HAVE read the docs already, right? :) )

ChrisA

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


Thread

Re: Global Variable In Multiprocessing Chris Angelico <rosuav@gmail.com> - 2013-10-23 17:44 +1100

csiph-web