*BSD News Article 20410


Return to BSD News archive

Xref: sserve comp.unix.programmer:11517 comp.unix.bsd:12551
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!doc.ic.ac.uk!pipex!uunet!mcsun!sun4nl!fwi.uva.nl!casper
From: casper@fwi.uva.nl (Casper H.S. Dik)
Newsgroups: comp.unix.programmer,comp.unix.bsd
Subject: Re: mmap for shared memory, how to use efficiently?
Date: 4 Sep 1993 19:46:59 GMT
Organization: FWI, University of Amsterdam
Lines: 16
Distribution: world
Message-ID: <26arbj$bl@mail.fwi.uva.nl>
References: <MUTS.93Sep1221625@compi.hobby.nl> <MIKE.LONG.93Sep2173535@cthulhu.analog.com> <MUTS.93Sep3225552@compi.hobby.nl>
NNTP-Posting-Host: adam.fwi.uva.nl

muts@compi.hobby.nl (Peter Mutsaers) writes:

>I tried /dev/null and /dev/zero, but for /dev/null I got read error,
>and for /dev/zero I could write, but a read on the mmapped memory
>would always return a zero. This is on IRIX, I suspect IRIX's
>implementation of mmap() is not very good. Which is strange, because
>Irix's special semafores use so called 'shared arenas' which are based
>on mmap() as well. They were surprisingly slow.

In general, you can't mmap /dev/null. If you mmap /dev/zero, you'll
need to MAP_PRIVATE. I'm not sure how this work in IRIX share groups,
but I assume that the PRIVATE would apply to the entire share group.
When not using MAP_PRIVATE, you mmap it globally (entire system).
Obviously, /dev/zero always reads as 0s in that case.

Casper