DOS memory management
Encyclopedia
- This article is about a class of DOS device drivers. For the general concept, see: memory managementMemory managementMemory management is the act of managing computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and freeing it for reuse when no longer needed. This is critical to the computer system.Several...
.
In IBM PC compatible
IBM PC compatible
IBM PC compatible computers are those generally similar to the original IBM PC, XT, and AT. Such computers used to be referred to as PC clones, or IBM clones since they almost exactly duplicated all the significant features of the PC architecture, facilitated by various manufacturers' ability to...
computing, DOS memory management refers to software and techniques employed to give applications access to more than 640K of "conventional memory". The 640kB limit was specific to the IBM PC and close compatibles; other machines running MS-DOS had different limits, for example the Apricot PC
Apricot PC
The Apricot PC was Apricot Computers' first personal computer made for business use. The press received it well, especially for the high resolution of its time and its trackball cable . It is the first non-Japanese computer using 3.5" Sony floppy disc units.It uses a Intel 8086 processor running...
could have up to 768kB and the Sirius
Sirius Systems Technology
Sirius Systems Technology was a personal computer manufacturer in Scotts Valley, California. It was founded in 1980 by Chuck Peddle and Chris Fish, formerly of MOS Technology and capitalized by Walter Kidde Inc. In late 1982 Sirius acquired Victor Business Systems from Kidde and changed its name...
Victor 9000, 896kB. Memory management on the IBM family was made complex by the need to maintain backward compatibility to the original PC design and real-mode PC DOS (MS DOS), while allowing computer users to take advantage of large amounts of low-cost memory and new generations of processors. Since MS DOS has given way to Windows and other 32-bit operating systems not restricted by the original arbitrary 640kB limit of the IBM PC, managing the memory of a personal computer no longer requires the user to manually manipulate internal settings and parameters of the system.
The 640kB limit imposed great complexity on hardware and software intended to circumvent it; the physical memory in a machine could be organised as a combination of base or conventional memory, upper memory, high memory (not the same as upper memory), extended memory, and expanded memory, all handled in different ways.
Conventional memory
The 8088 processor used in the original IBM PC had 20 address lines and so could directly address 1 megabyte of memory. Different areas of this address space were allocated to different kinds of memory used for different purposes. Starting at the lowest end of the address space, the PC had read/write memory (RAM) installed, which was used by PC DOS and application programs. The first part of this memory was installed on the motherboard of the system (in very early machines, 64 kilobytes, later revised to 256 kilobytes). Additional memory could be added on cards plugged into the expansion slots; each card contained straps or switches to control what part of the address space access memory and devices on that card.On the IBM PC, all the address space up to 640 kilobytes was available for RAM. This part of the address space is called "conventional memory" since it accessible to all versions of PC DOS (and MS DOS) automatically on start up. Normally expansion memory is set to be contiguous in the address space with the memory on the motherboard. If there was an unallocated gap between motherboard memory and the expansion memory, the memory would not be automatically detected as usable by PC DOS.
Upper memory area
The upper memory area (UMA) refers to the address space between 640 KB and 1024 KB (0xA0000–0xFFFFF). Three 128 kB regions were defined in this area. The 128 kB between 0XA0000 and 0xBFFFF was reserved for video adapter screen memory. The physical address space between 0xC0000 and 0xDFFFF was reserved for device BIOS ROMs, and special RAM usually shared with physical devices (for example, shared memory for a network adapter). The IBM PC reserved the uppermost 128 KB of the address space from 0xE0000 to 0xFFFFF for the BIOSBIOS
In IBM PC compatible computers, the basic input/output system , also known as the System BIOS or ROM BIOS , is a de facto standard defining a firmware interface....
and Cassette BASIC
IBM Cassette BASIC
IBM Cassette BASIC was a version of the Microsoft BASIC programming language licensed by IBM for the IBM PC. It was included in the BIOS ROM of the original IBM PC. Cassette BASIC provided the default user interface if there was no floppy disk drive installed, or if the boot code did not find a...
read-only memory (ROM).
For example, the monochrome video adapter memory area runs from 704 to 736 KB (0xB0000–0xB7FFF). If only a monochrome display adapter was used, the address space between 0xA0000 and 0xAFFFF could be used for RAM, which would be contiguous with the conventional memory.
The system BIOS ROMs must be at the upper end of the address space because the CPU starting address is fixed by the design of the processor. The starting address is loaded into the program counter
Program counter
The program counter , commonly called the instruction pointer in Intel x86 microprocessors, and sometimes called the instruction address register, or just part of the instruction sequencer in some computers, is a processor register that indicates where the computer is in its instruction sequence...
of the CPU after a hardware reset and must have a defined value that endures after power is interrupted to the system. On reset or power up, the CPU loads the address from the system ROM and then jumps to a defined ROM location to begin executing the system power-on self test, and eventually load an operating system.
Since an expansion card such as a video adapter, hard drive controller, or network adapter could use allocations of memory in many of the upper memory areas, configuration of some combinations of cards required careful reading of documentation, or experimentation, to find card settings and memory mappings that worked. Mapping two devices to use the same physical memory addresses could result in a stalled or unstable system. Not all addresses in the upper memory area were used in a typical system; unused physical addresses would return undefined and system-dependent data if accessed by the processor.
Expanded memory
As memory prices declined, application programs such as spreadsheetSpreadsheet
A spreadsheet is a computer application that simulates a paper accounting worksheet. It displays multiple cells usually in a two-dimensional matrix or grid consisting of rows and columns. Each cell contains alphanumeric text, numeric values or formulas...
s and computer-aided drafting were changed to take advantage of more and more physical memory in the system. Virtual memory
Virtual memory
In computing, virtual memory is a memory management technique developed for multitasking kernels. This technique virtualizes a computer architecture's various forms of computer data storage , allowing a program to be designed as though there is only one kind of memory, "virtual" memory, which...
in the 8088 and 8086 was not supported by the processor hardware, and disk technology of the time would make it too slow and cumbersome to be practical. Expanded memory was a system that allowed application programs to access more RAM than directly visible to the processor's address space. The process was a form of bank switching
Bank switching
Bank switching is a technique to increase the amount of usable memory beyond the amount directly addressable by the processor. It can be used to configure a system differently at different times; for example, a ROM required to start a system from diskette could be switched out when no longer...
. When extra RAM was needed, driver software would temporarily make a piece of expanded memory accessible to the processor; when the data in that piece of memory was updated, another part could be swapped into the processor's address space. For the PC and XT, with only 20 address lines, special-purpose expanded memory cards were made containing perhaps a megabyte, or more, of expanded memory, with logic on the board to make that memory accessible to the processor in defined parts of the 8088 address space.
Allocation and use of expanded memory was not transparent to application programs. The application had to keep track of which bank of expanded memory contained a particular piece of data, and when access to that data was required, the application had to request (through a driver program) the expanded memory board to map that part of memory into the processor's address space. Although applications could use expanded memory with relative freedom, many other software components such as drivers and TSR
Terminate and Stay Resident
Terminate and Stay Resident is a computer system call in DOS computer operating systems that returns control to the system as if the program has quit, but keeps the program in memory...
s were still normally constrained to reside within the 640K "conventional memory" area, which soon became a critically scarce resource.
The 80286 and the high memory area
When the IBM AT was introduced, the segmented memory architecture of the Intel family processors had the byproduct of allowing slightly more than 1 megabyte of memory to be addressed in the "real" mode. Since the 80286 had more than 20 address lines, certain combinations of segment and offset could point into memory above the 0x010000 (2^21) location. To maintain compatibility with the PC and XT behavior, the AT included an A20 lineA20 line
The A20 or addressing line 20 is one of the plethora of electrical lines that make up the system bus of an x86-based computer system. The A20 line in particular is used to transmit the 21st bit on the address bus....
gate that made the AT address wrap around to low memory as they would have on an 8088 processor. This gate could be controlled, initially through the keyboard controller
Keyboard controller (computing)
In computing, a keyboard controller is a device which interfaces a keyboard to a computer. Its main function is to inform the computer when a key is pressed or released...
, to allow running programs which wanted to access an additional 64 kB - 16 bytes of memory in real mode.
In DOS memory management
DOS memory management
In IBM PC compatible computing, DOS memory management refers to software and techniques employed to give applications access to more than 640K of "conventional memory". The 640kB limit was specific to the IBM PC and close compatibles; other machines running MS-DOS had different limits, for example...
, the high memory area (HMA) is the RAM
Random-access memory
Random access memory is a form of computer data storage. Today, it takes the form of integrated circuits that allow stored data to be accessed in any order with a worst case performance of constant time. Strictly speaking, modern types of DRAM are therefore not random access, as data is read in...
area consisting of the first 64 kibibyte
Kibibyte
The kibibyte is a multiple of the unit byte for quantities of digital information. The binary prefix kibi means 1024; therefore, 1 kibibyte is . The unit symbol for the kibibyte is KiB. The unit was established by the International Electrotechnical Commission in 1999 and has been accepted for use...
s (KiB), minus 16 bytes, of the extended memory
Extended memory
In DOS memory management, extended memory refers to memory above the first megabyte of address space in an IBM PC or compatible with an 80286 or later processor. The term is mainly used under the DOS and Windows operating systems...
on an IBM AT or compatible microcomputer.
So-called A20 handlers could control the addressing mode dynamically, thereby allowing programs to load themselves into the 1024–1088 KB region and run in real mode. The first user of the HMA among Microsoft products was Windows/286 2.1 in 1988, which introduced the HIMEM.SYS device driver. Starting with versions 5.0 of DR-DOS
DR-DOS
DR-DOS is an MS-DOS-compatible operating system for IBM PC-compatible personal computers, originally developed by Gary Kildall's Digital Research and derived from Concurrent PC DOS 6.0, which was an advanced successor of CP/M-86...
(1990) and of MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...
(1991), parts of the operating system could be loaded into HMA as well, freeing up to 46 KB of conventional memory
Conventional memory
In DOS memory management, conventional memory, also called base memory, is the first 640 kilobytes of the memory on IBM PC or compatible systems. It is the read-write memory usable by the operating system and application programs...
. Other components, such as device drivers and TSR
Terminate and Stay Resident
Terminate and Stay Resident is a computer system call in DOS computer operating systems that returns control to the system as if the program has quit, but keeps the program in memory...
s, could be loaded into the upper memory area
Upper Memory Area
In DOS memory management, the upper memory area refers to memory between the addresses of 640 KB and 1024 KB in an IBM PC or compatible. IBM reserved the uppermost 384 KB of the 8088 CPU's 1024 KB address space for ROM, RAM on peripherals, and memory-mapped input/output...
(UMA).
80386 and subsequent processors
Intel processors of the 386Intel 80386
The Intel 80386, also known as the i386, or just 386, was a 32-bit microprocessor introduced by Intel in 1985. The first versions had 275,000 transistors and were used as the central processing unit of many workstations and high-end personal computers of the time...
version and later allowed a virtual 8086 mode
Virtual 8086 mode
In the 80386 microprocessor and later, virtual 8086 mode allows the execution of real mode applications that are incapable of running directly in protected mode while the processor is running a protected mode operating system.VM86 mode uses a segmentation scheme identical to that of real mode In...
, which simplified the hardware required to implement expanded memory for MS DOS applications. Expanded memory managers such as Quarterdeck
Quarterdeck Office Systems
Quarterdeck Office Systems, later Quarterdeck Corporation , was an American computer software company. It was founded by Therese Myers and Gary Pope in 1981and incorporated in 1982...
's QEMM
QEMM
Quarterdeck Expanded Memory Manager , was a memory manager produced by Quarterdeck Office Systems in the late 1980s through late 1990s. It was the most popular memory manager for the MS-DOS and other DOS operating systems.-QEMM product ranges:QRAM: A memory manager for 286 or higher CPU. It...
product and Microsoft's EMM386
EMM386
The name EMM386 was used for the expanded memory managers of both Microsoft's MS-DOS and Digital Research's DR-DOS, which created expanded memory using extended memory on Intel 80386 CPUs. There also is an EMM386.EXE available in FreeDOS....
supported the expanded memory standard without requirement for special memory boards.
On 386 and subsequent processors, memory managers like QEMM might move the bulk of the code for a driver or TSR into extended memory and replace it with a small fingerhold that was capable of accessing the extended-memory-resident code. They might analyze memory usage to detect drivers that required more RAM during startup than they did subsequently, and recover and reuse the memory that was no longer needed after startup. They might even remap areas of memory normally used for memory-mapped I/O. Many of these tricks involved assumptions about the functioning of drivers and other components. In effect, memory managers might reverse-engineer and modify other vendors' code on the fly. As might be expected, such tricks did not always work. Therefore, memory managers also incorporated very elaborate systems of configurable options, and provisions for recovery should a selected option render the PC unbootable (a frequent occurrence).
Installing and configuring a memory manager might involve hours of experimentation with options, repeatedly rebooting the machine, and testing the results. But conventional memory was so valuable that PC owners felt that such time was well-spent if the result was to free up 30K or 40K of conventional memory space.
Extended memory
In the context of IBM PC compatible computers, extended memory refers to memory in the address space of the 80286 and subsequent processors, beyond the 1 megabyte limit imposed by the 20 address lines of the 8088 and 8086. Such memory is not directly available to PC DOS (MS DOS) applications running in the so-called "real mode" of the 80286 and subsequent processors. This memory is only accessible in the protected or virtual modes of 80286 and higher processors.External links
- Microsoft support: Overview of Memory-Management Functionality in MS-DOS
- Computer ChroniclesComputer ChroniclesThe Computer Chronicles was a US television series, broadcast during 1981-2002 on Public Broadcasting Service public television, which documented the rise of the personal computer from its infancy to the immense market at the turn of the century...
(1990). "High Memory Management". From the Internet ArchiveInternet ArchiveThe Internet Archive is a non-profit digital library with the stated mission of "universal access to all knowledge". It offers permanent storage and access to collections of digitized materials, including websites, music, moving images, and nearly 3 million public domain books. The Internet Archive...
.