MS-DOS Memory Issues


The differences between various kinds of memory.

Conventional Memory

Conventional memory is contiguous memory directly used by applications running on any Intel 80x86 microprocessor that is running in real mode under unaugmented MS-DOS. Addressed from 0 to 640KB (up to 736KB with special device drivers and hardware). The original 8088 processor could address up to 1MB (220, 20 being the number of address lines which come out of the CPU) of memory directly; however, IBM chose to reserve the upper 384KB for ROM and other uses.

Expanded Memory

Expanded memory is memory that conforms to the Lotus-Intel-Microsoft Expanded-Memory-Standard (LIM EMS); currently this is at 4.0 and unlikely to change much more. Expanded memory works with any 80x86 CPU and permits up to 32MB of memory expansion on any machine. CPUs below the 386 require additional support hardware, usually on the motherboard or on a memory expansion board. Special memory paging hardware built into 386 chips and up permit implementation of EMS in software, so that extended memory can look like expanded memory to your applications. Applications must be written to take advantage of EMS. Because of its longevity, EMS has the widest application support.

Expanded memory is divided into 16KB pages, which are mapped into a predetermined area in the first megabytes of address space (the page frame) as the application requests. EMS 4.0 usually requires loading a device driver to manage application requests. Code can be executed from the page frame, which can be much larger than 64KB with some hardware configurations. Multitasking software takes advantage of this, as do programs which load their overlays into EMS.

Extended Memory

Extended memory is memory located past the first megabyte of the address space. Only 286s and up support extended memory. With the minor exception of the HMA (see below), it is only addressable by applications run in real mode. DOS applications make use of this memory to store data, but not to execute code. XMS (eXtended Memory Standard, set by Microsoft) permits applications to allocate extended memory. It also copies data to and from extended memory and conventional memory so that the application does not need to switch between modes. Like EMS, XMS usually requires loading a device driver.

Extended memory is limited to 15MB on 286 and 386SX models. (15MB extended memory, plus 1MB conventional and upper memory equals 16MB, or 224, 24 being the number of address lines coming out of the CPU); limited to 4 gigabytes (232) for 386DX chips and up.

Upper Memory Blocks

Upper memory blocks refers to memory found between A0000-FFFFFh (640KB to 1024KB) in the CPU address space. Upper memory blocks are not connected with conventional memory, and cannot be directly used by applications which have not been made aware of its existence. Most likely this memory is mapped into a region using 386 memory management hardware and software or special chipsets on the motherboard, rather than physically existing there. Ordinary applications cannot use this memory easily. Using special utilities (e.g., LOADHIGH, etc.), you can place device drivers, TSRs, and certain DOS data areas (e.g., BUFFERS, FILES, FCBS) into upper memory blocks. This helps free up conventional memory.

High Memory Area

High memory area is an area slightly smaller than 64Kb starting at the 1024Kb boundary, available only on 286 or higher computers. Due to the design of the memory addressing of Intel microprocessors, you can address this space in real mode without switching to protected mode. With appropriate software, you can load device drivers and TSRs into this region as well. Quaterdeck's Desqview uses the high memory area, as does Windows 3.x and DOS 5.0 and up.

VCPI (Virtual Control Program Interface) and DPMI (DOS Protected Mode Interface)

VCPI (Virtual Control Program Interface) and DPMI (DOS Protected Mode Interface) are API's (Application Programming Interfaces) that make it possible for software to take advantage of the special capabilities of the 386 chips and up without getting in each other's way. The domain for these standards go beyond simple memory management, but they often include EMS and XMS support as well. VCPI services are provided by QEMM/Desqview and most of the DOS extenders currently on the market; DMPI is somewhat newer (and more capable) and currently is supported primarily in Microsoft Windows.

Shadow Ram

Shadow ram is memory that is used to "shadow" ROM chips. Because ROM chips are typically very slow to access, many system operations (i.e., cases where the applications call the system BIOS or other ROMs) can be sped up by copying their contents to RAM, and then using special hardware (like the C&T chipset, or the abilities of the 386 chips and up) to make the memory appear where the ROM's should be. This strategy is being used less often, as the speed-up is sometimes not worth the extra memory-management hassles for the end-user. To read more about ROM.

