Microsoft KB Archive/37242

= A General Tutorial on the Various Forms of Memory =

Article ID: 37242

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft MS-DOS 2.11 Standard Edition
 * Microsoft MS-DOS 3.1
 * Microsoft MS-DOS 3.2 Standard Edition
 * Microsoft MS-DOS 3.21 Standard Edition
 * Microsoft MS-DOS 3.3 Standard Edition
 * Microsoft MS-DOS 3.3a
 * Microsoft MS-DOS 4.0 Standard Edition
 * Microsoft MS-DOS 4.01 Standard Edition
 * Microsoft MS-DOS 5.0 Standard Edition
 * Microsoft MS-DOS 5.0a
 * Microsoft MS-DOS 6.0 Standard Edition
 * Microsoft MS-DOS 6.2 Standard Edition
 * Microsoft MS-DOS 6.21 Standard Edition
 * Microsoft MS-DOS 6.22 Standard Edition

-



This article was previously published under Q37242



SUMMARY
This article provides a general description of the different forms of memory available in the MS-DOS environment on PC and PS/2 systems. It also discusses what kinds of software use these different areas, and what drivers are needed to create and control some of these areas.

The first section of this article, &quot;The Memory Map,&quot; shows a memory map that outlines the layout of these different forms of memory. The next section, &quot;Types of Memory,&quot; discusses the major forms of memory, and their physical and logical components and drivers. The &quot;Equations&quot; section gives some handy equations for showing how these areas of memory can be used or emulated. After this is the &quot;Memory Drivers&quot; section, which gives a brief description of the memory management device drivers mentioned in this article. The last section, &quot;Further Reading,&quot; gives additional reading material for more information on some of these forms of memory.



MORE INFORMATION
There are many forms of memory: conventional, extended, EMS, XMA, and XMS. Below is a description of each form of memory, and how they relate; because there are many relationships, you may have to read the following material twice to eliminate any references to undefined terms.

The Memory Map
The following is an illustration that shows the various components of memory that are available (please note that it is a very general map):    32M ++ |                                           |        | expanded memory board                      | + |                                           |     |      0 ++     |                                                           |                                                           |        +--- +     |        |                                            |     |        | built-in memory                            |     | |                                           |     |    nM* ++     | |                                           |     |        | extended memory (1M-nM*)                   |     | |                                           |     |        +- - - - - - - - - - - - - - - - - - - - - - +     |        |                                            |     |        | high memory area (FFFF:0010-FFFF:FFFFh)    |     | |                                           |     |     1M ++     | |                                           |     |        | upper memory area (640K-1M)                |     | |                                           |     |        +- - - - - - - - - - - - - - - - - - - - - - +     |        |                                            |     |        | expanded memory page frame (64K)           | <---+ |                                           |        +- - - - - - - - - - - - - - - - - - - - - - +        |                                            |   640K ++ |                                           |        | extended BIOS data area (1K)               | |                                           |   639K +- - - - - - - - - - - - - - - - - - - - - - + |                                           |        | conventional memory (0K-640K)              | |                                           |      0 ++

++       |                                            |        | IBM expanded memory adapter (XMA)          | |                                           |        ++


 * nM = 16 MB on an 80286, 4 gigabytes on an 80386

Types of Memory

 * Conventional Memory

Intel 8086 systems can address 1 MB of memory. (Later systems can address more, in other modes.) On PC and PS/2 systems, this is divided into the conventional memory area and the upper memory area (UMA).

The conventional memory area is the 0K-640K section of &quot;normal&quot; memory. This area of memory is used by MS-DOS and normal application software.

The UMA is the 640K-1 MB section of memory that normally contains video adapter buffers, network card buffers, and other buffers and work areas for peripherals and the ROM BIOS. It is also normally used on EMS systems to store the expanded memory page frame. This area of memory is normally used by the ROM BIOS and peripherals, such as the expanded memory manager.
 * Extended Memory

The extended memory area is an area of memory that is available only on 80286 and 80386 systems. This memory begins at 1 MB. On 80286 systems, the upper limit is 16 MB; on 80386 systems, the upper limit is 4 gigabytes. This memory is only addressable while in protected mode. It is normally used by systems software (RAMDrive, SMARTDrive, VDISK, EMM386.SYS, XMAEM.SYS, and HIMEM.SYS).

Built-in memory (BIM) is a form of memory that exists on Compaq and some other 80386 OEM systems. These systems have 1 MB of conventional memory on their motherboard, and this extra 384K of &quot;built-in memory&quot; is mapped to the top of extended memory, because the UMA already occupies the upper 384K of conventional memory. This area of memory is normally used by systems software. HIMEM.SYS uses this memory and includes it in its extended memory blocks, if it is available. (Other OEM systems also have 384K of otherwise unused memory on their motherboard. A common place for this memory to be mapped into is the first section of extended memory.)
 * EMS Memory

