Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Share hash across processes

by TilRMan (Friar)
on Jun 09, 2007 at 04:49 UTC ( [id://620146] : note . print w/replies, xml ) Need Help??

in reply to Share hash across processes

Have a look at mmap(3). Caveat: I've never used any of the Perl interfaces to mmap.

Replies are listed 'Best First'.
Re^2: Share hash across processes
by bart (Canon) on Jun 09, 2007 at 06:43 UTC
    Yet there are quite a few of them on CPAN.

    I recall somebody even made a mmap module that works on Win32; the author was here and on the chatterbox while he was working on it, but I don't remember what user that was.

    Maybe it was IPC::Mmap? Ah, no, it must have been Win32::MMF, the name rings a bell. Well, both look like reasonable approaches to me, and both have gotten recent updates, which is a promise it'll most likely still work well. But don't discard the other candidates just yet.

    From the top of the thread:

    I have a hash (with about 20-25 keys) with very long bit strings as values (1-2MB) that I would like to share directly (readonly) in memory.
    That looks like an acceptably small number of keys, so the most sane approach to me seem to make a separate mmapped file per hash item. If the keys form a fixed set, you don't even actually have to share the list of names.