Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!elroy!judy!stevo From: stevo@judy.Jpl.Nasa.Gov (Steve Groom) Newsgroups: news.software.b Subject: Re: Enhanced dbz for SunOS 4.0 Message-ID: <17099@elroy.Jpl.Nasa.Gov> Date: 29 Jun 89 20:25:09 GMT References: <17059@elroy.Jpl.Nasa.Gov> <1989Jun28.180430.2743@utzoo.uucp> Sender: news@elroy.Jpl.Nasa.Gov Reply-To: stevo@elroy.Jpl.Nasa.Gov (Steve Groom) Organization: Image Analysis Systems Grp, JPL Lines: 29 In article <1989Jun28.180430.2743@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >In article <17059@elroy.Jpl.Nasa.Gov> david@elroy.Jpl.Nasa.Gov (David Robinson) writes: >>Below is a SunOS 4.0 specific enhancement to dbz that mmap()'s >>the history file and .pag file into main memory and accesses it >>directly instead of through lseek() and read()... > >One of our early C News users has modified dbz to do roughly the same >thing portably, by just keeping everything in memory and writing it out >at the end. I want to take a hard look at his code before promising >anything, but it may be part of the next patch. On machines with plenty >of address space and physical memory, apparently it really makes things >fly. Keeping the whole file in memory can be better than seeking around the file and doing selective reads, but you have to have the memory for it. Part of the beauty of mmap'ing is that you don't need lots of physical memory for it to be a win. One of the reasons David and I got into this in the first place was that we don't have a lot of physical memory. With mmap'ing, you just set up a memory area to correspond to a file and let the kernel take care of the I/O. When physical memory runs short, instead of paging out (= more I/O) parts of an in-core file, the kernel can just invalidate mapped pages (= no I/O) and re-read them later. There is also an I/O speed gain with mmap'ing, which appears to be the result of the elimination of copying data from kernel buffers into user space. Steve Groom, Jet Propulsion Laboratory, Pasadena, CA 91109 Internet: stevo@elroy.jpl.nasa.gov UUCP: {ames,cit-vax}!elroy!stevo Disclaimer: (thick German accent) "I know noothingg! Noothingg!"