RAMDrive is an MS-DOS utility that lets you use memory (RAM) to create a virtual disk. This was a good method for improving performance when applications were run from a floppy disk. You could create a virtual drive and copy the application to this drive. Then, by running from the virtual drive, you would experience a dramatic increase in performance. The problem with this system is that each time you turn the computer off and then back on, you have to re-create the drive and copy the files. A RAMDrive is the opposite of a swap file. It is RAM that thinks it is a drive. As with any drive, RAMDrive has a drive letter, and the user can read, write, copy, and delete to and from it.
Installing a disk cache is one of the best methods for improving the performance of Windows. A disk cache is similar to a memory cache, except that it works between the mass-storage devices (hard disk drives, CD-ROM drives, and floppy disk drives) and RAM. Most applications use the same files over and over again. By creating a disk cache, the computer takes a piece of extended memory and uses it to hold the repetitive files. Because access to RAM is faster than disk access, the overall performance of the system improves. The most popular disk cache is SMARTDRV.EXE which comes with MS-DOS.
TIP
Using disk caching can be problematic: it is the exact opposite of virtual memory. Disk caching uses memory to improve performance, and virtual memory uses disks to improve performance. As a computer technician, you will have to strive to achieve the best compromise between the two, based on the situation.
Tweaking SMARTDRV.EXE
SMARTDRV.EXE can be run by simply adding it to the AUTOEXEC.BAT file, but it can be made to perform even better by adding a few switches. The performance of the disk cache is measured by its hit rate, the percentage of time that data requested by the operating system is already in the cache; therefore, it doesn't have to be read from the hard disk drive. A good hit rate will be between 75 and 90 percent. A good SMARTDRIVE configuration (in the AUTOEXEC.BAT file) looks something like this:
SMARTDRVE a- b- 1024 256 /B:32
"a- b-" means not to cache the floppy drives (floppy disks usually don't contain files that are repeated often).
"1024 256" sets the size for the cache. The rule for cache size is to make it equal to one-quarter the size of the total RAM (up to 2 MB), as shown in the following table. Performance gained by using SMARTDrive tends to drop off after 2 MB.
RAM (MB) | Cache |
---|---|
<1 | None |
1 | 256 KB |
2 | 512 KB |
4 | 1 MB |
8 | 2 MB |
16 | 2 MB |
>16 | 2 MB |
"/B:32" increases the look-ahead buffer if the hard drive is maintained in a defragmented state. The default value is 16 without the /B option.
Other SMARTDrive options are shown in the following table.
Switch | Description |
---|---|
/E | Changes the number of bytes processed by SMARTDrive. |
/L | Loads low-by default, SMARTDrive loads in high memory. This switch forces it to load into low memory. |
/N | Doesn't wait for the C prompt upon lazy write. This is very risky because the system can return to the C prompt without flushing the cache. If the computer is turned off, data can be lost. |
/Q | Quiet mode-does not show anything on the screen when loading SMARTDrive. |
/U | Does not load the CD-ROM cache. |
/V | Verbose mode-shows everything on the screen when loading SMARTDrive. |
/X | Turns off lazy writing. A lazy-writing disk cache stores saved data in the cache and waits until the system has slowed down before writing to the disk. The file is not really saved, and if the computer is turned off for any reason before the data is actually saved, data will be lost. |
A few switches also enable SMARTDrive tools. When SMARTDrive is running, enter the following at the MS-DOS prompt for the listed result:
Command | Result |
---|---|
SMARTDRV /S | Returns the current hit rate. |
SMARTDRV /R | Forces immediate flush of all lazy-write data in cache. |
SMARTDRV /R | Flushes and restarts the cache. |
Vcache
Windows 3.11 and Windows for Workgroups include a replacement for SMARTDrive. This replacement is a protected-mode disk cache called "Vcache." Vcache is set by making changes in the Virtual Memory (Change button) window, found in the Virtual Memory Setup dialog box (the 386 Enhanced icon in the Control Panel). Vcache runs up to eight times faster than SMARTDrive. The only disadvantage is that it does not cache the CD-ROM. However, it does run with SMARTDrive (simply configure SMARTDrive to cache only the CD).