An expanded memory board is a separate board that contains EMS memory of up to 32 MB, which can be addressed on any Intel 80x86 system by paging 16K portions of memory into the expanded memory page frame, located in the UMA.

The expanded memory page frame, normally located in the UMA, is a collection of 16K physical pages from which an application program accesses expanded memory. These page frames are memory frames paged in from the expanded memory board. This area of memory is controlled exclusively by the expanded memory manager (such as EMM386.SYS), which is in turn called by systems software (such as Buffers/X, Fastopen/X, SMARTDrive, RAMDrive, VDISK, MSCDEX, and Windows) and applications software (such as Excel and the Programmer's Library).

Alternatively, 80386 systems can use 80386-specific features to emulate EMS memory by paging 16K portions of memory into the expanded memory page frame, as always located in the UMA. EMM386, QEMM, and 386MAX are examples of this software.
 * XMA Memory

An IBM expanded memory adapter (XMA) is a separate board that contains IBM (or compatible) XMA memory, which can be addressed as either expanded memory or extended memory, with the appropriate software drivers.
 * XMS Memory

XMS memory is the collection of the UMA and the extended memory area, and is controlled by an extended memory manager (XMM) such as HIMEM.SYS. The extended memory area is only available on 80286 and 80386 systems. The extended memory area is broken up into two logical areas by the XMM: the high memory area (HMA) and extended memory blocks. Thus, XMS memory consists of the UMA, the HMA, and the extended memory area.

The HMA is 64K of memory located at the beginning of the extended memory area. It exists only on 80286 and 80386 systems with extended memory. This area only exists in a controlled, easily accessible manner when HIMEM.SYS or another XMS driver is installed. This area of memory is controlled exclusively by the extended memory manager (such as HIMEM.SYS), which is in turn called by systems software (such as Windows) and applications software.

Upper memory blocks (UMBs) are blocks of memory that are available on some 80286 and 80386 systems, and are located in the UMA. The number, size, and location of these blocks vary widely, depending upon the types of hardware adapter cards installed in the machine. The XMS specification creates these abstract data types. (HIMEM.SYS does not implement UMBs; in MS-DOS 5.0 and later, EMM386.EXE does.)

Extended memory blocks (EMBs) are blocks of extended memory. The XMS specification creates these abstract data types. This area can only be used for data storage (that is, they cannot be used to store code). EMBs exist to allow systems and applications software to allocate extended memory, which is otherwise very difficult to address and manipulate in a controlled manner.

Equations
The following are some rules and &quot;equations&quot; for combining, modifying, and emulating memory to make it useful:   = + HIMEM.SYS

 = + + HIMEM.SYS + EMM386.EXE (version 4.33.06x or later)

 = proprietary memory adapter of IBM

 = usable by MS-DOS and applications

= usable by some applications

 = + + XMAEM.SYS

 = + + EMM386.SYS (version 4.0)

 = + + HIMEM.SYS + EMM386.SYS or EMM386.EXE (version 4.10.0419 or later) This means the two-stage system needed by IBM PC-DOS owners to convert their 80386 extended memory into EMS memory is as follows:    = + + XMAEM.SYS + XMA2EMS.SYS The one state processed is needed by Microsoft MS-DOS users to convert their 80386 systems to EMS memory is as follows:    = + + EMM386.SYS (version 4.0)

<EMS memory> = + + HIMEM.SYS + EMM386.SYS (version 4.10.0419)

<EMS memory> = + + HIMEM.SYS + EMM386.EXE (version 4.20.06x) If you have an 80386 system, extended memory, and MS-DOS, you can use EMM386.SYS to obtain EMS memory. If you have the same system and memory with IBM PC-DOS, you must use two drivers, XMAEM.SYS and XMA2EMS.SYS, to achieve EMS memory.

If you have an 80286 system and want to use your extended memory as EMS memory, you will not be able to use the existing drivers included with MS-DOS. Some of these extended memory boards come with EMS emulators, which can be used.

Memory Drivers
The Microsoft driver HIMEM.SYS takes over 80286 and 80386 extended memory, converting it to the extended memory area of the XMS specification. It also takes the first 64K of this extended memory area and converts it into the HMA.

The IBM PC-DOS version 4.0 driver XMAEM.SYS takes IBM PS/2 Model 80 80386 extended memory and uses it to emulate IBM XMA memory. (Used in conjunction with the XMA2EMS.SYS driver, it is possible to use this memory as EMS memory.)

The IBM PC-DOS version 4.0 driver XMA2EMS.SYS takes IBM XMA memory (or the emulated XMA memory created by the XMAEM.SYS driver) and uses it to emulate LIM/EMS memory.

The Microsoft MS-DOS version 4.0 driver EMM386.SYS takes 80386 extended memory and uses it to emulate LIM/EMS memory.

<div class="references_section">