The Full Wiki

Conventional memory: Wikis


Note: Many of our articles have direct quotes from sources you can cite, within the Wikipedia article! This article doesn't yet, but we're working on it! See more info or our list of citable articles.


From Wikipedia, the free encyclopedia

A memory map of the IBM PC.

In computing, conventional memory is the first 640 kilobytes of the memory on IBM PC or compatible systems.


640 kB barrier

The 640 kB barrier is an architectural limitation of IBM and IBM PC compatible PCs. The Intel 8088 CPU, used in the original IBM PC, was able to address 1024 kB (1 MB or 220 bytes), as the chip offered 20 address lines. The lower limit was due to hardware mapping (memory-mapped I/O):

In order for a CPU to be able to interact with both the RAM and other hardware, some portion of the address space must be set aside for hardware use only, such as for accessing a video card's frame buffer or to run software stored in an expansion card's Read Only Memory. As originally conceived, the memory below 640 kB was for random-access memory, and the 384 kB above reserved for hardware use. Because the original designers could not know what future applications might arise for the hardware, much of the 384 kB was unused but reserved in the event that it was needed by hardware. A similar reserved hardware space exists in other system designs as well; for the original Apple II computer, the CPU could address a total of 64 kB, with 48 kB intended for RAM and the upper 16 kB reserved for hardware use.

At the time of the PC's release in 1981, 640 kB was more memory than the first IBM PC motherboards could support, which were available with 16kB to 64kB or 64 kB to 256 kB installed. It took a few years until most new PCs had even that much memory installed through memory expansion cards. The most popular existing microcomputer when the PC appeared, the Apple II+, had 64 kB in the most common configuration and could not be easily expanded beyond this.

The design of the original IBM PC placed the Color Graphics Adapter memory map and other hardware in the 384 kB Upper Memory Area. The need for more RAM grew faster than the needs of hardware to utilize the reserved addresses, which resulted in RAM eventually being mapped into these unused upper areas to utilize all available addressable space. This introduced a reserved "hole" (or several holes) into the set of addresses occupied by hardware that could be used for arbitrary data. Avoiding such a hole was difficult and ugly and not supported by MS-DOS or most programs that MS-DOS could run. Later, space between the holes would be used as Upper Memory Blocks.

To maintain compatibility with older operating systems and applications, the 640 kB barrier remained part of the PC design even after the 8088 had been replaced with the Intel 286 processor, which could address up to 16 MB of memory. The 1MB barrier also remained as long as the 286 was running in compatibility mode, as MS-DOS forced assumptions about how the segment and offset registers overlapped such that addresses with more than 20 bits were unsupported. It is still present in IBM PC compatibles today if they are running MS-DOS, and even in the most modern Windows-based PCs the RAM still has a "hole" in the area between 640 and 1024 kilobytes, which however is invisible to application programs thanks to paging and virtual memory.[citation needed]

A similar 3 GB barrier exists, which reduces 32-bit addressing from 4 GB to 3 GB on motherboards that use memory mapped I/O. However, due to applications not assuming that the 3–4 GB range is reserved, there is no need to retain this addressing for compatibility, and thus the barrier is easily removed by using a separate address bus for hardware, and only affects a relatively small number of computers.

Additional memory

One technique used on early IBM XT computers was to ignore the Color Graphics Adapter (CGA) memory map and push the limit up to the start of the Monochrome Display Adapter (MDA). Sometimes software or a custom address decoder was used so that attempts to use the CGA went to the MDA memory. This moved the barrier to 704 kB[1].

Memory managers on 386-based systems (such as QEMM or MemoryMax in DR-DOS) could achieve the same effect, adding conventional memory at 640 kB and moving the barrier to 704 kB or 736 kB. Only CGA could be used in this situation, because Enhanced Graphics Adapter (EGA) used this memory for the bit-mapped graphics buffer.

