Shared memory and IPC

Wez Furlong wez at
Fri Sep 7 03:39:01 GMT 2001

On 07/09/01, "Luke Kenneth Casson Leighton" <lkcl at> wrote:
> > The real question is, what *do* you do on failure?  One possible
> > protocol: the "master" process does mmap() without MAP_FIXED, reports
> > the address to the others via some sort of existing IPC, the rest try
> > with MAP_FIXED, report back success or failure.  If anyone fails, they
> > all unmap *except* the master, which repeats the process with another
> > mmap() [again without FIXED] ... for a specified number of tries.  Upon
> > success, or upon giving up, the master munmaps all failed segments, if
> > any.

Yes, but... (see below)
> see, this is the bit that i was hoping that noone would suggest
> even be attempted, even though it's technically a correct
> solution :)

Sounds like a lot of effort on the part of all processes involved.
What if a new process is introduced after the others have negotiated
the address space that cannot map those address(es)??
> now we have a good reason to justify why MS reserves 2gb of the
> physical memory address space in w95...

Yes! If only there was a supported way to do this kind of thing in unix.
Hmmm, on seconds thoughts, it might lead to sloppy programming.
> if this is the case, the algorithm is sound, but the "master"
> would still need to use mmap(MAP_FIXED) with ever-increasing
> addresses on segment boundaries, and it could also unmap them
> on failure.

With all this communication between the processes it is quite possible
that performance might suffer; although it depends what you are using
that shared memory for.  If it's for marshalling then we probably should
stick with uxd.


More information about the samba-technical mailing list