Article ID: 77083 - View products that this article applies to.
This article was previously published under Q77083
You have set up your computer to load programs or device drivers into upper memory blocks (UMBs). Now you want to make sure you are making optimal use of those UMBs so that you can run as many programs in the upper memory area as possible.
This article provides techniques for making the best use of your computer's upper memory area. To use these techniques, you should be familiar with the information on pages 313-330 of the Microsoft MS-DOS "User's Guide and Reference" for version 5.0, which explains how to load programs into UMBs. In particular, pages 327 and 329 provide some basic information about optimizing your use of UMBs.
This article explains the following optimization techniques:
STARTING EMM386 WITH THE NOEMS SWITCH INSTEAD OF THE RAM SWITCHIf you do not use programs that require expanded memory (EMS), start EMM386 with the NOEMS switch. Doing so can give you an additional 64K of UMBs, because the NOEMS switch instructs EMM386 not to create an EMS page frame in the upper memory area. If you start EMM386 with the NOEMS switch, programs will be unable to use expanded memory, even when they are running with Windows.
To start EMM386 with the NOEMS switch:
FINDING THE BEST ORDER FOR LOADING DRIVERS AND PROGRAMS INTO UMBSWhen you start a program using the DEVICEHIGH or LOADHIGH commands, MS-DOS loads that program into the largest remaining UMB, even if it would fit into a smaller UMB. Because of this, the order in which you load programs into UMBs is important when trying to optimize your use of the upper memory area. You will need to experiment to find the best order for your system.
Creating a Startup DiskBefore you start optimizing, create a startup floppy disk that contains a backup copy of your CONFIG.SYS and AUTOEXEC.BAT files. To do so, insert a formatted floppy disk into drive A and type the following commands:
sys c: a:Having this startup disk will enable you to experiment more freely; if you change your CONFIG.SYS or AUTOEXEC.BAT file and your computer locks up when you restart it, just insert the backup disk in drive A and press CTRL+ALT+DEL.
copy c:\config.sys a:\
copy c:\autoexec.bat a:\
Finding the Best Load OrderWhen loading programs high, MS-DOS loads each program into the largest remaining UMB, even if it would fit into a smaller UMB. Therefore, the order in which you load programs into UMBs is important. In general, when loading programs into the upper memory area, load larger programs before smaller ones. However, this simple load-the-biggest-first method might not always be the most efficient. Sometimes, you might have to juggle the load order to get the most out of the upper memory area.
For example, suppose you want to load the following three programs into UMBs:
Suppose you have two UMBs available; one is 4K in size; the other is 3K in size. (You can find out the sizes of individual UMBs by issuing the MEM /P command. For more information, see page 519 of the "User's Guide and Reference.")
PROGRAM1.EXE 2K PROGRAM2.EXE 2K PROGRAM3.EXE 3K
As you can see, PROGRAM3.EXE is the largest, at 3K. If you load PROGRAM3 first, MS-DOS puts it into the largest UMB (4K). Since PROGRAM3 doesn't use the entire 4K of space in that UMB, an additional kilobyte of memory is left unused. The next program, PROGRAM1 (2K), fits into the 3K UMB, again leaving an unused kilobyte of memory. However, PROGRAM2 also needs 2K of contiguous space, and will not fit into either of the 1K UMBs that remain. This is an example of when it's not as efficient to load the largest program first.
A more efficient method would be to load PROGRAM1 (2K), then PROGRAM3 (3K), and then PROGRAM2 (2K). Then, all three programs would fit into UMBs. MS-DOS would load PROGRAM1 into the 4K UMB, leaving 2K of space. PROGRAM3 would then fit into the next largest UMB (3K), and PROGRAM2 would fit into the 2K remaining.
Figuring Out a Program's Memory RequirementsA program's memory requirements determine what size UMB it needs. Unfortunately, it can sometimes be difficult to figure out what size UMB a particular program needs, since this depends on how and when the program allocates memory. In general, programs fall into one of two groups:
Program Name Size of UMB It Needs ------------------------------------ ANSI.SYS File size DISPLAY.SYS Size while running DRIVER.SYS File size EGA.SYS File size MOUSE.COM File size MOUSE.SYS File size PRINTER.SYS Size while running RAMDRIVE.SYS Size while running SMARTDRIVE.SYS Size while running SETVER.EXE File size APPEND.EXE Size while running ASSIGN.COM Size while running DOSKEY.COM Size while running FASTOPEN.EXE Size while running GRAFTABL.COM File size GRAPHICS.COM Size while running KEYB.COM File size MIRROR.COM Size while running NLSFUNC.EXE File size SHARE.EXE Size while running
Juggling the Load Order Between Your CONFIG.SYS and AUTOEXEC.BAT FilesMost device drivers are loaded from your CONFIG.SYS file, and most memory-resident programs from your AUTOEXEC.BAT file. MS-DOS processes your CONFIG.SYS file first and then executes the commands in your AUTOEXEC.BAT file. This limits your ability to manipulate the load order of your device drivers and programs, since the device drivers in your CONFIG.SYS file will always load before the programs in your AUTOEXEC.BAT file.
The following tips can help you balance the use of UMBs between device drivers and memory-resident programs:
ADJUSTING EMM386 TO PROVIDE MORE UMBSYou can adjust EMM386 to allocate additional space in the upper memory area. (This is particularly useful if you have to start EMM386 with the RAM switch to make expanded memory available to programs.) First, carry out the steps in Procedure 1. After carrying out Procedure 1, if you still cannot load programs and device drivers into UMBs, carry out the steps in Procedure 2.
Procedure 1: Including Specific Portions of the Upper Memory AreaCertain addresses in the upper memory area are normally reserved for use by hardware and video drivers; EMM386 does not usually make these areas available as UMBs. However, on many systems, the hardware and video drivers do not use all the reserved memory addresses. The remaining addresses can be included by EMM386 for use as UMBs. To instruct EMM386 to include these unused areas, you use the I switch after the DEVICE command that starts EMM386.
To allocate additional space in the upper memory area for use as UMBs, follow these steps:
Procedure 2: Reducing the Space Set Aside for Use with Expanded MemoryStarting EMM386 with the RAM switch makes fewer upper memory blocks (UMBs) available than starting it with the NOEMS switch. If programs or device drivers do not load into UMBs when your computer starts, there might not be enough UMBs to run those programs. This is because using the RAM switch sets aside 64K of the upper memory area for use with expanded memory. The remaining UMBs might not be large enough to run your programs, even if you were able to include additional addresses by following Procedure 2.
You can instruct EMM386 to set aside 16K of the upper memory area, rather than 64K, for use with expanded memory. This makes more UMBs available, but programs that use expanded memory might run less efficiently. Follow these steps:
If your programs and drivers still do not load into UMBs, it is possible that your system simply does not have enough UMBs available to run those programs. See your computer's hardware documentation for information about which addresses in the upper memory area are in use; contact Microsoft Product Support Services for further assistance.
See the following pages in the "User's Guide and Reference" for additional information:
Article ID: 77083 - Last Review: November 16, 2006 - Revision: 1.1
Contact us for more help
Connect with Answer Desk for expert help.