Newsgroups: comp.sys.next.sysadmin
Subject: Re: Basic Swapfile Questions...
From: scott@nic.gac.edu (Scott Hess)
Date: 23 Jan 93 11:34:24
Distribution: world
Organization: Is a sign of weakness
NNTP-Posting-Host: nic.gac.edu
In-reply-to: rawyatt@phakt.usc.edu's message of 23 Jan 1993 01:41:07 -0800

In article <1jr3rjINNf7l@phakt.usc.edu>
	rawyatt@phakt.usc.edu (Robert Alexander Wyatt) writes:
>Actually, I'm going to insult all of the NeXT geniuses and ask...
>What exactly is a swapfile and why do I have it?  I know that it
>gets bigger and bigger...how can I wipe it out?  Is there a terminal
>command?  Can I simply erase it?

In essence, swapfile is the memory that you can't afford to buy.  The
swapfile is the "where" of virtual memory, so when your on-board
memory is full and you tell your machine that you want to launch
something else, it has to put what is already in memory somewhere else
so that the new program can be loaded.  So on my 32M machine, for
instance, I might go a week without the swapfile rising above my 12M
lowat mark (see below), mainly because most "normal" programs run fine
in 32M (monochrome development system - your mileage will vary if you
use color or Mathematica :-).

In other words, _don't_ wipe it out.  You don't want to, and really
really bad things will happen if you do, with programs running out
of memory and crashing all over the place for no _apparent_ reason.
What you should do is edit the entries in /etc/swaptab so that your
lowat is set to a lower number, so that on reboot you reclaim some
space.  For instance, one of these lines:

/private/vm/swapfile	lowat=8388608	# 8 Meg low water mark
/private/vm/swapfile	lowat=12582912	# 12 Meg low water mark
/private/vm/swapfile	lowat=20971520	# 20 Meg low water mark
#		    ^^^^ this is a tab^^

The tabs _are_ important.  The third line is the default low water
mark.

Note that some people are going to describe methods of deleting
the files via rm.  Do _not_ do this.  At build time, the NeXT
utilities allocate all of the disk space for the swapfile in more
or less contiguous areas, which means that swapfile can be read
from and written to faster than if you just placed the blocks in
an on-demand fashion.  So, you are far better off to adjust the
lowat mark to an acceptable value, in which case the first lowat
bytes of swapfile will be fast.  If you delete it and then recreate
it empty, you'll find that your system _will_ become slower when
you start biting into the swapfile, possibly significantly slower
if you don't have much disk space to work with (BSD FFS does better
with more free areas to work with).  You can reallocate space using
the mkfile command, but unfortunately there is no time quite as
good as build-time to do this ...

>I have limited disk space...my swapfile is 16MB and my swapfile.front
>is 37MB...what's the difference between the two?  what are their
>purposes? That 50+ Meg sure could come in handy...(even a fraction
>of it...)

swapfile and swapfile.front are two views of one and the same file.
So, you've really only "lost" 16M.

Later,
--
scott hess <shess@ssesco.com>                        <To the BatCube, Robin>
12901 Upton Avenue South, #326  Burnsville, MN 55337 (612) 895-1208 Anytime!
Organization: Sponsored account, Chemical Engineering, Carnegie Mellon, Pittsburgh, PA