[MEGS-O-RAM]

by

Al Wong



Introduction

I had just upgraded my new notebook computer from 8 megabytes (MB) to 40 MB of RAM (a Pentium 133Mhz with DOS 6.22 and Windows For Work Groups (WFWG) 3.11). While I was very happy about this, I didn't know how to optimally configure all this lovely memory! Researching the Web did not reveal any articles that describe solutions to this problem! I thought this was very odd. Inquiring in Usenet, I discovered this problem can have more than one answer depending on how you use your computer.

This is a description of how I determined my "best" memory configuration. It may not be the best configuration for everyone. My main purpose is to describe the different considerations involved with having lots of memory. Hopefully this article will help someone else with a similar problem. I wish this page existed when I was looking for information.

Most of the information in this article was derived from reading the Microsoft user manuals for DOS 6.22 and WFWG 3.11 and after much experimenting and observation. Special thanks to Bill Clay (wpclay@arl.mil) for clarifying DOS and Windows cache interaction.

This article is intended for 80486 machines or better, DOS 6.22 or better, Windows 3.1 or WFWG 3.11. This information may not be accurate for less powerful machines or earlier operating systems. And of course, your mileage may vary.

Definitions

Before jumping into the configuring issues, a few definitions about memory to make sure everyone is on the same (Web) page. I get confused about PC memory terminology myself. This is takened from the Microsoft MS-DOS 6.22 Concise User's Guide:

Conventional Memory Up to the first 640K of memory on a computer. All MS-DOS-based programs require conventional memory. (K=kilobytes.)
Upper Memory Area The 384K of memory above your computer's 640K of conventional memory. The upper memory area is used by system hardware, such as your display adapter. Unused parts of the upper memory area are called upper memory blocks (UMBs).
Extended Memory (XMS) Memory beyond 1 MB on computers with 80286 or higher processors. Extended memory requires an extended-memory manager, such as HIMEM.
High Memory Area (HMA) The first 64K of extended memory. On a computer with extended memory, Setup conserves conventional memory by installing MS-DOS to run in the high memory area.
Expanded Memory (EMS) Memory in addition to conventional memory that some MS-DOS-based applications can use. Expanded memory is installed on an expanded memory board and comes with an expanded-memory manager. (This article will not address expanded memory (Pun intended). Most DOS applications do not use it now.)
So any memory installed after the first MB of memory is considered extended memory. Since I upgraded to 40 MB of RAM, this means 39 MB is extended memory.

Does the Computer Recognize the Memory?

The first thing I did after the new memory chips were installed is make sure the computer recognizes the new memory. On bootup, the computer automatically does a memory test and counts the memory addresses tested. Watching this carefully, I noted the count was approximately 39 MB. Whee!

Another way to check is to run the DOS MEM command. The output results from MEM displays the amounts of conventional, upper and extended memory.

What is the Purpose for This Memory?

Before you can optimally configure your memory, you must ask yourself for what purpose do I need the extra memory? What applications do I use often that are memory hogs? Are they DOS or Windows programs? Aim your memory configuration so these applications can take full advantage of the extra memory.

Configuring Memory

After I had confirmed the computer recognized the newly installed memory, I wanted to make sure I had as much free conventional memory as possible upon bootup. All applications need conventional memory to load and run properly.

I hand-optimized the various drivers on my notebook and managed to free about 68K more than the factory settings. Then I tried the DOS MemMaker. It squeezed out 2K more of free conventional memory. I discovered it can figure out the minimum size of each driver to be stored in the upper memory blocks. So MemMaker does work but 2K isn't that dramatic.

One thing to note. Watch the actions of other device drivers. On bootup, the driver software for my Teac CD-ROM drive automatically allocates 25% of extended memory to be used as a CD cache by default. For a while, I was wondering why about 10 MB of extended memory was taken up! I disabled the CD cache and had 39 MB free again.

CONFIG.SYS

This is the first file read on bootup. There are a few basic lines in this file that must be present to use all of your computer's memory.

HIMEM.SYS: Extended Memory and HMA Manager

This driver manages program access to the extended memory and the high memory area. The first line in your CONFIG.SYS file should be loading this driver. The line I use is:

DEVICE=C:\DOS\HIMEM.SYS /VERBOSE

EMM386.EXE: Upper Memory Area Manager

This driver provides access to the upper memory area. The second line in the CONFIG.SYS file should be loading this driver. The line I use is:

DEVICE=C:\DOS\EMM386.EXE NOEMS /VERBOSE

The NOEMS option is to disable program access to expanded memory. So EMM386.EXE is mainly used to provide access to the upper memory area.

DOS Command

There are two DOS commands that should be the third and fourth line in the CONFIG.SYS file:

DOS=UMB
DOS=HIGH

The first line, DOS=UMB, allows DOS to manage the upper memory blocks that were created by EMM386.EXE. The second line, DOS=HIGH, allows DOS to attempt to load part of itself in the high memory area.

