Re: swap space: an idea. Please comment.

Snow Cat (snowcat@netgate.net)
Tue, 25 Feb 1997 23:18:01 -0800 (PST)


mcculley@iag.net once wrote:
>
> >> At this point I thought you were going to suggest user swap
> >> files. That a user can use up his disk quota to create swap files that
> >> are used only for processing running with his user id. This could be a
> >> really good idea, since it could for example protect root processes
> >> from out of swap problems created by ordinary users by granting swap
> >> space from separate root swap storage.
> >Note that processes that expect to be VM hogs should probably do their
> >own "swap" allocation with mmap() or some such. What would be nice to
> >go with that is an extention to malloc & friends so that you could
> >mmap yourself some fresh VM, and tell malloc to use that as the arena
> >(or to add it to the existing arena)...
> >
> > Keith
>
> This is already available with the mmalloc package that comes with gdb
> and Checker.
>

Unfortunately it's not as efficient as a real swap file, because you can not
free arbitary chunks of the map (can only ftruncate the file at the end) and
because the disk image of the file has to be kept somewhat consistent with
memory.

I didn't check Linux performance, but under Solaris 2.5 writting to a file
mapping is much slower than to one of /dev/zero. I tried using one for a quick
malloc() debugger but gave up after listening to the hard drive.

-- 
 _.    	        _       .  
(_ ,_  _ ,  .  / ` _ _L	 | Email: Oleg Kibirev <snowcat@netgate.net>
._)| U(_)\/\/  \_,(_L/L  | Visit http://math.math.CSUFresno.EDU/~oleg/math.html
------------------------'  to get my programs + PGP public key