Basic System Problem Analysis - August 2003

27
Memory Management Structures
Memory management dove tails with Virtual Space management and keeps track of the
real memory pages in use (among a lot of other things).
The hashed page directory or HPDIR is the structure used at the lowest levels of the OS
to load the TLB (translation look-aside buffer) with a virtual-to-real translation.
When a virtual address is referenced, say a LDW (load word) instruction, the hardware
will expect to find in the TLB a translation of that virtual address to a real address in
memory. If there is no TLB translation found the hardware will go back to software (a
page absence trap) and the first thing the software will do is try to locate an entry in this
hashed page table. If an entry cannot be found in the hashed page table then we need to
go back to VSM to find out if the virtual address is valid or not. If it is invalid the process
or system will be aborted depending on where this trap occurred. If the address is valid
then we need to go find the corresponding secondary storage address and start the process
of swapping in a part of that object.
The IPDIR or indexed page directory, KSO 3 is a table consisting of a 64 byte entry for
each physical 4K page of memory configured on the system. The header for this table is
of type LIST_IPDIR” and contains pointers to lists of pages.
These lists are
1. free list, free pages ready for use
2. present list, pages “owned” by a virtual object
3. ROC list, a list of recoverable overlay candidate pages
4. Critical list, pages held in reserve for critical operations (stack overflows etc.)
5. Unusable list, pages found to have had errors and deallocated by PDC
The meaning of “free” and “present” is obvious. A ROC page is a page that has not been
touched recently or one whose owner, playing nice in the pool, has said can be taken if
necessary. When a page is made ROC the contents of the page are written out to disk in
anticipation that the page will be re-used but the I/O is done at a lower priority
(sometimes called an “anticipatory write”). If the page winds up being made free so it can
be reused the priority of any outstanding I/O is bumped up so it completes quickly.
The IPDIR also tracks when pages are “dirty”, that is they have been modified. If the
page is part of a non-memory resident object it would need to be posted to disk in the
event the page was to be reused for another purpose.
Finally MIB’s are Memory Manager I/O Blocks (not to be confused with MIB’s in
SNMP). Whenever pages of memory are read in from disk or written out to disk a MIB
is created to track that.