Global Variable In Multiprocessing

Chris Angelico rosuav at gmail.com
Wed Oct 23 02:44:39 EDT 2013


On Wed, Oct 23, 2013 at 5:22 PM, Chandru Rajendran
<Chandru_Rajendran at 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



More information about the Python-list mailing list