Cache Ram

Cache ram is very high-speed RAM chips which sit between the CPU and main memory. It stores (i.e., caches) memory accesses by the CPU. Cache ram helps to alleviate the gap between the speed of a CPU's megahertz rating and the ability of RAM to respond and deliver data. It reduces the frequency that the CPU must wait for data from the main memory.

The difference between extended and expanded memory.

Extended Memory

Memory addresses greater than or equal to one megabyte are called extended memory. The 8088 and 8086 PCs can't have extended memory because these chips can only access addresses of less than one megabyte (1MB) in size.

With the minor exception of the High Memory Area (HMA), extended memory can be addressed only by applications run in real mode. It is possible, however, for DOS applications to make use of this memory to store data (but not to execute code directly from there). XMS (Extended Memory Standard, promulgated by Microsoft) permits applications to allocate extended memory and takes care of copying data to and from extended memory and conventional memory so that the application does not have to worry about switching between modes. Like EMS, XMS usually requires loading a device driver of some sort. Extended memory is limited to 15Mb on 286es and 386SXes (15Mb extended plus 1Mb conventional and upper memory equals 16Mb, or 224, 24 being the number of address lines coming out of the CPU), limited to 4 gigabytes (232) for 386DX chips and up, although very few motherboards have been designed to hold that much memory.

Expanded memory

Expanded memory is addressed from within the lower 1MB space, usually above 640K. It is sometimes up to 64K of real addresses but this is just a small portion of the whole expanded memory, which can be very large. The expanded memory requires hardware and/or software that maps the expanded memory to a piece of address space, in what is called a "page frame". Extended memory can be used as expanded memory by using software and the 80286 or 80386 chips to "remap" it to the lower 1MB. It should be noted that the 80386 chip has hardware built in that supports expanded memory while the 80286 chip does not. Software that will convert extended memory on an 80286 machine to expanded memory may result in a significant performance penalty, if the machine does not have special hardware support for expanded memory. Software that will convert extended memory to expanded memory on an 80286 machine is not written to use the special hardware built into the 80386 chip, so the same type of performance penalty may apply.

Hardware supported expanded memory is the fastest form of expanded memory and is available directly on all 80386SX or better IBM compatibles running the proper software. It is also available on some 80286 machines with special chip sets or 80286 machines equipped with a hardware memory manager add-on. Lastly, it is available in a large number of memory expansion boards for all IBM compatible machines, including the 8088/8086 machines.

Expanded memory standards

When looking at expanded memory, one must also take into account such factors as the type of expanded memory being made available. The first widely accepted standard was the Lotus-Intel-Microsoft Expanded Memory Specification (LIM EMS) version 3.2. This provided a way for programs to store information in expanded memory, but did not allow for efficient movement of information or the storing of the actual program. Lotus 1-2-3, for example, could store only cell labels and not values in expanded memory, restricting the real value of this type of expanded memory. Other standards that were developed later included AST's Enhanced Expanded Memory Specification (EEMS) and IBM's Expanded Memory Adapter (XMA). Once combined under LIM EMS version 4.0, these allowed better use of expanded memory. The features in LIM EMS 4.0 include increased page size and the ability to position the page windows anywhere in memory. Version 4.0 allowed programs to load executable code into expanded memory, since the page could be made to appear to be from memory in the 0-640K DOS memory range.

Most memory boards currently offer some sort of LIM EMS 4.0 support but you will still pay a performance penalty unless the board offers full hardware support for LIM EMS 4.0. (Some boards offer software drivers to give the board LIM EMS 4.0 compatibility.)

Under DOS, applications must explicitly use either expanded or extended memory. Lotus 1-2-3 release 3.1 and Microsoft Windows require that extended memory be available in order to operate. Most other DOS programs will use expanded memory only to get around the DOS 640K barrier. Some of the commercial memory management software for the 80386 chip will actually switch memory from expanded to extended memory if a program asks for it.

Under OS/2 or Unix, there is no need for expanded memory because you do not run them on 8088s. The term "extended" memory loses meaning because all the physical memory is available and is allocated to the programs as needed.

Copyright ©1998 DEW Associates Corporation. All rights reserved.