Operating Systems : Modern Memory Issues
It is a well known general "truism" that programs will always expand to fill the memory available. As a corollary, computer systems will never have "enough" memory
Bank Switching
Sometimes the processor itself provides limitations on the amount of memory that can be used within a computer system. For example, with a 16-bit Address Bus, there are only 64K unique addresses available and it would not seem to make sense to install more than this amount of memory.
Sharing The Same Address
- It is possible for two or more memory locations to share the same memory address provided only one of them is "active".
Selector Devices
- It is also possible to have a device which could switch between multiple "banks" of memory, selecting one bank to be active (by allowing the "memory enable" signal to get through to it) and blocking the other banks (making them "inactive").
Memory Selector As A Ported Output Device
- By connecting such a "selector device" to the processor as a port-addressed output device, selection of alternative banks of memory could be made under program control.
LIM Standard
- One of the best known protocols for this kind of bank memory switching was developed by representatives of Lotus, Intel, and MicroSoft (thus the LIM standard) for "expanded" memory in response to the needs for processing massive spreadsheets within the IBM PC architecture (which was limited to 1 Megabyte of memory by its 20-bit Address bus).
Virtual Memory
Sometimes it is possible to divide memory into "pages" and only keep those with currently active references in "real" memory. Those which are not currently active may be kept in secondary storage until they are referenced by other instructions.
Pagination of Memory
- Memory address space is divided into blocks called pages. The address bus is split into two portions a high order portion which identifies a "page number" and a low order portion which identifies a location within the page. For example, a 16 bit address might be split into a 4-bit page, allowing for 16 pages of memory, and a 12-bit "page offset", allowing for 4096 addressable cells/bytes within each page. As well as applying to real/physical memory, programs can be divided into pages. Program pages are loaded into real memory pages; the program page number and the real memory page number may be different, but the location of a specific value within the page will be the same whether using the program or the real memory "page offset" value.
Dynamic Address Translation
- A DAT ("Dynamic Address Translation") box is a hardware device placed on the Address bus between the processor and real memory. It maintains a table of program pages which are currently loaded in real memory, and for each such program page, the real memory page number where it has been loaded. For each address generated on the Address bus, the DAT box looks up the real page number corresponding to the program page number (for the currently active program) and replaces the page number portion of the address bus signal with the real memory page number.
Page Fault Interrupt
- Whenever an address reference is made to a program page not currently loaded into a real memory page, the DAT box will be unable to find a match. In this case the DAT box will generate a "page fault" interrupt which invokes an Operating System service routine capable of loading the requested page from disk storage into a real memory page and of updating the DAT box page table.
Extending the Address Size
An obvious solution if the Address Bus does not supply enough addresses to support the amount of memory needed, is to get a bigger Address Bus.
Processor Upgrades
- Since the number of bits in an Address Bus is a feature of the Processor, changing the size of the Address Bus means replacing the Processor. Typically newer models of a processor, have more Address bus signals (Intel's 8080 had a 16-bit Address bus; the 8086, a 20-bit bus; the 80286, a 24-bit bus; and so on).
Backward Compatibility
- One of the most difficult problems in developing a new processor for an existing family of processors results from the conflicting requirements to support new features (more memory in this case) and to permit existing programs to continue to work as they did on the older models. This ability to run programs written on prior versions of a processor (or, in another context, prior versions of an Operating System) is called "backward compatibility". A product that is not backward compatible is unlikely to be successful since it requires "throwing away" everything that is currently working and starting all over.
Extended Address Registers
- Backward compatibility for Address extension normally involves the inclusion of new "address" registers containing values that are automatically added to any address sent out on the Address bus. For old programs this "extended address" register is effectively ignored. (This is basically the situation with the old .COM style programs written for MS-DOS with the old 1 Megabyte address limitation; they can not properly be executed in "extended" memory above the original IBM PC limit.)