[comp.unix.wizards] shared memory in BSD 4.2

stevens@anl-mcs.arpa (02/03/87)

Does anyone know how to map memory from two processes ( child and parent)
to refer to the same virtual addresses ?  (i.e I want to have two or more
processes share the same dynamically allocated memory).

I have tracked down mmap and munmap but cannot figure out how to get the
file descriptor of my own core image to pass to mmap.

Rick Stevens
Mathematics and Computer Science Div.
Argonne National Lab.
stevens@anl-mcs.arpa
(312) 972-3378

guy@gorodish.UUCP (02/04/87)

>I have tracked down mmap and munmap but cannot figure out how to get the
>file descriptor of my own core image to pass to mmap.

You can't.  "mmap" doesn't do anything on vanilla 4.[23]BSD.  Some
implentations using 4.[23]BSD code  support it to varying degrees.

Even if it did, there is still no way to *get* a file descriptor that
refers to your own core image.  You probably wouldn't want one,
anyway; you'd want to pick a file to use to hold the shared data and
"mmap" that file into both your address spaces.

chris@mimsy.UUCP (02/05/87)

In article <4200@brl-adm.ARPA> stevens@anl-mcs.arpa (Rick L. Stevens) writes:
>Does anyone know how to map memory from two processes ( child and parent)
>to refer to the same virtual addresses? ...  I have tracked down mmap
>and munmap ....

Not implemented yet.  These remain unimplemented in 4.3BSD.  Don Libes
at NBS AMRF (...!umcp-cs!nbs-amrf!libes, but their UUCP link is down
until further notice) has routines for sharing varibles via IPC rather
than shared storage.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris@mimsy.umd.edu

mouse@mcgill-vision.UUCP (02/20/87)

In article <5294@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes:
> In article <4200@brl-adm.ARPA> stevens@anl-mcs.arpa (Rick L. Stevens) writes:
>> Does anyone know how to map memory from two processes ( child and
>> parent) to refer to the same virtual addresses? ...  I have tracked
>> down mmap and munmap ....

> Not implemented yet.  These remain unimplemented in 4.3BSD.

Sigh.  However, I did write code allowing processes to share memory
without using mmap/munmap.  I wrote this for 4.2, but we've gone to 4.3
and I don't have the 4.2 code without groveling through *lots* of
tapes.  If anyone is interested, I can describe what has to be done or
maybe send out the code (I'd have to check some things, like, how much
is really 4.3 code I reused for the purpose).

					der Mouse

USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!musocs!mcgill-vision!mouse
     think!mosart!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!musocs!mcgill-vision!mouse
ARPAnet: think!mosart!mcgill-vision!mouse@harvard.harvard.edu