shared memory

Richard Tobin richard%aiai.edinburgh.ac.uk at nss.cs.ucl.ac.uk
Fri Apr 21 22:57:46 AEST 1989


I have a program that uses the shm* routines to allocate memory that will
be shared between a process and its children.  It needs an unshared area,
a shared area, and another unshared area.  The precise addresses don't
matter (though they mustn't be too far apart) but the ordering does.

Under release 3 I just used sbrk(), shmat() and sbrk() again, but under
release 4 this puts the shared segment at a much higher address than the
other segments.  If I tell shmat() to put it just after the break, the
second sbrk() fails.

What's the best way round this?  (Answers like "change your program so
that the order doesn't matter" won't help.)  Must I use mmap()?  If so, do
I actually have to specify a file somewhere to correspond with the mapped
area?  And if so, will it use real disk space?

-- Richard



More information about the Comp.sys.sun mailing list