Subject: Re: swap usage algorithm
To: None <current-users@sun-lamp.cs.berkeley.edu, roland@frob.com>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: current-users
Date: 12/07/1993 22:21:05
> How does netbsd decide which swap partitions to use in which order?
> ...
> I wonder why much of sd0b is used when wd0b still has space.  (Perhaps
> it is just my usage patterns?  But I don't recall starting and then
> killing anything which would use those 32MB.)
> 

The system tries to spread the load evenly among the available swap devices.
Block number N from the (logical) swap device is mapped to a (physical)
device block by computing something like:

	P = (N % max_size_of_a_single_swapdevice)

Note the the range [0..N] may contain holes, accounting for the "missing"
blocks on devices that are shorter than the max size.


I wouldn't mind too much about the difference in speed of your two devices.
While `wd' may be faster in raw speed, the `sd' (assuming it is a SCSI drive
and attached to decent controller) may actually perform better under heavy
load, leaving more of your CPU available while swapping.

-pk

------------------------------------------------------------------------------