Re: sharing memory map between processes (same parent)
- From: Barry Margolin <barmar@xxxxxxxxxxxx>
- Date: Sun, 27 Apr 2008 21:00:12 -0400
In article <fv2m7o01es1@xxxxxxxxxxxxxxxxx>, phil-news-nospam@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.
I don't know of any way to transfer a mapping. Processes don't
generally have the ability to change anything about other properties,
other than through low-level manipulation like ptrace().
Why not just have both processes mmap() the same file?
--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.
- 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: TCP connect in Non Blocking Mode
- Next by Date: How to suppress 'Entering/Leaving ...' messages while running make?
- Previous by thread: sharing memory map between processes (same parent)
- Next by thread: Re: sharing memory map between processes (same parent)
- Index(es):
Relevant Pages
|