perm filename VM.XGP[1,LMM] blob
sn#128795 filedate 1974-11-04 generic text, type T, neo UTF8
/LMAR=0/FONT#0=NGR25/FONT#1=FIX25/FONT#2=CLAR30
␈↓ α,␈↓α␈α?␈α?␈α?␈αλA Recursive Paged Virtual Memory
␈↓ α,␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩Larry Masinter
␈↓ α,␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α:11/2/74
␈↓ α,␈↓αAbstract
␈↓ α,␈↓This␈α⊂virtual␈α⊂memory␈α⊃scheme␈α⊂is␈α⊂an␈α⊂attempt␈α⊃to␈α⊂provide␈α⊂a␈α⊂virtually␈α⊃unlimited␈α⊂address
␈↓ α,␈↓space␈α
while␈α
allowing␈α
programs␈α
to␈αuse␈α
relatively␈α
short␈α
addresses␈α
for␈α
local␈αreferences.␈α
A
␈↓ α,␈↓basic address mapping scheme for variable length addresses is described.
␈↓ α,␈↓αDisclaimer
␈↓ α,␈↓The␈αideas␈αpresented␈αherein␈αare␈αacknowledged␈αto␈αbe␈αhalf-baked.␈αFurther,␈αthis␈αdoes␈αnot
␈↓ α,␈↓begin␈α∃to␈α∀satisfy␈α∃the␈α∀specification␈α∃of␈α∀the␈α∃assignment.␈α∀ However,␈α∃I␈α∀think␈α∃it␈α∃is␈α∀an
␈↓ α,␈↓interesting idea.
␈↓ α,␈↓αHardware
␈↓ α,␈↓The␈α⊂scheme␈α∂is␈α⊂described␈α∂in␈α⊂terms␈α⊂of␈α∂interpreting␈α⊂instructions␈α∂and␈α⊂addresses␈α⊂on␈α∂an
␈↓ α,␈↓unspecified␈α
16␈αbit␈α
machine␈αwith␈α
up␈αto␈α
64K␈α(2↑16)␈α
words␈αof␈α
main␈αmemory.␈α
Details␈αfor␈α
a
␈↓ α,␈↓particular machine have not been worked out.
␈↓ α,␈↓αMemory structure
␈↓ α,␈↓The␈α
memory␈α
is␈α
structured␈α
as␈α
a␈α
256-ary␈α
tree;␈α
each␈α
of␈α
the␈α
nodes␈α
is␈α
a␈α
page␈α
table,␈αand
␈↓ α,␈↓each␈α∞of␈α
the␈α∞leaves␈α∞is␈α
a␈α∞page␈α
of␈α∞data␈α∞or␈α
instructions.␈α∞A␈α
virtual␈α∞address␈α∞is␈α
completely
␈↓ α,␈↓specified␈αby␈αa␈αsequence␈αof␈αindices␈αfrom␈αthe␈αroot␈αnode.␈αThe␈αfirst␈αbyte␈αgives␈αthe␈αindex
␈↓ α,␈↓in␈αthe␈αroot␈αpage␈αtable.␈αThis␈αentry␈αcontains␈αan␈αindication␈αthat␈αit␈αis␈αeither␈αa␈αpointer␈αto␈αa
␈↓ α,␈↓data␈α∪page␈α∩or␈α∪to␈α∩another␈α∪page␈α∩table.␈α∪If␈α∪it␈α∩points␈α∪to␈α∩a␈α∪data␈α∩page,␈α∪the␈α∪next␈α∩byte
␈↓ α,␈↓determines␈α∂the␈α∂word␈α∂number␈α∂within␈α∂that␈α⊂data␈α∂page;␈α∂if␈α∂a␈α∂page␈α∂table,␈α∂the␈α⊂process␈α∂is
␈↓ α,␈↓iterated.␈α Looking␈α
from␈αthe␈α
bottom␈αup,␈α
each␈αpage␈α
(either␈αdata␈α
or␈αpage␈α
table,␈αexcept␈α
for
␈↓ α,␈↓the␈α↔root)␈α↔has␈α↔a␈α↔PARENT␈α↔page␈α↔table,␈α↔and␈α↔a␈α↔page␈α↔number␈α↔(within␈α↔its␈α↔parent).
␈↓ α,␈↓Alternatively,␈α
a␈αpage␈α
table␈α
entry␈αmay␈α
contain␈α
an␈αindication␈α
that␈α
the␈αpage␈α
is␈α
not␈αin␈α
core,
␈↓ α,␈↓and␈αthe␈αhigh␈αorder␈αbits␈αof␈αits␈αdisk␈αaddress.␈αThe␈αlow␈αorder␈αbits␈αare␈αdetermined␈αby␈αthe
␈↓ α,␈↓page number.
␈↓ α,␈↓Additionally,␈α⊃each␈α⊃page␈α⊃in␈α∩the␈α⊃virtual␈α⊃memory␈α⊃has␈α∩a␈α⊃unique␈α⊃disk␈α⊃address.␈α∩ As␈α⊃the
␈↓ α,␈↓physical␈αsize␈αof␈αthe␈αdisk␈αis␈α?,␈αthis␈αlimits␈αthe␈αvirtual␈αmemory␈αsize␈αto␈αbe␈αthat␈αof␈αthe␈αdisk.
␈↓ α,␈↓The␈α⊂disk␈α⊂addresses␈α⊂of␈α⊂those␈α⊂pages␈α⊃which␈α⊂are␈α⊂currently␈α⊂in␈α⊂core␈α⊂is␈α⊂maintained␈α⊃in␈α⊂a
␈↓ α,␈↓separate table, the Known Page Table.
␈↓ α,␈↓αData Structures
␈↓ α,␈↓Each␈αpage␈α
is␈αeither␈α
a␈αdata␈αpage␈α
containing␈α256␈α
words␈α(512␈α
8-bit␈αbytes)␈αof␈α
instructions
␈↓ α,␈↓or␈αdata,␈αor␈αelse␈αa␈αpage␈αtable,␈αcontaining␈α256␈αpage␈αtable␈αentries␈α(PTE's).␈αThe␈αformat␈αof
␈↓ α,␈↓a PTE is:
␈↓ α,␈↓A Recursive Paged Virtual Memory␈↓
l2
␈↓ α,␈↓↓bit: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
␈↓ α,␈↓↓ +---------------+---------------+
␈↓ α,␈↓↓ |0| high order bits disk address| page not in core
␈↓ α,␈↓↓ +---------------+---------------+
␈↓ α,␈↓↓bit: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
␈↓ α,␈↓↓ +---------------+---------------+
␈↓ α,␈↓↓ |1|1| reserved | RMP | data page
␈↓ α,␈↓↓ +---------------+---------------+
␈↓ α,␈↓↓bit: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
␈↓ α,␈↓↓ +---------------+---------------+
␈↓ α,␈↓↓ |1|0| reserved | RMP | pointer to page table
␈↓ α,␈↓↓ +---------------+---------------+
␈↓ α,␈↓↓notes:
␈↓ α,␈↓↓(1) a few disk addresses are reserved for special meaning; e.g.
␈↓ α,␈↓↓ zeros: pseudo data page of all zeros.
␈↓ α,␈↓↓ extend: this turns in to a page table, each entry of
␈↓ α,␈↓↓ which is a "zeros" entry except the first, which
␈↓ α,␈↓↓ contains an "extend". Good for stacks.
␈↓ α,␈↓↓(2) RMP: Real Memory Page. A page number in real memory (0-255).
␈↓ α,␈↓↓(3) bit 0 is the "in core" bit. A reference thru an entry with
␈↓ α,␈↓↓ this bit off will fault.
␈↓ α,␈↓↓(4) If in core, bit 1 is the "data page" bit; if on, the RMP pointed
␈↓ α,␈↓↓ to contains data; otherwise it contains a page table.
␈↓ α,␈↓↓(5) The low order bit of the disk address is determined by
␈↓ α,␈↓↓ the low order bit of the page number in its parent.
␈↓ α,␈↓↓(6) Bits 2-7 will contain protection information
␈↓ α,␈↓αKnown Page Table
␈↓ α,␈↓The␈αmain␈αother␈αdata␈αstructure␈αused␈αin␈αthe␈αmemory␈αscheme␈αis␈αa␈α(fixed)␈αtwo␈αpage␈αarray
␈↓ α,␈↓called␈α⊃the␈α⊃Known␈α⊃Page␈α⊃Table.␈α∩It␈α⊃contains␈α⊃additional␈α⊃information␈α⊃about␈α∩those␈α⊃pages
␈↓ α,␈↓which␈αare␈α
in␈αcore.␈α
The␈αfirst␈α
part␈αof␈α
the␈αKPT␈α
contains␈αthe␈α
real␈αdisk␈α
address␈αof␈αthe␈α
page.
␈↓ α,␈↓The second part of the KPT contains the parent information. PARENT(rmp) is either:
␈↓ α,␈↓A Recursive Paged Virtual Memory␈↓
l3
␈↓ α,␈↓↓bit: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
␈↓ α,␈↓↓ +---------------+---------------+
␈↓ α,␈↓↓ |0| high order bits disk addr. | parent not in core
␈↓ α,␈↓↓ +---------------+---------------+
␈↓ α,␈↓↓bit: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
␈↓ α,␈↓↓ +---------------+---------------+
␈↓ α,␈↓↓ |1| pn | RMP | parent in core; RMP
␈↓ α,␈↓↓ +---------------+---------------+ is its real address;
␈↓ α,␈↓↓ pn is high order bits of
␈↓ α,␈↓↓ page number within parent.
␈↓ α,␈↓αRegisters
␈↓ α,␈↓As␈α
the␈α
depth␈α
of␈α
the␈α
virtual␈α
memory␈α
tree␈α
increases,␈α
addresses␈α
relative␈α
to␈α
the␈α
root␈α
of
␈↓ α,␈↓the␈α∞tree␈α∞grow␈α
longer.␈α∞ Thus,␈α∞4␈α∞address␈α
"registers"␈α∞are␈α∞provided.␈α∞Memory␈α
references
␈↓ α,␈↓are␈αalways␈αmade␈αwith␈αrespect␈αto␈α
one␈αof␈αthese␈αregisters.␈αEach␈αregister␈αcontains␈α
an␈α8-
␈↓ α,␈↓bit␈αreal␈αmemory␈α
page␈αnumber.␈αThe␈αfour␈α
pages␈αreferred␈αto␈αin␈α
the␈αregisters␈αare␈αall␈α
page
␈↓ α,␈↓tables; and all are considered locked into core until the values of the registers change.
␈↓ α,␈↓↓ SP0: stack
␈↓ α,␈↓↓ PC0: program counter
␈↓ α,␈↓↓ DP0: data
␈↓ α,␈↓↓ GP0: general register
␈↓ α,␈↓Each␈α∩opcode␈α∩specifies␈α∩one␈α∩of␈α∩these␈α∪address␈α∩registers␈α∩as␈α∩a␈α∩context␈α∩in␈α∪which␈α∩the
␈↓ α,␈↓following␈α
bytes␈αare␈α
interpreted.␈α
SP␈αand␈α
PC␈αeach␈α
have␈α
two␈αbyte␈α
extensions:␈α
SP1␈αand
␈↓ α,␈↓PC1␈αare␈αthe␈αreal␈αmemory␈αpages␈α(RMPs)␈αof␈αthe␈αcurrent␈αstack␈αand␈αprogram␈αcounter,␈α
SP2
␈↓ α,␈↓and␈α
PC2␈α
are␈α
offsets␈α
therein.␈α
PCX␈α
is␈α
a␈α
one-bit␈α
odd␈α
byte␈α
indicator.␈α
Thus,␈α
for␈α
example,␈α
the
␈↓ α,␈↓16␈α
bit␈α
quantity␈α<SP1,SP2>␈α
is␈α
the␈αreal␈α
memory␈α
address␈α(RMA)␈α
of␈α
the␈αtop␈α
of␈α
the␈αstack.
␈↓ α,␈↓Stored␈αin␈αthe␈αmemory␈αare␈αthe␈αvirtual␈αaddresses␈αof␈αDP0,␈αPC1,␈αand␈αSP1␈αwith␈αrespect␈αto
␈↓ α,␈↓the root.
␈↓ α,␈↓αInstructions
␈↓ α,␈↓An␈αinstruction␈αconsists␈αof␈αa␈α1␈αbyte␈αopcode,␈αfollowed␈αby␈αan␈αarbitrary␈αnumber␈αof␈αbytes
␈↓ α,␈↓of␈α⊂address.␈α⊂Each␈α∂instruction␈α⊂has␈α⊂addressing␈α⊂mode(s).␈α∂ An␈α⊂addressing␈α⊂mode␈α⊂is␈α∂either
␈↓ α,␈↓relative␈αto␈αa␈αparticular␈αregister,␈αor␈αa␈αmode␈αlocal␈αto␈αSP␈αor␈αPC.␈αVarious␈α
instructions␈αare
␈↓ α,␈↓presented below:
␈↓ α,␈↓A Recursive Paged Virtual Memory␈↓
l4
␈↓ α,␈↓↓ Instruction Mode Interpretation
␈↓ α,␈↓↓ Standard Instructions
␈↓ α,␈↓↓ JUMP b1...bn PC0 Fetch [PC0; b1,...,bn] as next opcode;
␈↓ α,␈↓↓ reset PC0 to RMP of last page table found,
␈↓ α,␈↓↓ PC1 to last page, and PC2 to bn; set PCX
␈↓ α,␈↓↓ to 0. (note that n ≥ 2). Might also provide
␈↓ α,␈↓↓ a JUMP relative to ROOT.
␈↓ α,␈↓↓ LJUMP b PC Reset PC2 to b; set PCX to 0.
␈↓ α,␈↓↓ (note that one cannot jump to an odd byte)
␈↓ α,␈↓↓ PUSH b1...bn SP,DP0 Fetch [DP0; b1, b2, ... , bn]; store at
␈↓ α,␈↓↓ RMA <SP1,SP2>; decrement SP (see below).
␈↓ α,␈↓↓ POP b1...bn SP,DP0 Increment SP (see below) and store the
␈↓ α,␈↓↓ contents of <SP1,SP2> at [DP0; b1,...,bn]
␈↓ α,␈↓↓ STKNTH n SP Push SP+n onto stack. (note that stacks
␈↓ α,␈↓↓ grow from large addresses to small; this
␈↓ α,␈↓↓ is so that indirect addressing off the stack
␈↓ α,␈↓↓ can work)
␈↓ α,␈↓↓ ADD, SUB, etc SP single byte instructions which work on the top
␈↓ α,␈↓↓ of the stack.
␈↓ α,␈↓↓ Register manipulations
␈↓ α,␈↓↓ SETSP b1...bn DP0,SP Reset SP (works like JUMP).
␈↓ α,␈↓↓ UPDP DP Set DP0 to its parent.
␈↓ α,␈↓↓ DOWNDP n Set DP0 to its n'th entry.
␈↓ α,␈↓αMap Manipulation
␈↓ α,␈↓Instructions␈α
are␈α∞provided␈α
to␈α∞manipulate␈α
the␈α∞address␈α
space:␈α∞the␈α
main␈α∞operation␈α
would
␈↓ α,␈↓be␈α∂to␈α∂reset␈α∂page␈α∂n␈α∞in␈α∂DP0␈α∂to␈α∂contain␈α∂(zeros,␈α∞extend,␈α∂empty,␈α∂a␈α∂copy␈α∂of␈α∂some␈α∞other
␈↓ α,␈↓page). Alternatively, provisions for moving one PTE to another location are provided.
␈↓ α,␈↓A Recursive Paged Virtual Memory␈↓
l5
␈↓ α,␈↓αIncrementing and Decrementing
␈↓ α,␈↓When␈αthe␈αvirtual␈αaddress␈αspace␈αis␈αnot␈αlinear,␈αthe␈αconventional␈αconcept␈αof␈α"next␈αword"
␈↓ α,␈↓requires␈αsome␈αredefintion␈αwhen␈αat␈αpage␈αboundaries.␈α If␈αat␈αthe␈αlast␈αword␈αof␈αa␈αpage,␈αthe
␈↓ α,␈↓next word can be defined by:
␈↓ α,␈↓↓go␈α⊂up␈α⊂until␈α⊂you␈α⊂are␈α⊂not␈α⊂at␈α⊂the␈α⊂last␈α⊂entry␈α⊂of␈α⊂a␈α⊂PT;␈α⊂increment␈α⊂the␈α⊂page
␈↓ α,␈↓↓number, and then go down the 0 entries until you hit a data page.
␈↓ α,␈↓A similar mechanism can be defined for decrementing a register.
␈↓ α,␈↓αMore Problems and a Few Solutions
␈↓ α,␈↓A␈αpage␈αtable,␈αwhen␈α
on␈αdisk,␈αcontains␈αdisk␈αaddress␈α
PTE's␈αonly.␈αWhen␈αit␈αis␈α
brought␈αinto
␈↓ α,␈↓core,␈α∞the␈α∞Known␈α
Page␈α∞Table␈α∞is␈α
searched␈α∞for␈α∞entries␈α
containing␈α∞its␈α∞daughters;␈α∞if␈α
they
␈↓ α,␈↓are␈αfound,␈αthe␈α
map␈αis␈αupdated␈α
to␈αshow␈αthat␈α
these␈αpages␈αare␈α
in␈αcore.␈αThis␈αmechanism␈α
is
␈↓ α,␈↓necessary if one is to allow non-connected subparts of the tree to be in core.
␈↓ α,␈↓Arbitrary␈α∞address␈α∞arithmetic␈α∂is␈α∞hard,␈α∞since␈α∞addresses␈α∂are␈α∞not␈α∞uniform␈α∞in␈α∂length.␈α∞The
␈↓ α,␈↓main␈αfacilities␈αavailable␈αare␈αindirection␈αoff␈αthe␈αstack.␈αI␈αgave␈αsome␈αthought␈α
to␈αproblems
␈↓ α,␈↓of variable length arithmetic but didn't pursue it.
␈↓ α,␈↓Unfortunately,␈αthe␈αtree␈αmust␈αactually␈αbe␈αa␈αtree␈αand␈αnot␈αan␈αarbitrary␈αgraph;␈αeach␈αpage
␈↓ α,␈↓must have a unique owner.
␈↓ α,␈↓When␈α
a␈α
page␈α
is␈α
swapped␈α
out,␈α
the␈α∞entries␈α
in␈α
its␈α
parent␈α
(if␈α
in␈α
core),␈α
and␈α∞its␈α
immediate
␈↓ α,␈↓descendants (again if in core) need to be marked.
␈↓ α,␈↓αCriticisms
␈↓ α,␈↓The␈αmajor␈αissues␈αof␈αvirtual␈αmemory␈αon␈αsingle␈αuser␈αmachines␈αhave␈αnot␈αbeen␈αaddressed.
␈↓ α,␈↓The␈α
most␈α
important␈αfactor␈α
distinguishing␈α
the␈αsituation␈α
from␈α
multiprocessing␈αsituations␈α
is
␈↓ α,␈↓that,␈α⊂there␈α⊂are␈α⊂no␈α⊂other␈α⊂users␈α⊂waiting␈α⊂to␈α⊂run␈α⊂if␈α⊂a␈α⊂single␈α⊂user␈α⊂blocks.␈α⊃This␈α⊂weighs
␈↓ α,␈↓heavily␈αagainst␈αdemand␈αpage␈αreplacement␈αstrategies.␈αUsing␈αthe␈αprinciple␈αthat␈αprograms
␈↓ α,␈↓tend␈α
to␈αuse␈α
locallized␈αaddressing,␈α
some␈αprinciple␈α
of␈αfetching␈α
the␈αneighbors␈α
of␈α
a␈αdata-
␈↓ α,␈↓page␈αwhen␈αit␈αis␈αfetched␈αis␈αnot␈αunreasonable.␈α Constraints␈αcan␈αalso␈αbe␈αplaced␈αon␈αwhich
␈↓ α,␈↓pages␈αcan␈αbe␈αthrown␈αout.␈α
In␈αparticular,␈αall␈αincore␈αpages␈α
should␈αhave␈αsome␈αpath␈αto␈α
one
␈↓ α,␈↓of␈α
the␈αPT's␈α
pointed␈α
to␈αby␈α
the␈α
registers␈α(as␈α
those␈α
are␈αthe␈α
only␈α
way␈αof␈α
getting␈α
at␈αa␈α
page
␈↓ α,␈↓in core).