Re: how to share variable across multi-processes



On 1/30/06, Jeff Pang <pangj@xxxxxxxxxxxxx> wrote:
> hello,lists,
>
> I have a hash var in my script,and I want to get it be shared across multi-processes.Fox example:
>
> my %hash;
>
> while(1)
> {
> die "can't fork:$!" unless defined (my $child = fork());
>
> if ($child==0)
> {
> do_something_to_hash(); # here I need to do some operations to the %hash,which is defined globally.These operations include add something to %hash,or do modification or 'delete' to %hash.
> }
> }
>
> Is there any suggestion or document can help me to do that?thanks.
snip

You might consider using a dbm to store the hash in the file system.
Look at dbmopen and DBM::Any.
.



Relevant Pages

  • Re: Thinking outside the box on file systems
    ... 50ms to update in-memory dentries would be FRIGGING ... file system would be implemented. ... "hash" I didn't mean that it is going to be only a ... - their life, your story. ...
    (Linux-Kernel)
  • Re: Thinking outside the box on file systems
    ... One could create a file system and permission system ... The MSS was designed in the mid-1980s, ... name is hashed, and the hash table provides the internal file number (the ... directory chain insertion ...
    (Linux-Kernel)
  • Re: Thinking outside the box on file systems
    ... One could create a file system and permission ... name is hashed, and the hash table provides the ... For example to rename a directory with ... directory chain insertion ...
    (Linux-Kernel)
  • Re: [SLE] What did I do wrong? Is this a bug?
    ... Hash: SHA1 ... in a different file system. ... Is your home systems a reiserfs? ...
    (SuSE)
  • Re: Designing Another File System
    ... > Hash: SHA1 ... > I've been interested in file system design for a while, ... I would like to patent/sell it ... > similar in principle to how Hans Reiser sells his file system I think. ...
    (Linux-Kernel)