Re: Swapfile

David C. Niemi (niemidc@clark.net)
Wed, 4 Oct 1995 10:25:33 -0400 (EDT)


On Tue, 3 Oct 1995, Jonathan Hankins wrote:
> On Mon, 2 Oct 1995, Kai Schulte wrote:
> > On Sun, 1 Oct 1995, Dirk-Jan Koopman wrote:
> > > I was wondering the other day whether, in this modern day & age, we need
> > > to have separate swap partitions? What with running X, doing a longish
> > > print in netscape and only 32Mb of RAM, I was swapping and couldn't I
> > > hear it!

This may not have been so much swapping as simply a need to read and
write many large files all over the disk. It sounds like you had both
netscape (which is big) and ghostscript (which is big) going at once, and
would need to write very big temporary files, quite likely, on the way to
the printer, while reading font files and other ghostscript support
files. If this is the case it has little to do with swapping.

> > Having an extra partition to swap to reduces file system overhead, and
> > by keeping the swap partition on a separate drive you can gain further
> > improvement in performance compared to a swap file within the same
> > file system :)
>
> I see what he's saying about having to seek all over the disk(s) when
> swapping. Is there any feasibility in having a scheme to use a swapping
> file, but have it aligned in a way so as to reduce the amount of head
> movement, for example, spread it over the same cylinder, so there isnt as
> much physical movement of the heads when reading or writing to the swap
> area, or does the current scheme of having a separate partition keep head
> movement to a minimum anyway? (I'n not sure about the way the swapped
> memory is organized on the swap partition, maybe I need to RTFM a little
> more ;-) But it's true--especially on slower IDE drives, the swapping
> often becomes burdensome (not to find fault in Linux's swapping scheme,
> but the machinery is going to have limitations no matter what, and
> swapping inherently slows the system down.)

For now, a workaround would be to not put everything in one big
partition, and place the swap partition between two other partitions with
frequently used binaries. At least that would put things physically
close together. Going to a separate drive is not going to help nearly as
much as adding more memory, unless you already have a SCSI controller with a
very good driver.

I think there probably is some middle ground between a swap partition and
the current kind of swap file; the swap file could be made contiguous,
moving things out of the way as necessary, and be marked as unmoveable.
This presents all sorts of nasty complications to the file system code and
utilities, but could have the benefit of substantially improving
performance on systems where it is not convenient to make a separate swap
file, perhaps to a point approaching a separate swap partition.

---David C. Niemi---niemidc@clark.net----703-904-3596---Reston, VA USA---
There is no match for the fervor of a new initiate, the confidence of the
unquestioning, or the appeal of oversimplified answers to complex issues.