🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #18532

Re: HPUX10.20 mmap() broken (was Re: shared memory patch)

#18532
From: Doug Siebert
Date: Thu, 19 Jun 1997 00:00
43 lines
2748 bytes
rodmur@ecst.csuchico.edu (Dale Harris) writes:

>Unfortunately, it appears that mmap() on HPUX 10.20 is badly broken.  I
>used the test mentioned at:  

>   http://www.xs4all.nl/~johnpc/inn/

>and it breaks all over the place.  Is there any alternative to HPUX's mmap()?


This thing apparently checks to see if mmap() and write() are consistent
(i.e., whether or not VM and the buffer cache are merged)  They are not on
HP-UX 9.x and 10.x, no way around this.  You can always hope they get merged
in 11.x.  Or maybe they'll rewrite INN to not be silly and try to use both
mmap() and read()/write() at the same time.  It is not all that hard to use
setvbuf() and put your stdio buffers in the mmap() space and therefore be
able to use stdio functions to write directly into the mmap() memory, thereby
getting around this, and speeding up all your I/O to boot.  If you feel so
strongly about this, maybe you should bug the INN maintainers to make this
change and speed things up for everyone, both those who are on systems with
merged VM/buffer caches and can take advantage of this mmap patch, as well
as those without.

I used this to considerably speed up some code I had that dealt with a 512M
file.  It was a hell of a lot faster and required very little other code
modification.  You just want to watch that you don't ever actually try to
fflush().  You probably want to use fileno() and close the underlying file
descriptor and know that when flushes are attempted for whatever reason an
ignorable error will be the result.

If there are external processes that need to read/write you'll maybe need to
toss in msync() calls now and then.  I don't know much about how INN is set
up, so I don't know if the stuff that is mapped needs to be accessed by other
processors that aren't using mmap() to do it.

-- 
Douglas Siebert                Director of Computing Facilities
douglas-siebert@uiowa.edu      Division of Mathematical Sciences, U of Iowa

He who lives in a glass house should not invite in he who is without sin.

Technical Details
Message-ID: <5oah5p$ev2$1@flood.weeg.uiowa.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <33A6B41D.3382@iconnet.net> <5o6s5r$8ib$1@flea.best.net> <5oa3e1$lda@charnel.ecst.csuchico.edu>

Show Full Headers
Complete Article Headers
Message-ID: <5oah5p$ev2$1@flood.weeg.uiowa.edu>
Subject: Re: HPUX10.20 mmap() broken (was Re: shared memory patch)
Date: Thu, 19 Jun 1997 00:00:00 +0000
From: dsiebert@icaen.uiowa.edu (Doug Siebert)
References: <33A6B41D.3382@iconnet.net> <5o6s5r$8ib$1@flea.best.net> <5oa3e1$lda@charnel.ecst.csuchico.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 251035186
Organization: The University of Iowa
Reply-To: douglas-siebert@uiowa.edu
Newsgroups: news.software.nntp