Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Nov 1998 19:37:45 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        joelh@gnu.org (Joel Ray Holveck)
Cc:        tlambert@primenet.com, DBECK@ludens.elte.hu, freebsd-hackers@FreeBSD.ORG
Subject:   Re: SYSV Semaphores & mmap problems
Message-ID:  <199811231937.MAA25048@usr02.primenet.com>
In-Reply-To: <86lnl2mdqs.fsf@detlev.UUCP> from "Joel Ray Holveck" at Nov 23, 98 01:05:15 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > You can actually get mmap'ed memory that is as fast as SYSV SHM
> > by mmap'ing anonymous memory off of fd -1, or off of an fd that
> > is attached to /dev/zero.  The problem with this is that there
> > is no way to rendezvous this memory between processes, unless they
> > are all descendents of the original process that did the mapping.
> > BSD really needs to fix this deficiency, probably by adding a
> > method, similar to that for passing fd's, to pass region mappings
> > to other processes.
> 
> Have you tried passing an fd attached to /dev/zero around and see if
> each process can mmap it separately and get shared memory?

No.  But the /dev/zero device is not instanced per open, and the
memory mapped is anonymous, not backed by /dev/zero, so it won't
work.

I think that it would be a long shot, in any case.  One problem
here is that /dev/zero, like all devices, is not notified of
closes other than the last close, so everything you ever instanced
would hang around until the last close; in other words, you would
leak memory like a sieve in many common cases, even if everyone who
had the mapping active went away, so long as *someone* had /dev/zero
open.

Actually, I think DG and PHK have both complained of this in the
past and rumbled about doing something about close notification,
but I don't remember seeing that happen, and I'm unfortunately
too lazy to walk over to a 3.x machine and check.  8-).  My gut
feeling is that nothing was done, since all device drivers would
need to be touched, which is about as popular as touching all the
VFS implementations to effect an interface change in that area.


Another possible approach is, if the region mappings within a
process image are exposed seperately via /proc, open the region
mapping for the anonymous region of the other program as a file,
and then mmap it.  This approach would be more work (IMO) than
"enhancing" the descriptor passing mechanism.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811231937.MAA25048>