The AllCard, an add-on memory management unit for XT-class computers, allowed normal memory to be mapped into the A0000-EFFFF (hex) address range, giving up to 952 kB for DOS programs. Programs such as Lotus 1-2-3, which accessed video memory directly, needed to be patched to handle this memory layout. Therefore, the 640 kB barrier was removed at the cost of hardware compatibility.

It was also possible to use DOS's utility for console redirection, CTTY, to direct output to a dumb terminal or another computer running a terminal emulator. The video card could then be removed completely, and assuming the BIOS still permitted the machine to boot, the system could achieve a total memory of 960k of ram. This also required that the system have at least 2MB of physical memory in the machine. This procedure was tested on a 486 with IBM PC DOS 7.0.[citation needed] The total operating system footprint was around 20k, most of DOS residing in the HMA.

Memory optimization

As DOS applications grew larger and more complex in the late 1980s, it became common practice to free up conventional memory by moving device drivers and Terminate and Stay Resident programs into Upper Memory Blocks in the Upper Memory Area at boot, in order to maximize the conventional memory available for applications. This had the advantage of not requiring hardware changes, and preserved application compatibility. This feature began with DR-DOS 5 and was later implemented in MS-DOS 5. The ability of MS-DOS versions 5.0 and later to move their own system core code into the High Memory Area through the DOS=HIGH command gave another boost to free memory.

Most users used the accompanying EMM386 driver provided in DOS 5, but third-party products from companies such as QEMM, also proved popular. The process of optimization sometimes requires manual tuning of the process to produce the best results, in the sense of greatest free conventional memory.

In MS-DOS 6, Microsoft introduced memmaker, which automated this process of block matching, matching the functionality third-party memory managers offered. This still didn't provide the same result as doing it by hand.

DOS extenders

The barrier was only overcome with the arrival of DOS extenders, which allowed DOS applications to run in extended memory, but these were not very widely used outside the computer game area. The first PC operating systems to integrate such technology were Compaq DOS 3.31 (via CEMM) and Windows/386 2.1, both released in 1988. Since the 80286 version of Windows 2.0 (Windows/286), Windows applications did not suffer from the 640 kB barrier.

Prior to DOS extenders, if a user installed additional memory and wished to use it under DOS, they would first have to install and configure drivers to support either expanded memory specification (EMS) or extended memory specification (XMS).

EMS was a specification available on all PCs, including the Intel 8086 and Intel 8088 which allowed add-on hardware to page small chunks of memory in and out of the "real mode" addressing space. (0x0400–0xFFFF). This required that a hole in real memory be available, typically (0xE000–0xEFFF). A program would then have to explicitly request the page to be accessed before using it. These memory locations could then be used arbitrarily until replaced by another page. This is very similar to modern virtual memory except that the operating system handles all paging operations and the programmer, for the most part, does not have to consider this.

XMS provided a basic protocol which allowed the client program to load a custom protected mode kernel. This was available on the Intel 80286 and newer processors. The problem with this approach is that while in protected mode, DOS calls could not be made. The work around was to implement a callback mechanism. On the 286, this was a major problem. The Intel 80386, which introduced "Virtual86 mode", allowed the guest kernel to emulate the 8086 and run the host operating system without having to actually force the processor back into "real mode".

The latest DOS extension is DOS Protected Mode Interface, a more advanced version of XMS which provided many of the services of a modern kernel, obviating the need to write a custom kernel. It also permitted multiple protected mode clients. This is the standard target environment for the DOS port of the GCC compilers.

There are a number of other common DOS extenders. The most notable of which is the runtime environment for the Watcom compilers, DOS/4GW, which was very common in games for DOS. Such a game would consist of either a DOS/4GW 32-bit kernel, or a stub which loaded a DOS/4GW kernel located in the path or in the same directory and a 32-bit "linear executable". Utilities are available which can strip DOS/4GW out of such a program and allow the user to experiment with any of the several, and perhaps improved, DOS/4GW clones.

See also


This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.



Got something to say? Make a comment.
Your name
Your email address