Subject: VM in NetBSD
To: None <>
From: Dirk Steinberg <>
List: current-users
Date: 02/07/1994 12:25:44

from experience with SunOS and 386BSD I know that:

	16 MB RAM + 32 MB swap == 32 MB virtual memory.

In Linux:

	16 MB RAM + 32 MB swap == 48 MB virtual memory!

In BSD-ish systems, RAM acts as a cache for the paging area, and you
have to allocate at least as much swap as you have RAM. The general
rule-of-thumb is to allocate 3 times as much swap as RAM. With 16 MB
RAM that makes 48 MB swap, 32 MB require 96 MB swap.

If you have less swapping space that RAM, a system crash might write a
dump over the end of the swap partition and ruin your hard disk. Is
this still true for NetBSD?

With bigger RAM sizes coming (16 MB seems to be "standard" on Unix
PC's, and 32 MB seems not be be too uncommon), I dislike this
strategy. You always loose as much disk space as you have RAM! On one
of our workstations at work (Sun SS10/41) we have 128 MB RAM, so 128
MB of disk space is essentially wasted!

Linux can operate without *any* paging/swapping space whatsoever. This
can make sense, if you have enough RAM and are short on disk space.  I
have run XFree86, emacs and a kernel compile on 16 MB without swapping
without any problems! You can always later on (i.e. *after* booting)
add more swapfiles/partitions. The awesome thing about Linux swapping
is that there is also a swapoff command (and it really works).  So you
can run your system without or with little swap, and if you
temporarily need more virtual memory, make a swapfile, swapon, do your
work, swapoff, delete the swapfile.

I have been following current-users only for some weeks now, and I
read something about extensive VM changes. So my question is: what has
changed in NetBSD? Is NetBSD moving in a direction as outlined above
(as far as VM is concerned)? Are there any plans to integrate VM and
disk buffers as in SunOS and Linux?

The reason I think that something might have changed is that when I do:

dws@porty:p1 ~alexsrvr/src % swapinfo -k
Device     1024-blocks       Used  Available   Capacity
/dev/wd0b        16572          4      16568       0%

on my 386/40, 16 MB RAM, 16 MB swap Portable, I notice that *no* swap
seems to be in use so far, although I have lots of deamons, shells,
etc running. On SunOS, with pstat -s you see each and every program
eat memory, whether the system is really swapping or not. So either
NetBSD has changed to some Linux-like behaviour, or swapinfo is lying
to me.

BTW: Is there a way to see how much VM you still have, ala SunOS
     pstat? How about swapoff?

Another note: If 16MB+16MB really gives you more than 16 MB VM, mfs
should also give you more than 16 MB for /tmp.


Dirk W. Steinberg - RWTH Aachen - Internet email:
Aachen University of Technology / IS2-Integrated Systems in Signal Processing
Rhein.Westf.Tech.Hochsch. Aachen / Integrierte Systeme der Signalverarbeitung
Templergraben 55 / D-52056 Aachen / phone:+49 241 807879 / fax:+49 241 807631
Home address: Kleikstr. 63, D-52134 Herzogenrath,Germany/phone: +49 2406 7225