*BSD News Article 20418


Return to BSD News archive

Xref: sserve comp.unix.programmer:11513 comp.unix.bsd:12548
Newsgroups: comp.unix.programmer,comp.unix.bsd
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!doc.ic.ac.uk!uknet!mcsun!sun4nl!tedux.hobby.nl!mo.hobby.nl!compi.hobby.nl!muts
From: muts@compi.hobby.nl (Peter Mutsaers)
Subject: Re: mmap for shared memory, how to use efficiently?
In-Reply-To: Mike.Long@analog.com's message of Thu, 2 Sep 1993 22:35:35 GMT
References: <MUTS.93Sep1221625@compi.hobby.nl> <MIKE.LONG.93Sep2173535@cthulhu.analog.com>
Sender: muts@compi.hobby.nl (Peter Mutsaers)
Organization: My unorganized home
Date: Fri, 3 Sep 1993 21:55:52 GMT
X-Attribution: PLM
Message-ID: <MUTS.93Sep3225552@compi.hobby.nl>
Lines: 20

>> On Thu, 2 Sep 1993 22:35:35 GMT, Mike.Long@analog.com (Michael
>> W. Long) said:

  MWL> You can use mmap(2) for this application without the overhead
  MWL> of disk I/O by using either /dev/null or /dev/zero (if present)
  MWL> as the file to map.  Using mmap on /dev/zero has the nice side
  MWL> effect of initializing the shared memory segment to all zeros.

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.

I don't want to use SYSV shared memory because I hate the concept
(another namespace, globally present and persistent, horrible).
-- 
_______________________________________________________________
Peter Mutsaers, Bunnik (Ut), the Netherlands.