Dec 092017
A quick and dirty disk cache program.
File CACHE3.ZIP from The Programmer’s Corner in
Category HD Utilities
A quick and dirty disk cache program.
File Name File Size Zip Size Zip Type
CACHE.DOC 4295 1710 deflated
CACHE3.ASM 26467 7645 deflated
CACHE3.COM 1043 884 deflated
TPCREAD.ME 199 165 deflated

Download File CACHE3.ZIP Here

Contents of the CACHE.DOC file


CACHE establishes disk caches. The default cache is for
all PC, XT, and AT real (not virtual) drives other than the AT hard

Format: [d:][path]CACHE [[size] disk]

Remarks: Specify the parameters:

[d:][path] before CACHE to specify the drive and the path that
contains the CACHE command file.

[size] Size of the cache in 512 byte sectors. This number must be
between 24 and 124, or it will be adjusted. The default is 64.
The storage occupied by the cache is less than 256 bytes plus
518 bytes per sector.

[disk] Disk to be cached, if a single disk cache is being allocated.
The default is to cache all real disks, but there may be occasions
where it is desirable to avoid cacheing a specific disk, or a
cache larger than 62K bytes is desired.

CACHE can be called more than once to create a larger cache or
set individual disk caches for each disk. The caches are searched in
reverse order of allocation. If you are allocating more than one cache
allocate the most heavily used cache LAST. If you are allocating
a general cache, it makes sense to allocate it FIRST in most cases,
so it becoems a "cache of last resort". The overhead for skipping
individual caches is small, but the overhead for a search failure is

Only single sector reads and writes are cached. Therefore, loading
large programs will not be affected. What will be affected are
databases with records smaller than 512 bytes, batch files, and
source files for language processors that scan the input file
more than once. The disk file directory and file allocation tables
are cached, and always resident once read from disk. Other files
have their sectors purged if they are not frequenly accessed.

When the cache is allocated, its segment location is listed out.
The DOS DEBUG command can be used to read out data areas of interest,
while the cache is running. The data areas start at offset 114h.
They are each one word (two bytes) long:

offset data

114 Cache size in sectors
116 Total Number of disk I/O's
118 Number of cache hits
11A Number of free slots in cache

Remember that these numbers are hexadecimal and stored low order byte
first, so the default size of 64 is stored as:

40 00

To access this data, first write down the sector address typed
out when CACHE initializes. Let's say it is 909. Type the following

d 909:114
(analyze the displayed data)

Typically, the about half of all disk I/O's will result in cache hits.
All data in cache is backed up on disk immediately, so only disk reads
are assisted by cache. The cache should be sized so that you will not
reduce the number of free slots to zero, the first time you perform
your most frequent operation. Size your cache by booting your
computer, issuing the CACHE command for a 124 sector buffer,
performing your "typical" batch file, compile or data base access,
running DEBUG, determining how much CACHE remains free, and downsizing
as required. If you can't allocate a single large cache that does the
job, then create caches for heavily used disks.

Place the CACHE commands first in your AUTOEXEC.BAT file because CACHE
will make it run faster. Also notice that DIR commands will run
without pausing, and the disk will stop running about halfway through
the second time it is issued.

From: Quick and Dirty Software, Inc.
Origional logic by Steven Holzer of PC magazine (8/85)

 December 9, 2017  Add comments

Leave a Reply