*BSD News Article 20296


Return to BSD News archive

Xref: sserve comp.unix.programmer:11459 comp.unix.bsd:12522
Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!crcnis1.unl.edu!wupost!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!auspex-gw!guy
From: guy@Auspex.COM (Guy Harris)
Newsgroups: comp.unix.programmer,comp.unix.bsd
Subject: Re: mmap for shared memory, how to use efficiently?
Message-ID: <18533@auspex-gw.auspex.com>
Date: 2 Sep 93 19:35:05 GMT
References: <MUTS.93Sep1221625@compi.hobby.nl> <1993Sep2.135345.4889@nrao.edu>
Sender: news@auspex-gw.auspex.com
Followup-To: comp.unix.programmer
Organization: Auspex Systems, Santa Clara
Lines: 28
Nntp-Posting-Host: auspex.auspex.com

>Another way to do shared memory is the stardard ipc functions in
>SVR4.

I'd have suggested those, too (note that they were in earlier SV
releases as well), except that, since the original poster had also
posted to "comp.unix.bsd", he was running some flavor of BSD.

Now, perhaps he's running SunOS 4.x, and was under the misapprehension
that SunOS 4.x is BSD (it has a lot of stuff from BSD, but it sure as
heck isn't *all* BSD, and should't be thought of as "just BSD" - for
example, the VM system is quite different from either older or newer BSD
VM systems, which may be relevant to the performance problems he claims
to see with "mmap()").

At least in SunOS 4.x (and SVR4), I would *not* expect stores into a
page mapped from a file to "update the real file immediately"; the
original poster said he saw that.  I'd expect it to *eventually* push
the pages back to the file, but not once for every store.

Those OSes might not be as eager to push modified pages of SV shared
memory back to *their* backing store, as they're backed with swap space,
not with a file.

Now, if he's using BSD rather than SunOS 4.x or SVR4, there might be
some option to "mmap()" to tell it to map stuff that's somehow
"associated" with a file, so that the two processes have some name at
which they can rendezvous, but tell it not to back the mapped region
with pages from the file, so that it'd be backed by e.g. swap space.