[comp.unix.wizards] BSD4.2 paging heuristics and vadvise

dplatt@teknowledge-vaxc.ARPA (Dave Platt) (07/28/87)

I'm running an application on a Sun 3/52 workstation that is pushing
the memory limits of the machine... it's a 2.8-meg LISP image on a
4-meg machine (i.e. 10 pounds of worms in a 5-pound can).  Needless to
say, the machine spends a lot of its time swapping pages (I think I
can smell the voice-coil in the 140-meg shoebox overheating ;-).

I tried hacking in a call to vadvise, to inform the kernel of the
potential "anomalous" memory behavior of the LISP image... and
performance got worse, rather than better.  I take this to mean that
in my particular case, the LISP image is accessing memory in a
sufficiently regular fashion that the standard "choose a page to write
or discard" heuristic is doing more good than not.

Three questions for the BSD gurus:

1) What is the normal heuristic used to choose a page to be swapped
   out to disk... least recently used?  Usage statistics?

2) What changes if I call vadvise(VA_ANOM)?

3) What's the best book available on the BSD kernel for someone
   interested in learning more about these arcane matters, assuming
   that I don't have a source license from Sun?

advTHANKSance for any information that you can provide.

		dave platt

bzs@bu-cs.bu.edu (Barry Shein) (08/05/87)

Something you can do for free (maybe you know this) is to do a 'ps
agx' and kill off any daemons et al that you don't really need. Things
like rwhod run every 30 seconds are so and on a memory limited machine
will just swap in and out and try to hang onto a working set. Also
those pretty digital clocks, they have to get into memory to update
the hands, at least slow them down if there's an option (I know on X's
clock you can regulate update time from the startup command line,
consider every 5 minutes or get a watch and don't run it at all.)
Consider whether you need a sendmail daemon running (I don't have mail
delivered to my workstation, only the server, not particularly for
this reason but it doesn't hurt.)

Also watch out for lots of windows and possibly rlogins which might be
getting woken up in the background. The best thing to do is start up
your lisp on the barest possible system, look at vmstat and how it
feels and proceed from there. It might be something small which is the
culprit like rwhod (or, of course, you might just be out of memory,
consider a 3/60 w/ 24MB + 3MIPs, that would help :-)

Cheers.

	-Barry Shein, Boston University