Mach and faulting in the file (Re: GNU Emacs, memory usage, releasing)
Peter da Silva
peter at ficc.uu.net
Tue Jan 9 02:05:53 AEST 1990
> What I mean here is that you can allocate your block poimters, then call
> map_fd to map the file into memory.
> The problem is that unless you copy the file on disk you can't back
> out of your edits at the last moment (:q! for vi people). If you're
> going to copy the file you might as well copy it into vmem.
You misunderstand. I wasn't suggesting making direct edits on the memory
image. On the contrary, you map it in read-only if you can. What I was
suggesting was that since most of the things you're doing to the file don't
involve modifying it, you might as well page it in from disk when you
need it, only coping it to writable memory when you want to modify it.
For example, suppose you want to do a search and replace. You fault in
all the pages from here to the replacement location, copy the block that
contains the replacement into two new blocks (using the block-splitting
method) and add the new text. The blocks you just read can be discarded
when needed by the memory manager, rather than having to be written out
to the paging area, saving considerable disk access. Only modified blocks
would need to be written.
--
_--_|\ Peter da Silva. +1 713 274 5180. <peter at ficc.uu.net>.
/ \ Also <peter at ficc.lonestar.org> or <peter at sugar.lonestar.org>
\_.--._/
v "Have you hugged your wolf today?" `-_-'
More information about the Comp.unix.wizards
mailing list