From owner-freebsd-hackers Tue Dec 10 12:00:03 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id MAA25545 for hackers-outgoing; Tue, 10 Dec 1996 12:00:03 -0800 (PST) Received: from gatekeeper.fsl.noaa.gov (gatekeeper.fsl.noaa.gov [137.75.131.181]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id MAA25499 for ; Tue, 10 Dec 1996 12:00:00 -0800 (PST) Received: from cardinal.fsl.noaa.gov (daemon@cardinal.fsl.noaa.gov [137.75.60.101]) by gatekeeper.fsl.noaa.gov (8.7.5/8.7.3) with ESMTP id TAA27414; Tue, 10 Dec 1996 19:59:58 GMT Received: from auk.fsl.noaa.gov by cardinal.fsl.noaa.gov with SMTP (1.40.112.3/16.2) id AA151297997; Tue, 10 Dec 1996 19:59:57 GMT Message-Id: <32ADC1A9.3832@fsl.noaa.gov> Date: Tue, 10 Dec 1996 13:01:45 -0700 From: Sean Kelly Organization: NOAA Forecast Systems Laboratory X-Mailer: Mozilla 3.0Gold (X11; I; HP-UX B.10.10 9000/725) Mime-Version: 1.0 To: "Eric L. Hernes" Cc: "Marc G. Fournier" , hackers@FreeBSD.ORG Subject: Re: Multiple Buffer allocation of Shared Memory References: <199612101935.NAA16873@jake.lodgenet.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Eric L. Hernes wrote: > One way, is to open a (previously agreed upon) named file that > will be used to share data, ftruncate() it to the size you want, > then mmap() it. Other processes can open and mmap() this same file > to get at the data. But bear in mind where the file is located. If it's on a UFS, then your system will have to do physical I/O to update the file on disk as processes mmap'ing it make updates. That's why it's often better to locate mmap'd files used for IPC on an MFS filesystem. Sample /etc/fstab entries to mount MFS on /tmp: /dev/sd0s4b none swap sw 0 0 /dev/sd0s4b /tmp mfs rw 0 0 Of course, if you need the file's contents to be persistent across reboots, then MFS isn't such a bad idea. > and mmap() can buy you is persistance of data across a reboot(), whether > that is good or bad is up to you. Hey, that's what I just said! ;-) -- Sean Kelly NOAA Forecast Systems Laboratory kelly@fsl.noaa.gov Boulder Colorado USA http://www-sdd.fsl.noaa.gov/~kelly/