Re: sharing memory map between processes (same parent)



On Apr 27, 1:04 pm, phil-news-nos...@xxxxxxxx wrote:

I have forked two processes from the same parent. I'd like to have one of them
do open() and mmap() to map a file into memory (madvise would also be used).
Then I would like the other process to be able to access that mapping. Is
there a way to get that mapping shared with another process (much like it
would be had the parent mapped it first then forked the two child processes)
or at least transfer the mapping from one process to another? Note that it
will not necessarily be a mapping of the entire file, and the first process
may be keeping the descriptor open for later mapping of another part of the
file. Also, it may be possible to make it so the first process never does
any access of the mapped pages.

What's your outer problem? Why not just have the other process create
the mapping itself? The answer to your question would be very
different if the reason was that the mapping was private than it would
be if the problem was that the mapping contains pointers and needs to
be at the same address for all processes.

You have a habit of posting suggested solutions rather than problems.

DS
.



Relevant Pages

  • Re: CreateFileMapping - Still Dont Get It!
    ... >I'm really having problems finding good documentation on shared memory using ... >1) When you close the handle returned by CreateFileMapping, ... >2) Should the first process that called CreateFileMapping keep the handle ... If you close the handle, and it is the last handle, the file mapping ...
    (microsoft.public.vc.mfc)
  • Re: sharing memory map between processes (same parent)
    ... |> I have forked two processes from the same parent. ... |> Then I would like the other process to be able to access that mapping. ... it may be possible to make it so the first process never does ... | Why not just have both processes mmap() the same file? ...
    (comp.unix.programmer)
  • sharing memory map between processes (same parent)
    ... I have forked two processes from the same parent. ... do openand mmapto map a file into memory (madvise would also be used). ... Then I would like the other process to be able to access that mapping. ... it may be possible to make it so the first process never does ...
    (comp.unix.programmer)
  • Re: sharing memory map between processes (same parent)
    ... |> I have forked two processes from the same parent. ... |> Then I would like the other process to be able to access that mapping. ... it may be possible to make it so the first process never does ... | You have a habit of posting suggested solutions rather than problems. ...
    (comp.unix.programmer)
  • Re: sharing memory map between processes (same parent)
    ... do openand mmap() to map a file into memory (madvise would also be used). ... Then I would like the other process to be able to access that mapping. ... it may be possible to make it so the first process never does ...
    (comp.unix.programmer)