DEVICEHIGH

The other thing I did is to use DEVICEHIGH as much as possible to load the other device drivers into the upper memory area.

AUTOEXEC.BAT

This is the other file read on bootup. Depending on your hardware configuration, there might be other drivers that will arbitrarily allocate memory. For example on my system, my Teac CD drive automatically to allocates 25% of available memory by default. Reading the documentation for each driver and running the DOS MEM command helped me determine what program was allocating memory.

Apart from other device drivers, there is only one that comes with DOS and, which I discovered, is one key for configuring memory allocation. What the manuals don't tell you is there should be two separate memory configurations, one for DOS and one for Windows.

SMARTDRV.EXE: The Disk Cache for DOS

At first, it wasn't clear to me if SMARTDRV was acting as a RAM drive, a disk cache or both! I guess the SMART and DRV in SMARTDRV implied to me it was a smart RAM drive. It was too much to hope for. I discovered later SMARTDRV just caches the hard disk but will not allow DOS programs to execute from it. So the SMART and DRV in SMARTDRV implies it's a smart cache for the hard drive. So programs and data are cached by SMARTDRV but still need to be transferred into conventional memory to be executed.

For fun, I tried allocating 39 MB with SMARTDRV but that didn't work. After much testing, I determined SMARTDRV will allocate a maximum cache size of 37,487K. This left about 3 MB free. Some large DOS programs wouldn't load.

SMARTDRV.EXE allocates the disk cache for DOS. There are two basic numeric arguments for SMARTDRV.EXE. The first one is the cache size (in Kilobytes) when in DOS and the second one is the cache size when in Windows.

For DOS, I also discovered the SMARTDRV disk cache will optimally work with a 4 MB to 8MB allocation while in DOS. The rest of extended memory could be used by a RAM drive while in DOS.

For Windows, the SMARTDRV cache should be minimized and the Window's disk cache should be used. SMARTDRV will cache for Windows too but the Windows cache is faster. Also the SMARTDRV cache should be minimized so it doesn't conflict with the Windows cache. This is the line I use:

C:\DOS\SMARTDRV.EXE 8192 128 /X /S

This allocates an 8 MB disk cache (8,192K) while in DOS and a 128K cache while in Windows. The 128K cache is for caching the floppy drive which the Windows cache evidently does not do. This works well if Windows has its own disk cache.

The /X option makes sure SMARTDRV does not cache writes to disk. The /S option tells SMARTDRV to display its current status.

For machines with 6 MB or more of extended memory, SMARTDRV will automatically allocate 2 MB for both its DOS cache and Windows cache. Usually, this is not optimal. If you are in Windows and if a disk cache is allocated under Windows, disk accesses will be cached by both the SMARTDRV disk cache and the Windows disk cache!

Windows For Work Groups 3.11

The steps I describe here are for WFWG 3.11 but are valid for Windows 3.1 too. (Before configuring anything in Windows, it is a good idea to do a SCANDISK and DEFRAG /F in DOS first.) It appears Windows is smart enough to recognize extended memory and grab all unallocated extended memory for itself when it starts up. There are at least 3 things to do to configure memory in Windows. Find the Main program group and go to:

Main | Control Panel | Enhanced | Virtual Memory | Change

32 Bit File Access

Click ON the 32 Bit File Access Box. This will enable 32 bit file access which is faster than 16 bit file access (the default).

Permanent Swap File

To enable 32 bit file access, you will probably need to create a permanent swap file too. I created a 10 MB (10,240K) swap file. With 40 MB of RAM, I found Windows almost never uses it.

By the way, it is not a good idea to use part of your RAM for a swap file (from a RAM drive). This robs memory from other Windows applications that probably need it.

Windows Disk Cache

Type the cache size (in kilobytes) in the Cache Size box to allocate a disk cache in Windows. I use 4MB (4,096K). This allows Windows to create a 4 MB disk cache on startup. I found this is a good cache size. This cache gets deallocated when you exit Windows. You will need to restart Windows after making the above changes.

This will leave about 32-34 MB free for Windows to allocate for itself and dole out to other Windows programs during the current Windows session. This is plenty for almost all Windows applications.

Summary

  1. Make sure the computer recognizes the extra memory.
  2. Note which application(s) need the extra memory and configure your memory to that.
  3. Tweak conventional memory to maximize it on bootup. Use HIMEM.SYS and EMM386.EXE.
  4. Tweak extended memory for DOS and for Windows. Use the SMARTDRV.EXE cache for DOS and the Windows cache for Windows.

Now that you have configured your WFWG 3.11 computer memory, perhaps you would like to put it on your local network. Why not?

My Writings


Write to me
Last updated : July 16, 2004
Copyright 1996-1997 by Al Wong, Los Angeles, California, USA