[comp.sys.sun] Using only part of physical memory

roy@alanine.phri.nyu.edu (Roy Smith) (07/21/90)

Is there any easy way to tell SunOS to only use a fraction of the
available physical memory?  I have a 3/50 (running 3.5.2) on my desk with
an expansion memory card (total of 8) but it's not easy for me to evaluate
how much good it really does.  I have page and swap perfmeters up all the
time but it's hard to make comparisons.  I want to be able to reboot my
machine every morning and tell it to use 4, 6, 8, whatever meg on a given
day so I can get a feel for how the machine works with N meg installed
without having to physically take the memory out and put it back in each
time.

Roy Smith, Public Health Research Institute
455 First Avenue, New York, NY 10016
roy@alanine.phri.nyu.edu -OR- {att,cmcl2,rutgers,hombre}!phri!roy
"Arcane?  Did you say arcane?  It wouldn't be Unix if it wasn't arcane!"

mojo@legato.com (Joseph Moran) (07/26/90)

In article <10131@brazos.Rice.edu> roy@alanine.phri.nyu.edu (Roy Smith) writes:

>Is there any easy way to tell SunOS to only use a fraction of the
>available physical memory?

To do this you need to patch the kernel's "physmem" variable to be the
maximum number of pages you want the system to use.  If physmem is 0 at
boot time (the normal case), then the kernel uses the memory as sized by
the PROM monitor.  If physmem is larger than the number of pages found by
the monitor, the kernel uses the smaller of the two numbers.  Remember
that for the sun3, sun3x, and sun4 architectures, the page size is 8k
(0x2000) while for the "sun4c" architectures (SPARCstation 1's, and SLC's)
the page size is 4k (0x1000).

For example, if you want to use only 6 Mb on a 8 Mb Sun-3 system, patch
physmem to be 0x600000 / 0x2000 = 0x300.  You can do this with adb as
shown here.

	machine# cp /vmunix /vmunix.orig
	machine# adb -w /vmunix -
	physmem?W 600000%2000
	_physmem:       0x0             =       0x300
	$q
	machine# fastboot


Joseph Moran
Legato Systems Inc.
mojo@Legato.COM or {sun,uunet}!legato!mojo