From owner-freebsd-hackers Mon Nov 23 11:38:04 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA07085 for freebsd-hackers-outgoing; Mon, 23 Nov 1998 11:38:04 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp01.primenet.com (smtp01.primenet.com [206.165.6.131]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA07079 for ; Mon, 23 Nov 1998 11:38:02 -0800 (PST) (envelope-from tlambert@usr02.primenet.com) Received: (from daemon@localhost) by smtp01.primenet.com (8.8.8/8.8.8) id MAA29676; Mon, 23 Nov 1998 12:38:01 -0700 (MST) Received: from usr02.primenet.com(206.165.6.202) via SMTP by smtp01.primenet.com, id smtpd029554; Mon Nov 23 12:37:50 1998 Received: (from tlambert@localhost) by usr02.primenet.com (8.8.5/8.8.5) id MAA25048; Mon, 23 Nov 1998 12:37:45 -0700 (MST) From: Terry Lambert Message-Id: <199811231937.MAA25048@usr02.primenet.com> Subject: Re: SYSV Semaphores & mmap problems To: joelh@gnu.org (Joel Ray Holveck) Date: Mon, 23 Nov 1998 19:37:45 +0000 (GMT) Cc: tlambert@primenet.com, DBECK@ludens.elte.hu, freebsd-hackers@FreeBSD.ORG In-Reply-To: <86lnl2mdqs.fsf@detlev.UUCP> from "Joel Ray Holveck" at Nov 23, 98 01:05:15 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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