SmartCache v1.77a.02.17.93 Copyright © 1994 by Thomas J. Czarnecki All Rights Reserved "SmartCache" is a small 100% assembly language program that patches itself into the 'trackdisk.device' to provide a cylinder 'Caching' mechanism for all the floppy disk drives (including the new HD floppy drives) you have connected to your Amiga. The result is a huge increase in overall floppy performance at the small cost of using your excess memory! ---------------------------------------------------------------------- LEGAL NOTICE This program is Copyrighted and may only be (re)distributed in a non-commercial manner, such as PD/Shareware disks or BBS's, provided that the distribution is complete and unmodified in any way. Also, this program is for personal (non-commercial) use only, and may NOT be used in any other form or manner. There is no warranty on this program. I disclaim any and all responsibility for any damages that use of this program may cause, by direct or indirect use. If you have a commercial project that could benefit from this program, please contact me, I would welcome all inquiries! ---------------------------------------------------------------------- I wrote this program because I was tired of hearing the grinding that occurs when I use my floppy drives. My reasoning was that if I stored (cached) the cylinders that the drive kept accessing the most that I would stop most of the back-forth movement of the drives heads, thus stopping most of the grinding! It works great, not only is the head grinding reduced, but there is a large decrease in access time! The more the drive is accessed the better the results are. Before writing this program I tried using the 'AddBuffers' command, but found that you have to supply buffers to each drive and that on pre 2.0x systems that the buffers use precious Chip memory. I wanted a system that shared all the buffers, many times I do NOT even use my second drive and do NOT what to waste memory on unused buffers! Also, I wanted a system that used my excess Fast memory first, NOT my precious Chip memory! Also 'AddBuffers' only caches the requested blocks (NO prefech) which is NOT efficient since there are many other blocks near the requested one on the same cylinder (with NO head stepping!) What the user does is startup 'SmartCache' with the total amount of Caches allowed (for all the drives) and 'SmartCache' will take it from there by caching the most used cylinders so that repeated access to those cylinders will be from memory! I decided to cache whole cylinders at a time because the slowest element in the floppy drive system is the stepping of the read/write heads so by caching whole cylinders I improve the odds of stopping a head movement operation by prefeching the blocks near the request ones on the same cyclinder. A program such as this is very memory hungry so adjusting the 'Total' amount of caches allowed is very important, choose a amount that is a balance between increased performace verses the amount of free memory available for your work. I can NOT give you a the amount because it will be variable for every system. I have a large amount a memory (4 Megs of Fast & 1 Meg of Chip) and two floppy drives (one a new HD floppy drive) and I found that I can use up to 63 caches without any problem. To calculate the amount of memory that is required for each cache is easy just multiply by 11K (22K for the new HD flopply drives) for each cache. My 63 caches for example can take as much as 693K if I am using normal diskettes or as much as 1.39Megs if I am using HD diskettes in my HD floppy drive! What is nice about "SmartCache" is that the caches are dynamically allocated at access time, which means if you are NOT using your floppy drives you are NOT using any memory for them. If you find that you have set the amount of caches to high and because of that are running low on free memory, just eject your diskettes from their drives, the caches will be flushed and their memory returned back to the system! Then be smart and lower the total amount of caches allowed, it is too easy to crash any system that is low on free memory! To start "SmartCache" from Workbench, just double click on its Icon. To start "SmartCache" from the CLI/Shell, CD to the correct drive/directory and type: SmartCache # Where '#' is the total amount of caches to allocate. The default is 11 caches. To specify the total amount of caches when starting from Workbench: Write "CACHES=#" in the "Tool Types" field of the "SmartCache" Tool Icon. Where '#' is total amount that you what allocated! Note, 2.xx/3.xx users the best way to install "SmartCache" in your system is to add the 'DONOTWAIT' tool type definition to the "SmartCache" Icon, and then drop the "SmartCache" Icon into the "WBStartup" drawer! (Note: That the program is self-detaching, do NOT Run it! It also sets the correct stack-size and priority, don't waste time adjusting them!) To remove "SmartCache" just start up the program again! --- Limits --- Here are a few problems that may effect users: 1) Poor shutdown code. When you shutdown the program make sure that there is NO drive activity! I did NOT waste time on this function because I NEVER shut "SmartCache" down. 2) No write caching. I must read a diskette a 20-50 times compared to one writing operation, so I spend my time where I would get the best return! I just write the request block to the diskette and update any effected caches in the current design. 3) Poor error handling. When a problem occurs I just flush the buffer and pass the problem on! So if you find that "SmartCache" is NOT working with a diskette the problem maybe in the diskette! 4) Synchronous design. Waiting on a un-cached read/write may slow the system down. Time wasted there is easy made up by accesses to cached cyclinders though! 5) Dependent on the interaction between the 'FileSystem' and the 'TrackDisk.device' To keep the design of "SmartCache" as simple as possible, thus keep it small and reliable, I decided to patch in between the two and use their interaction to my advantage. The down side to this is that I do NOT know if other custom 'FileSystems' will work with "SmartCache" My quess is that this will only be a problem with "Games" that take over the system! --- NOTE: To HD floppy users, when I first started using my new HD floppy drive, I experienced problems (corrupted HD diskettes) when I mixed the two types of diskettes in the same drive! Since I started using "SmartCache" the problem has gone away? I would like to hear from any HD floppy users if you have experienced the same problem as I have, and does using "SmartCache" also fix the problem for you? --- In the future --- Here are a few things that I would like to add/change in a future version: 1) A memory watch function that would automactically free the least used cache if the available amount of free memory was getting low! 2) A true write cache. One that caches the write and then writes the caches in manner that moves the head in the least distance! 3) A better cache search method. The current method is too primitive of a method that slows down with a large amount of caches! (still faster then none!) 4) Better error handling. In this version if there is a error or a any problem I just flush one or all of the caches, and pass the problem on. This can be improved in many ways! 5) A better shutdown function. The way it works now is NOT smart! 6) Maybe a true asynchronous design. May improve overall speed, but does any body access floppy drive in a asynchronous manner? The current synchronous design only slows the system down if the required block is NOT cached! Also a true asynchronous design would double the complexity and size of the program! I plan to make improvements to "SmartCache" in the future, but do NOT plan to offer any updates unless one of two things occur. One, a large enough group of user write to me requesting a update! Or two, someone makes me a good offer to market an updated version! --- Anyway, I have been using this version for over a year without any problem and I hope you find this program as useful as I have! Have fun! Tempus Fugit, Czar If you have any ideas, comments, bugs to report, please write me: Thomas J. Czarnecki 3526 Republic Avenue Racine, WI 53405-3856