Skip to main content

Skip to navigation

The access keys for this page are:

Ministry of Energy Mines and Responsible for Core Review

Appendix O: Computer Memory Notes


A: Introduction
B: Definitions
C: Configuring Your PC
D: Third Party Memory Managers
E: Other Restrictions
F: Config.sys Operation
G: PC Configurations




Every standard PC comes with a set amount of RAM (random access memory), ROM (read only memory), and possibly some extended and/or expanded RAM. The amount of extended and/or expanded RAM on a PC is optional.



(see Figure 1)


Conventional memory (Upper and Lower Memory)

Conventional memory, totalling 1 MB, is split into 640K of lower memory (RAM) and 384K of upper memory (ROM). However, when most people talk about conventional memory, they are referring to the 640K of lower memory.

The DOS operating system was designed to only access conventional memory, specifically the 640K lower memory, reserving the remaining 384K for the ROM. The ROM is used by DOS to support various hardware and system resources such as BIOS, video controllers, etc.

If you have more than 640K of RAM then that excess is called extended or expanded memory. To use the extended or expanded memory you will be required to load one or more memory managers. This will be discussed later on in this document.


Extended memory (XMS)

In general, extended memory is the additional RAM above the 1 MB boundary. The original 8088 and 8086 PCs are not able to utilize extended memory. The 286 and later chip sets contain a new addressing system known as protected mode. The original addressing method is referred to as real mode and can only access up to the 1 MB boundary. Protected mode (also referred to as extended mode) allows the system to access the space above the 1 MB conventional memory. The 286 and later chips are able to switch between real mode and protected mode. Extended memory comes on a minimum chip set size of 256K, so addressing is usually specified in 256K increments. Extended memory is abbreviated XMS (eXtended Memory Specification).


High Memory Area (HMA)

The high memory area is the first 64K bytes of extended memory. This area was tailor made for DOS and its buffers. To load DOS high, specify DOS=HIGH in your CONFIG.SYS file. You will also have to load an extended memory manager such as HIMEM.SYS. When DOS is loaded high so are the buffers, if they ALL fit. If they don't all fit then none of them are loaded in the HMA but are loaded in the conventional memory instead. To get them to fit in the HMA, never specify buffers greater than 40.


Expanded memory (EMS)

