*BSD News Article 70574


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.hawaii.edu!news.uoregon.edu!news.sol.net!spool.mu.edu!howland.reston.ans.net!swrinde!newsfeed.internetmci.com!csn!nntp-xfer-1.csn.net!csn!nntp-xfer-2.csn.net!news.boulder.noaa.gov!news
From: Sean Kelly <kelly@fsl.noaa.gov>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: MFS - Why?
Date: Mon, 10 Jun 1996 11:13:48 -0600
Organization: NOAA Forecast Systems Laboratory
Lines: 29
Message-ID: <31BC57CC.36A2@fsl.noaa.gov>
References: <4ogp99$kfu@nntp5.u.washington.edu> <ABgvNUrSgM@qsar.chem.msu.su>
NNTP-Posting-Host: emu.fsl.noaa.gov
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0b4 (X11; I; HP-UX B.10.01 9000/715)

Eugene Radchenko wrote:
> I guess I was not sufficiently clear in the original posting. If we have
> merged disk cache/VM buffer and we open a file and write something to it,
> then the data end up into that same buffer area as they would if we create
> a file on the memory filesystem (with a difference that they could be
> 'paged out' to normal filesystem if someone needs heaps of memory while the
> MFS data could not). So what is the point?

Good point.

But I can think of another good reason to use MFS: if you've got multiple
processes using mmap() to map files into their addresses spaces so that you
can use shared memory as a form of IPC, then it's a heck of a lot better to
mmap() a file that lives on an MFS filesystem than one that lives on a a real
disk.

As you make changes to the address space of the mmap()'d file, the kernel
will also reflect those changes in the filesystem.  If it's a real disk, then
you're doing disk I/O.  If it's MFS, then you're not!  You save on the
initial paging of the memory as well.

For more details, see McKusick et al, _The Design and Implementation of the
4.4BSD Operating System_, page 139.


-- 
Sean Kelly                          
NOAA Forecast Systems Laboratory    kelly@fsl.noaa.gov
Boulder Colorado USA                http://www-sdd.fsl.noaa.gov/~kelly/