[comp.sys.mac.system] VM rule of thumb

"John R. Delaney" <delaney@xn.ll.mit.edu> (05/30/91)

>	The rule of thumb for allocating swap space (virtual memory to you
>mac hacks) is 2MB of virtual to 1MB of physical. Anything more than that
>and you start beating the disk to death.

I am getting tired of hearing this "rule of thumb" restated as if carved on
a bloody tablet in words of fire. I am composing this message on a TI
Explorer with 8 MB of actual memory and 128 MB of virtual memory. Sure, if
I run a memory-intensive application or jump rapidly from one normal
application to another, I get pronounced delays due to paging. And when the
garbage collector cuts in, its time for a tea break. But if I use one
application for a while, then another, and so on, there may be a brief
burst of paging when I change over. But even that does not always happen.
The right ratio of virtual to actual memory depends on the hardware you
use, the operating system's design, and your pattern of usage.

The 2-to-1 rule may be appropriate for System 7.0; Apple may have tuned it
with that in mind. But until I have tried something greater than 2-to-1 for
a while on my SE/30, I am going to withold judgement. I ain't holy writ,
gang!

And by the way, what we have on the Mac's right now strikes me as
demand-paged memory, not virtual memory. But please, let's not start a
"true virtual memory" thread to go along with the "true multi-tasking"
thread.

John

"John R. Delaney" <delaney@xn.ll.mit.edu> (05/30/91)

>	The rule of thumb for allocating swap space (virtual memory to you
>mac hacks) is 2MB of virtual to 1MB of physical. Anything more than that
>and you start beating the disk to death.

I am getting tired of hearing this "rule of thumb" restated as if carved on
a bloody tablet in words of fire. I am composing this message on a TI
Explorer with 8 MB of actual memory and 128 MB of virtual memory. Sure, if
I run a memory-intensive application or jump rapidly from one normal
application to another, I get pronounced delays due to paging. And when the
garbage collector cuts in, its time for a tea break. But if I use one
application for a while, then another, and so on, there may be a brief
burst of paging when I change over. But even that does not always happen.
The right ratio of virtual to actual memory depends on the hardware you
use, the operating system's design, and your pattern of usage.

The 2-to-1 rule may be appropriate for System 7.0; Apple may have tuned it
with that in mind. But until I have tried something greater than 2-to-1 for
a while on my SE/30, I am going to withold judgement. It ain't holy writ,
gang!

And by the way, what we have on the Mac's right now strikes me as
demand-paged memory, not virtual memory. But please, let's not start a
"true virtual memory" thread to go along with the "true multi-tasking"
thread.

John

krk@cs.purdue.EDU (Kevin Kuehl) (05/30/91)

In article <1991May30.132055.23209@xn.ll.mit.edu> delaney@xn.ll.mit.edu (John R. Delaney) writes:
   >	The rule of thumb for allocating swap space (virtual memory to you
   >mac hacks) is 2MB of virtual to 1MB of physical. Anything more than that
   >and you start beating the disk to death.

   I am getting tired of hearing this "rule of thumb" restated as if carved on
   a bloody tablet in words of fire. I am composing this message on a TI
   Explorer with 8 MB of actual memory and 128 MB of virtual memory.

The Unix rule of thumb for vm is 2:1 if you are doing general text
editing, compiling, ...  I imagine people have adopted this for the
Mac because it is simple and works for Joe User.  I agree with John,
when you are doing LISP (probably also database work???) work this
rule of thumb completely goes out the door.
-- 
Kevin Kuehl
krk@cs.purdue.edu

gillies@m.cs.uiuc.edu (Don Gillies) (05/31/91)

My own rule of thumb gleaned from Pilot (Xerox OS) is also 2:1.  Thus
this rule is not just a UNIX artifact.  I think that most reasonable
systems, when the software is packaged/tuned for VM, can present
double the amount of physical memory without thrashing.

128Mb of virtual memory v.s. 8Mb of physical memory on a LISP machine
is because LISP is a joke.  Common Lisp has thousands of useless
functions that need to be available, and are eating that swap space.
You have other junk in your environment like a compiler or a debugger
that by all rights is wasting VM 100% of the time.  And the majority
of garbage collection algorithms are dogs if memory is more than 50%
occupied.

So while you *say* you have 128Mb of virtual memory, you are probably
*using* tons less memory, the rest being garbage of one sort or
another.  Too bad for you, great for the disk drive makers.

Don Gillies	     |  University of Illinois at Urbana-Champaign
gillies@cs.uiuc.edu  |  Digital Computer Lab, 1304 W. Springfield, Urbana IL

-- 

peter@suntan.viewlogic.com (Peter Colby) (05/31/91)