The concept of expanded memory was developed by three companies. Lotus, Intel and Microsoft; also known as the LIM group. Expanded memory is also referred to as EMS (Expanded Memory Specification. Expanded memory is only used by programs that are explicitly coded to handle and use the EMS standards. Expanded memory can be thought of as sitting beside your upper memory.

On the older 80286, 8088 or 8086 PCs expanded memory came on special memory expansion cards and the RAM on these cards could only be used as expanded memory. The new 386 and above PCs typically come with extended memory which can be configured dynamically as expanded memory. Older PCs (286 and older) had to have memory expansion boards configured explicitly as either expanded or extended memory and typically could not be dynamically changed during runtime. The 8088 and 8086 PCs could not use extended memory at all, only expanded memory and this could only be used if the application running was designed to used it.


Figure 1: Computer Memory.



Three companies (Lotus, Intel and Microsoft) formed a group to develop the Expanded Memory Specification (EMS) standards. Currently, there are two EMS standards LIM 4.0 and LIM 3.2 (and earlier). The LIM specifications are based on the fact that not all of the space in the upper memory block (the 384K ROM space) is used for hardware or the BIOS. The EMS finds a free 64K gap in the upper memory and sets it up as addressable RAM in expanded memory. The memory manager is required to recognize any DOS application addressing this 64K gap and redirect the addressing to the expanded memory. The memory manager fools DOS into thinking there is something in the 64K gap of upper memory. Since DOS applications can't address memory outside of the conventional memory, the address is still within the upper memory block. The memory manager redirects the address to point to a block of the same size in the expanded memory . The expanded memory manager allows data to be swapped in and out of the 64K gap.

In newer LIM standards, the 64K doesn't have to be contiguous as in the older standards. For a DOS application to use the expanded memory, it must manage the swapping in and out of the recognized upper memory block. The DOS application must recognize when it needs data that is not in upper memory and swap into upper memory the expanded memory block that contains the data. Programs that use the LIM standards can load large amounts of data into the expanded memory and swap the data into upper memory as it is required. As far as DOS is concerned, it is not addressing any additional memory other than the 1 MB of conventional memory. In older PCs, a special card and drivers were required to manage the expanded memory. The card contained the actual additional RAM to be used as EMS and the software to handle the interface with DOS applications. The newer PCs allow extended memory to be configured as expanded memory.




There are several tasks we can do to optimize the configuration of our system. First off I would like to clear up a misconception about configuring extended memory, expanded memory, optimizing upper memory and loading DOS and device drivers into high and upper memory. All of these tasks are distinct, with some being related to others. The misconception is that they are all one and the same; this is not the case.


Configuring Extended Memory

Extended memory can be used on 286 or later PCs. Before you try configuring extended memory, make sure you have extended memory in your system and it is configured to be used as extended memory. As part of configuring extended memory, the high memory area (HMA) will be configured. The HMA is tailor made for DOS and resides in the first 64K of extended memory. In a basic configuration, DOS is loaded totally into conventional memory (the 640K RAM) which uses up memory that could be used by DOS applications.

To configure extended memory and set up the HMA area, you need to place HIMEM.SYS in your CONFIG.SYS file by adding this statement; DEVICE=C:\DOS\HIMEM.SYS. This should be the first item in the CONFIG.SYS file. To load DOS into the HMA area and remove it from conventional memory, add the statement: DOS=HIGH,UMB in the CONFIG.SYS file (we'll talk about the UMB option next). Note, you cannot use extended memory on a 8088 or 8086 and therefore you cannot load DOS high and you cannot use HIMEM.SYS. Also, make sure before you make any changes to your CONFIG.SYS file that you have a system boot disk handy so you can reboot your PC from it if your PC hangs on startup. Every PC is different and some options may be incompatible with your PC.


Optimizing conventional and upper memory

As mentioned in previous sections, standard real mode DOS can address up to the 1 MB boundary (upper and lower memory). Also, not all of the upper memory (ROM) space is taken up by system resources such as hardware devices, BIOS, video controllers, network cards, IO cards, sound cards etc. There are always gaps in the ROM that are not used. If it was possible to write to these gaps in the ROM then device drivers or your applications could use this space and free up memory in the lower 640K of RAM for conventional DOS applications. This is not possible because this space is read only; this is where 386 extended memory managers (EMM) come in. A memory manager can manage these gaps by redirecting DOS to point to a part of extended memory when it thinks it is pointing to one of the gaps in the ROM. DOS still thinks it is addressing in the 1 MB range but is actually redirected and pointing in extended memory. These managed gaps are call Upper Memory Blocks (UMBs).

DOS comes with a standard memory manager called EMM386. The purpose of this memory manager is to manage the ROM gaps as UMBs, to simulate expanded memory and activate a coprocessor chip if required and present. Upper Memory Blocks can only be created and managed on 386 or later PCs. You cannot use this method of optimizing conventional memory on 80286 or earlier PCs.

To optimize the upper memory add the EMM to the CONFIG.SYS file as follows:


The HIMEM.SYS must be installed before you install EMM386.SYS because the system needs to know about the extended memory it is going to use to re-map for creating the UMBs and/or expanded memory. The RAM option configures some extended memory as expanded memory and it creates UMBs in upper memory. Instead of the RAM option you could specify NOEMS. This would create the UMBs in upper memory but not configure any expanded memory. If you don't specify a parameter then only expanded memory will be configured and the UMBs will not be created in upper memory.

The UMBs are all the gaps in upper memory, which are redirected to extended memory so they can be used by DOS device drivers or applications. Typical uses for UMBs are loading DOS device drivers and TSRs into upper memory. To do this use the DEVICEHIGH command for device drivers or the LOADHIGH command for TSRs. This would load the device drivers or TSRs into upper memory freeing up conventional memory for use by conventional DOS applications. UMBs are also used directly by applications specifically designed to do so. If there isn't enough space in the UMBs to load the device driver or TSR then it is placed in conventional memory.


Configuring Expanded Memory

The device statement DEVICE=EMM386.SYS 256 RAM in your CONFIG.SYS file configures your system to use expanded memory. The default amount of expanded memory configured is 256K. If you wish to configure more than 256K then increase the memory parameter (the 256) in the above statement. Increasing this parameter has no effect on your upper or conventional memory usage, it only reduces the amount of free extended memory. If you leave the RAM option off, expanded memory will still be configured but no UMBs will be created. The preferred configuration is to setup as much space as possible for UMBs and to use extended memory instead of expanded. However, some older programs may only use EMS memory. If you do configure your system with expanded memory, the 64K of upper memory it uses reduces the amount of UMB space your system will have by 64K and may limit the number of device drivers you can move from lower memory. Normally, there is less than 96K of upper memory available for both the UMBs and the EMS so use it wisely.




Typically, third party memory managers are far better than the DOS HIMEM and EMM386 memory managers. Usually, only one device driver is required and it should manage everything -- extended memory, expanded memory and the UMBs. A good third party memory manager will allow DOS applications to use the UMBs it creates which is not the case with the DOS version. When using a third party EMM you should not load HIMEM.SYS or EMM386.SYS in your CONFIG.SYS because these will conflict with the third party EMM. Also, do not include the UMB parameter on the DOS= statement; it should be set to NOUMB. The third party EMM will create and manage the UMBs itself. The third party EMM will come with their own versions of the DEVICEHIGH and LOADHIGH commands so don't use the DOS commands to load devices or TSRs high. Some well known third party EMM managers are 386MAX, CEMM, QEMM, and others.




Be very careful when loading TSRs and utilities like SMARTDRV.SYS into UMBs. Loading SMARTDRV.SYS high may conflict with other device drivers and especially with SCSI disk controllers. DOS programs can be easily fooled into thinking there is memory at the gaps in upper memory but most hardware isn't fooled.

When loading DOS and the DOS buffers high (in HMA), all the buffers must fit. If there isn't enough room none of the buffers are loaded in HMA but are loaded into conventional memory instead. To get them to fit in the HMA with DOS, never specify buffers greater than 40. When you're using a disk caching program like SMARTDRV, then it may actually slow down your system if your buffers are set too high. With a disk caching utility you can set the buffers to 10.

In addition to DOS, there are other applications, TSRs, and device drivers that like to use the HMA. If they are allowed to do so before DOS and its buffers are loaded, then DOS and its buffers may not fit into the HMA and conventional memory will be used up unnecessarily. DOS loads itself into the HMA after all the device drivers listed in the CONFIG.SYS file are loaded. Two programs that use the HMA are DesqView and the XMS version of the NetWare driver.

If you are using an older 8086, 286 or even some 386 PCs and have IBM-made expanded memory hardware, DOS 4.0 comes with a driver called XMA2EMS.SYS for setting up EMS at specific locations in upper memory. DOS 4.0 also supplies a driver to emulate expanded memory from extended memory for 386 or later PCs.




DOS first processes the CONFIG.SYS file and then the AUTOEXEC.BAT. The ordering of statements is very important in the CONFIG.SYS file. The DEVICE= and DEVICEHIGH= commands load the device drivers into memory, if there's room, in the same order as they appear in the file. Likewise, for the INSTALL= command, all TSRs are loaded in the order that they are specified but only after all the device drivers are loaded. When the CONFIG.SYS file is being processed there isn't a PATH set yet and there is no command interpreter so you have to specify full path names and file extensions. The CONFIG.SYS file is processed in several passes, as follows:

  1. On the first pass DOS just examines the file and make a few notes.
  2. On the second pass DOS loads all the device drivers in the order that they appear. At the same time it records all the information provided on the lines: BREAK, BUFFERS, COUNTRY, DOS, FCBS, FILES, LASTDRIVE, SHELL, STACKS, SWITCHES, etc. At the very end of this pass, DOS tries to install itself into the HMA if DOS=HIGH is specified and it creates all the memory buffers for BUFFERS= and STACKS= .
  3. On the third pass DOS goes through the file again and loads all the memory resident programs, in the order that they appear using the INSTALL= statement.
  4. At the end of the last pass, DOS starts the command shell COMMAND.COM or the one named in the SHELL= statement. As part of the shell startup, AUTOEXEC.BAT is executed.



8088 or 8086 PCs

The only relief from memory problems on these platforms is to try installing expanded memory hardware. The memory can only be used as expanded memory and the hardware must come with its own expanded memory manager. You cannot use extended memory, load DOS high, or set up UMBs to load device drivers high.


80286 PCs

This platform supports both expanded and extended memory but it doesn't allow the use of UMBs. You can load DOS high but you can't load any device drivers or TSRs into UMBs (upper memory). To configure extended memory you can load HIMEM.SYS and load DOS high by setting DOS=HIGH but you will have to get a special third party expanded memory manager to configure expanded memory (EMS). The memory manager should come with the expanded memory hardware. The EMM might conflict with HIMEM.SYS, so the HIMEM.SYS might have to be replaced with one that is compatible.


80386 and higher performance PCs

On these platforms, you will be able to use all the optimizing tools listed above. With HIMEM.SYS you can setup extended memory, use EMM386.SYS to setup the UMBs, and configure expanded memory. And with the DOS=HIGH,UMB statement manage the UMBs and load DOS and its buffers into the HMA.


Notes prepared by Ben Kunka, Sierra Systems Consultants Inc., May 1995