Re: sharing memory map between processes (same parent)
- From: David Schwartz <davids@xxxxxxxxxxxxx>
- Date: Mon, 28 Apr 2008 07:37:57 -0700 (PDT)
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
.
- Follow-Ups:
- Re: sharing memory map between processes (same parent)
- From: phil-news-nospam
- Re: sharing memory map between processes (same parent)
- References:
- sharing memory map between processes (same parent)
- From: phil-news-nospam
- sharing memory map between processes (same parent)
- Prev by Date: Re: sharing memory map between processes (same parent)
- Next by Date: Timer in C
- Previous by thread: Re: sharing memory map between processes (same parent)
- Next by thread: Re: sharing memory map between processes (same parent)
- Index(es):
Relevant Pages
|