[comp.unix.wizards] VM, Paging, Demand Paging

allbery@ncoast.UUCP (Brandon Allbery) (10/01/87)

As quoted from <1755@ncr-sd.SanDiego.NCR.COM> by greg@ncr-sd.SanDiego.NCR.COM (Greg Noel):
+---------------
| >In article <1745@ncr-sd>, greg@ncr-sd (Greg Noel) writes:
| >> ... the PDP-11 \does/ have virtual memory.
| 
| In article <819@sugar.UUCP> peter@sugar.UUCP (Peter da Silva) writes:
| >probably because it didn't in fact have the capability of supporting VM.
+---------------

Et cetera.

Definitions for the buzzwords people are bandying about with such abandon:

Virtual Memory:  Any address scheme which allows the apparent memory space
visible to a process to be associated with the physical memory of a computer
by some mapping other than the identity transformation.  To put that simply:
virtual memory is any system which allows address <x> within a process's
address space to be some value other than address <x> within the physical
address space of the computer.

Register-relative addressing is virtual memory by this definition, since
the register can contain any legal address without affecting the program.
Note than Intel segment registers are just a refinement of sorts on the
register-relative addressing scheme.  This was also raised to a fine art
by IBM in its 360/370/43xx processor line.

===============
Paging:  A virtual memory scheme which involves the division of physical
memory into "pages"; virtual memory spaces are similarly divided.  The
mapping between virtual and physical addresses is such that consecutive
virtual segments need not be consecutive in physical memory.  The majority
of MMU's (memory management units) operate in this way.

Note that, while most MMU's support paging, many operating systems do not
use it because it requires more work on their part to keep track of the
mapping between virtual and physical addresses for a process.  The major
difference between System VR2 and System VR2.2 was that the latter had
support for paging; a process's address space was stored as a map of physical
segment addresses rather than a simple physical start address.  (Operating
systems that do not use paging simply define all physical memory segments
as consecutive if the virtual segments they represent are consecutive.  This
means less work for the operating system.)

===============
Demand Paging:  This is a virtual memory scheme which allows a given "page"
of virtual memory to reside in secondary storage if it is not being accessed.
Note that "swapping" is "demand paging" where the "page" is the size of the
process's entire virtual address space.  The benefit of demand paging is that
a part of a process's address space which is never accessed need never be
brought into memory at all, thus making more memory available to other
processes; and a part of a process's address space which is used only in-
frequently need only be loaded in main memory when it is actually being
used.  Also, whereas a "swapping" system usually leaves a copy of the read-only
portion of a process in the swap area (thus taking up extra space on disk),
demand paging systems usually optimize this by realizing that the original
load file contains the read-only data space, so read-only address spaces are
never physically paged out and are always paged in from the executable load
file.  On systems which support "copy on write" demand paging, portions of
the read-write space which are not altered by the process may also be paged
as if they were read-only; if they are altered, they will then be paged as
normal read-write address spaces.  (This can produce a noticeable improvement
in system performance when a program has a large data structure allocated
in a read-write address space, large contiguous portions of which are not
used by a particular process.  Statistical programs and fast-fourier
transforms come to mind.)

===============
So, with the definitions cleared up, we can clear up other questions:

(1) Yes, I was guilty of using the wrong terms when I lamented the lack of
"VM" on IBM PCs and clones thereof.

(2) Yes, the PDP-11 has virtual memory.  It does not support paging or
demand paging, however.  (I may be wrong about paging, I'm not a PDP-11
guru.  But if it had VM, the VAX would never have been developed by DEC.)
-- 
	    Brandon S. Allbery, moderator of comp.sources.misc
  {{harvard,mit-eddie}!necntc,well!hoptoad,sun!mandrill!hal}!ncoast!allbery
ARPA: necntc!ncoast!allbery@harvard.harvard.edu  Fido: 157/502  MCI: BALLBERY
   <<ncoast Public Access UNIX: +1 216 781 6201 24hrs. 300/1200/2400 baud>>
"`You left off the thunderclap and the lightning flash.', I told him.
`Should I try again?'  `Never mind.'"     --Steven Brust, JHEREG