home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
dirs
/
cachedisk_462.lzh
/
CacheDisk
/
Cache-Disk.doc
< prev
next >
Wrap
Text File
|
1991-03-08
|
9KB
|
214 lines
Cache-Disk
----------
License Agreement
-----------------
Cache-Disk and the entire contents of the archive it came in
are (C) copyrighted 1991 by Terry Fisher. You may not use,
modify, or distribute them except as expressed by this license
agreement.
You may not disassemble, reverse engineer, or in any way
modify the programs contained in the archive.
Cache-Disk is distributed as shareware. Permission is
granted to distribute Cache-Disk provided
1) the entire contents of the archive it came in are
distributed with it.
2) it is not uploaded to any bulletin board services that
claim ownership of the all uploaded software.
3) it is not distributed for profit without my written
permission.
4) if it is included in any collection of freely
distributable software, the charge for the disk may not
exceed twice the current rate charged by Fred Fish.
Fred Fish is granted explicit permission to include the
contents of the archive in his library of freely
distributable software.
5) it is not distributed with any commercial program without
my written permission.
If you try Cache-Disk and, after two weeks, decide to use
it, please become a registered user by sending a cheque or money
order for $25 to:
Terry Fisher
102-401 Hazel St.
Waterloo, Ontario, Canada.
N2L 3P7
Phone #: (519) 885-2785
All registered users will receive one free upgrade. See the
section on future improvements below. Further upgrades will be
available at a cost of $5.
Introduction
------------
The Amiga's multi-tasking operating system makes the Amiga
one of the most flexible personal computers currently available.
Unfortunately, the power provided by this multi-tasking operating
system is greatly reduced when multiple processes try to access
resources such as the floppy disk drives simultaneously. The
usual result of disk access by multiple processes is thrashing.
Almost everyone who owns an amiga has experienced this thrashing,
and until now have had to put up with it. Now, Cache-Disk
reduces disk thrashing to a minimum.
How Cache-Disk Works
--------------------
When a program requests a sector to be read from a floppy
disk, the Amiga's trackdisk.device always reads the entire track
containing the requested sector from the disk. By performing
reads in this fashion, the trackdisk.device creates a miniature
cache in that if the next sector requested is on the same track,
no disk activity is required. In most cases, files are stored
sequentially on the disk and the above cache provides a
significant optimization to disk access.
Unfortunately, when two or more processes are reading from
the disk, the requests are rarely sequential. Each disk read or
write requires the trackdisk.device to flush its single track
cache to read the track containing the data for the next read
request. This freshly read track is often flushed almost
immediately, to recover the track that previously occupied the
cache. As more processes are added to the cycle, the situation
becomes even worse.
Cache-Disk patches the trackdisk.device and intercepts all
read and write operations. Whenever cache-disk receives a
request for a sector on the disk, it requests that the
trackdisk.device read the entire track. The contents of this
track are then placed in one of cache-disks buffers. Any further
requests for data on this track are performed out of cache-disks
buffer. If a request for another track is received, that entire
track is placed in another cache-disk buffer. Now, access to
either of these tracks requires no activity.
Since memory is often a limited resource, cache-disk lets
the user specify the number of buffers it should allocate for
each floppy disk drive. Once all buffers have been filled, the
contents of the least recently used buffer are either written to
disk (if the buffer has been modified by a write operation), or
discarded to make room for a new track. Substantial performance
increases can be realized from as few as two or three buffers,
but the more buffers made available to cache-disk, the more
noticeable the speed increase.
Cache-Disk flushes modified buffers whenever it receives a
CMD_FLUSH command. The Amiga automatically generates such a
request after approximately 2 seconds of disk inactivity.
A Few Benchmarks
----------------
The results of a few benchmarks to demonstrate the speed
increase realized by using cache-disk are listed below. In all
cases, the benchmark was performed with the cache-disk buffers
empty. Times were recorded without cache-disk installed, and
with cache-disk installed with 2, 5, 10, and 20 buffers.
1) Copying the Workbench disk. The first of these
benchmarks was the simple copying of the standard
Workbench1.3 disk from drive 0 to a freshly formatted
diskette in drive 1 using the AmigaDOS 'Copy' command.
The same number of cache-disk buffers were used for
source and destination disk drives.
2) File creation. 200 empty files were created on a freshly
formatted diskette in drive 0.
3) Multi-process access. To perform this test, a program
which sequentially read each sector on the disk in drive
0 was used. This program, diskscan, and a batch file
which was also used to perform the test can be found in
the test subdirectory.
Cache-Disk Test 1 Test 2 Test 3
Buffers (seconds) (seconds) (seconds)
---------- --------- --------- ---------
0 669 418 1004
2 594 419 180
5 307 62 174
10 295 48 174
20 276 30 123
How to use Cache-Disk
---------------------
Cache-Disk may be run form either the Workbench or the CLI.
When run from the CLI, Cache-Disk accepts command line arguments
of the form dn=buffers where
n is the drive number
buffers is the number of buffers to allocate for this
drive. Note that each buffer uses close to 6K
of chip memory.
eg. To use Cache-Disk with 5 buffers for drive 0 and 10
buffers for drive 2, the command is "Cache-Disk d0=5 d2=10".
Cache-Disk detaches from the CLI, so it is not necessary to "run"
it.
To disable Cache-Disk once it has been executed, simply
execute it again.
When running Cache-Disk from the Workbench, the number of
buffers is specified by using the "Info" menu item, and setting
tool types of the form "DRIVEn=buffers" where
n is the drive number
buffers is the number of buffers to allocate for this
drive. Note that each buffer uses close to 6K
of chip memory.
Cache-Disk is then enabled by double-clicking on its icon.
Double-clicking on its icon a second time causes Cache-Disk to
terminate.
Cache-Disk Features
-------------------
- Buffers disk reads and writes for maximum speed gain.
- Detaches from the CLI, and can be run from the Workbench.
- Can be turned off by re-running the program.
- User setable number of buffers for each drive.
- Works with the Messy-Dos (MSH) File System (another
wonderful piece of shareware software).
Known Problems
--------------
- Uses precious chip memory.
- Does not support the AbortIO() function.
- Disabling Cache-Disk while there is disk activity may
corrupt the diskette. Always wait for disk activity to stop
before disabling the cache.
Planned Enhancements (to be included in next release)
-----------------------------------------------------
- Buffer allocation from Fast RAM.
- Support for hard-disks.
- More efficient flushing algorithm.
- Fix to support the AbortIO() function.
If you find a problem with Cache-Disk which is not listed,
please inform me at the address given above.
Disclaimer
----------
I provide no warrantee, either written or expressed as to
the usability of Cache-Disk. I am not responsible for any damage
or loss of data caused directly or indirectly by its use.
Trademarks/Copyrights
---------------------
Amiga (tm) is a registered trademark of Commodore-Amiga Inc.
AmigaDOS (tm) is a registered trademark of Commodore-Amiga Inc.
Workbench (tm) is a trademark of Commodore-Amiga Inc.
MSH (C) is copyright Olaf Seibert.