In article <1991May30.193537.21239@m.cs.uiuc.edu>, gillies@m.cs.uiuc.edu (Don Gillies) writes:
|> My own rule of thumb gleaned from Pilot (Xerox OS) is also 2:1.  Thus
|> this rule is not just a UNIX artifact.  I think that most reasonable
|> systems, when the software is packaged/tuned for VM, can present
|> double the amount of physical memory without thrashing.
|> 
|> 128Mb of virtual memory v.s. 8Mb of physical memory on a LISP machine
|> is because LISP is a joke.  Common Lisp has thousands of useless
|> functions that need to be available, and are eating that swap space.
|> You have other junk in your environment like a compiler or a debugger
|> that by all rights is wasting VM 100% of the time.  And the majority
|> of garbage collection algorithms are dogs if memory is more than 50%
|> occupied.
|> 
|> So while you *say* you have 128Mb of virtual memory, you are probably
|> *using* tons less memory, the rest being garbage of one sort or
|> another.  Too bad for you, great for the disk drive makers.

	I am the originator of this "VM Rule of thumb" thread. That being
stated, I have another comment regarding VM (or swap space).
	Yes, the UNIX (and apparently other systems) rule of thumb is 2:1
virtual to physical. However, I have worked on and seen a number of other
programs which NEED vast amounts of VM yet function adequately in fairly
small amounts of physical memory. Certain CAD and CAE programs are high
on the list. I would also imagine that complex statistical programs
(like Markov chain analysis) need lots of VM but work fine in small
amounts of physical.
	The issue here is locality of reference. If you have a program that
needs large arrays in memory then you need LOTS of swap; but if the program
only accesses small localized areas of those large data structures at any
particular time, then page faulting is minimal and a small physical memory
is adequate for the computations.
	Then again, these programs could do their OWN memory management and
work perfectly well without VM at all - as in fact happened before the days
of VM. I worked for a company that had a program that was written (and
overlayed for) a physical address space of 64K on a mini-computer. The
code space required for this program was about 8MB (yes, 2+ MILLION lines
of code). This massive program was ported to a VM workstation with a 2^32
address space and immediately required 50MB of swap. I believe the
original workstations we ported to could take somewhere between 8-16MB
max. There was a small loss in performance but not significant.
	P
-- 
      (O)(O)(O)(O)(O)(O)(O)(O)(O)     (O)(O)(O)(O)(O)(O)(O)(O)(O)
      (O) !the doctor is out! (O)     (0) peter@viewlogic.com (0)
      (O)(O)(O)(O)(O)(O)(O)(O)(O)     (O)(O)(O)(O)(O)(O)(O)(O)(O)

erics@sco.COM (eric smith) (06/02/91)

delaney@xn.ll.mit.edu (John R. Delaney) writes:

>And by the way, what we have on the Mac's right now strikes me as
>demand-paged memory, not virtual memory. But please, let's not start a
>"true virtual memory" thread to go along with the "true multi-tasking"
>thread.

Well since you started it .... :-)

From what I understand of VM on the Mac (I'm not running 7.0 yet)
it definitely is virtual memory and not demand paging. In demand paging,
an application's pages would not be read in from their original disk
location until they were accessed. Thus if a page was never used it would
never be read in at all. What I gather about the Mac's VM is that an
application is read in as before and also written to the special disk area
that contains the entire VM contents. Applications may then be swapped in
and out from there as needed, but I believe that the entire application
has to be in physical memory in order to run (correct me if I'm wrong).
In any case, the application must completely fit into the virtual space.
This is not demand paging.

--------------------------------------------------------------------------
| Eric Steven Smith      \       /    How did the programmer die in      |
| Usenet: erics@sco.com   \     /              the shower?               |
|         erics@netcom.com \   /       By reading the instructions:      |
| CompuServe: 70262,3610    \ /           Lather. Rinse. Repeat.         |
--------------------------------------------------------------------------

keith@Apple.COM (Keith Rollin) (06/03/91)

>
>delaney@xn.ll.mit.edu (John R. Delaney) writes:
>
>>And by the way, what we have on the Mac's right now strikes me as
>>demand-paged memory, not virtual memory. But please, let's not start a
>>"true virtual memory" thread to go along with the "true multi-tasking"
>>thread.

I don't want to start a war; I just want to ask a question: why
don't you consider "demand-paged memory" to be "virtual memory".
Isn't the former just a spcific kind of the latter? That was
my impression. Is it not the case?


In article <12384@scolex.sco.COM> erics@sco.COM (eric smith) writes:
>
>From what I understand of VM on the Mac (I'm not running 7.0 yet)
>it definitely is virtual memory and not demand paging. In demand paging,
>an application's pages would not be read in from their original disk
>location until they were accessed. Thus if a page was never used it would
>never be read in at all. What I gather about the Mac's VM is that an
>application is read in as before and also written to the special disk area
>that contains the entire VM contents. Applications may then be swapped in
>and out from there as needed, but I believe that the entire application
>has to be in physical memory in order to run (correct me if I'm wrong).
>In any case, the application must completely fit into the virtual space.
>This is not demand paging.

System 7.0's VM _is_ demand paging. Pages are read in as needed. Also,
not all pages belonging to an application need to be in memory for
the application to run. However, because a running application is
likely to need all its various parts at some time, the pages holding
the applicaton code will eventually be brought into RAM.

And don't forget that this is all on top of the segmenting scheme
that Macs have always had. CODE segments aren't even read out of
their file unless they are needed.

-- 
------------------------------------------------------------------------------
Keith Rollin  ---  Apple Computer, Inc. 
INTERNET: keith@apple.com
    UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith
"But where the senses fail us, reason must step in."  - Galileo