Re: Memory Management - BSD vs Linux

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Tue, 12 Aug 1997 08:43:43 +0200 (MET DST)


Noel Maddy wrote:
>
> On 11 Aug 1997, Darren Reed wrote:
> > In some mail I received from Theodore Y. Ts'o, sie wrote
> > >
> > > [3] Can any of these systems have
> > > a) swap files rather than partitions
> > > b) dynamically growing swap space?
> > > As far as I can make out, the answeris no!
> > >
> > > Linux can swap to files (multiple files if necessary), and there is a
> > > user-mode daemon that can allow you to dyanmically grow swap space (by
> > > allocating a new file).
> >
> > NetBSD has swapfiles and does not require a daemon to be running for more
> > to be added. NetBSD has also since moved on from just swap(2) to having
> > swapctl(2) which supports things like swap files/partitions with different
> > priorities and a replacement program for swapon - swapctl(8).
>
> Do you mean that NetBSD monitors the available swap space and
> automatically adds more without a daemon, or just that more swap space
> can be added via swapctl without a daemon running? Linux does the
> latter without a daemon--the daemon Ted mentioned does the former.

There is a thing here.

The kernel already knows how to swap to a file. The kernel already
knows how to "grow" a file. What wouldn't be too hard to implement is:

on "out of swap space" call the "grow file" function for the
swap file, and try again.

A slight complication is that Linux uses a swap space signature which
includes the size of the swap file. Writing that back can be
considered dangerous.

Roger.