Persistent variable in subprocess using multiprocessing?

Piet van Oostrum piet at cs.uu.nl
Thu Jul 16 21:10:08 CEST 2009


>>>>> mheavner <miheavner at gmail.com> (m) wrote:

>m> I realize that the Queue would be the best way of doing this, however
>m> that involves transferring the huge amount of data for each call - my
>m> hope was to transfer it once and have it remain in memory for the
>m> subprocess across run() calls.

Which huge amount of data? The datastructure you talked about can remain
in the process. You only have to transfer the input for your calculation
in the queue but you have to do that anyway. And there is only one run
call per process. When run has terminated the process exits, so you
would have a loop in the run(0 method getting work from the queue.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list