FW: Python Query: How to i share variable between two processes without IPC.

skip at pobox.com skip at pobox.com
Thu Dec 1 06:32:21 EST 2005


    Mukesh> Question: how do i share variable between two processes without
    Mukesh> IPC.
    ... 
    Mukesh> A similar thing is available in perl (check the mail attached). 

What makes you think the Perl code isn't using IPC?

    use IPC::Shareable;

    $handle = tie $buffer, 'IPC::Shareable', undef, { destroy => 1 };

Sure looks like IPC to me.  From the README:

    IPC::Shareable allows you to tie a variable to shared memory making it
    easy to share the contents of that variable with other Perl processes.
    Scalars, arrays, and hashes can be tied.  The variable being tied may
    contain arbitrarily complex data structures - including references to
    arrays, hashes of hashes, etc.

That the variable $buffer uses Perl's tie mechanism to hide most of the
details doesn't make it not shared memory.

You might check out pyro:

    http://pyro.sourceforge.net/

It's not based on shared memory, but will also work across networks.

Skip



More information about the Python-list mailing list