Subject: Re: VM in NetBSD
To: None <cgd@nobozo.CS.Berkeley.EDU,>
From: Wolfgang Solfrank <>
List: current-users
Date: 02/07/1994 20:28:54
> > Hi,
> > 
> > from experience with SunOS and 386BSD I know that:
> > 
> > 	16 MB RAM + 32 MB swap == 32 MB virtual memory.
> maybe in SunOS this is true, but in Net/2 derived systems
> (e.g. 386BSD and NetBSD), the following:
> > In Linux:
> > 
> > 	16 MB RAM + 32 MB swap == 48 MB virtual memory!
> is the case.

More or less. Actually the picture is a bit more complicated (and I would be
real baffled if Linux really adds real memory and swap for virtual memory).

As long as there is enough real memory no swap space is needed or used.

When the need for paging arises, swap space is allocated (on demand) to
objects in memory that aren't backed by disk objects, i.e. to the pages
modified by copy-on-write. However, this swap space isn't released when
the pages are brought back into ram, but only when these pages are no longer
needed, normally on termination of the process owning them.

If the swap space runs out, pages in memory that don't have swap space
allocated to them already simply stay in memory. This means that when you
exceed the swap space you may be able to continue work or not depending
on the pages currently in memory. Since the modified pages in memory cannot
brought out, the system may have problems to find real memory to fault other
pages in. If this is the case the complete system comes to a halt.

On the other hand, a lot of pages (e.g. under normal circumstances the program
text space) aren't modified and thus are backed by the disk files. Since this
counts as virtual memory, too, you actually have more virtual memory the more
text size your programs have.

It all depends on your usage patterns.
ws@TooLs.DE     (Wolfgang Solfrank, TooLs GmbH) +49-228-985800