Subject: Re: Swap sizes vs. physical memory.
To: None <netbsd-help@netbsd.org>
From: Claude Marinier <marinier@dreo.dnd.ca>
List: netbsd-help
Date: 09/09/1999 09:37:27
In summary,

1) you can run with no swap space at all

2) if you want a full core dump after a crash, swap space must
   be as large as physical memory (or a bit larger?)

3) the size of swap is determined by your work load: active
   processes, dormant processes, transients, ...

4) four times physical memory is a relic of the past, with
   today's typically large amount of physical memory, the
   recommendation should be somewhere between 1.0 and 2.0 times
   physical memory (or should that be 1.x and 2.0 ?)

More musings
------------

I have been working with a new installation and discovering interesting
things about virtual memory and paging in Unix. What I found makes me
wonder about NetBSD.

We recently converted an old Alpha from VMS to Unix (we got a bigger,
faster VMS Alpha for VMS). This is my first exposure to Digital Unix 4.0E.
The system has 640 MB of physical memory and two 128 MB swap partitions.
The user tried to start a large (118 MB) number cruncher program and it
failed ("swap space below 10 percent free"). I thought that I had enough.
This type of swap space allocation is called 'immediate' or 'eager' mode:
the system tries to reserve swap space equivalent to the modifiable
virtual address space of the program plus 10%. In our case, the program is
mostly arrays which are modifiable. The other mode is called 'deferred' or
'lazy': the system does not reserve swap space until it is needed. I was
told that, in this mode, a process will be killed if it cannot get the
swap space it needs. I will pursue this on my own but it brings up an
interesting question for us here on this list.

NetBSD appears to allocate swap space using the 'deferred' or 'lazy' mode.
How does NetBSD actually allocate swap space? Could a process be killed
because of insufficient swap space?

I do not expect a long dissertation in response; rather a short
explanation (if this is possible) or a pointer to a document on the net
somewhere. I note that no one made reference to such a document in this
thread. Is there such a thing?

--------------------
Claude Marinier, Information Technology Group    claude.marinier@dreo.dnd.ca 
Defence Research Establishment Ottawa (DREO)    (613) 998-4901  FAX 998-2675
3701 Carling Avenue, Ottawa, Ontario  K1A 0Z4         http://www.dreo.dnd.ca