Classic Computer Magazine Archive COMPUTE! ISSUE 144 / SEPTEMBER 1992 / PAGE S4

How to make the most of your computer's extra memory. (Compute's Getting Started with Power Computing)
by Mark Minasi

It's not unusual to buy a computer nowadays with four or more megabytes of main system memory. Four megabytes is a lot by some measures, but not so much by others. (Windows, for example, can swallow eight megs and come back for more). What can you do with all of that memory? Here are two suggestions: a disk cache and a RAM drive.

Cache and Carry

Disk caching will yield quick and impressive performance benefits. If you're using DOS 5.0, or any version of Windows, you already have a simple disk cache program called SMARTDRV.SYS renamed SMARTDRV.EXE IN Windows 3.1). The basic idea of a disk cache is this: You store long-term data on a disk and short-term data in your computer's RAM. Disks have large capacity, but RAM is very fast.

Prior to using any disk data--either a program or data file--your computer must read the data f rom the disk into memory; computer programs must work with data in RAM. (Why not keep all data in RAM? Two reasons: RAM is volatile, meaning that it loses its contents when power is interrupted, and RAM is expensive. While it's not unusual to buy A 200MB hard drive for about $500, the same amount of RAM--200MB--would cost 10,000.)

A disk cache is a TSR program that leverages memory's speed against disk's capacity, keeping copies of the most-used data in memory. The cache monitors your disk use, learning what areas of the disk you use most. The cache then pre-loads those areas to memory and watches any attempts by DOS to read data from the disk. If DOS wants to read data from the disk that the cache already has in its memory area, the cache intercepts DOS, providing it with the data and keeping it from reading the disk unnecessarily.

Simple as that sounds, it's tremendously effective. If you can spare it, 2MB is a nice amount for a disk cache, although even 256K will provide immediate gratification.

Virtual Disk

Another use for memory is a RAM Disk. A RAM disk takes a quantity of memory and makes it appear to be a new disk drive, and a quite fast one at that. While the idea of a very fast disk is appealing, there are two drawbacks. First, you can't make the disk very big, as you probably don't have tens of megabytes of RAM to toss around. Second, the disk is volatile, so you'll lose everything in the RAM disk when you turn the machine off.

Here's a perfect use for a RAM disk. Some programs, including DOS and Windows, create temporary files for their own use. You can specify where those files should go. In the case of DOS and Windows, it's determined by the SET TEMP= command. Suppose you have two megabytes of RAM that you can spare for a RAM disk; you'd include this line in your CONFIG.SYS after HIMEM.SYS: DEVICE =

C:\DOS\RAMDRIVE.SYS

2048 /E

When you reboot your system, you'll see a message that looks something like "Microsoft RAMDrive version 3.06 virtual disk D:," followed by some other details. That line tells you that the drive letter of the new RAM drive is drive D:. Now go back and add the line SET TEMP=D:\ to your AUTOEXEC.BAT, and DOS, Windows, and a number of other programs will use the fast RAM drive, rather than a slower actual disk drive, to store their temporary files. The result: a much improved response from your applications. If you're going to do this with Windows, however, make sure that you have at least three megabytes to spare, because Windows can crash if it fills up its temporary drive. You may have to experiment to find the correct value for your system.