


                    License for FastCache(.68030)
                    -----------------------------

         Any   reference   to   FastCache   refers   to  all  the
    FastCache's,  irrespective   of   the   processor   that  the
    particular version was designed for.
         FastCache is an unregistered trademark of Philip D'Ath.


    1.   COPYRIGHT:          FastCache     and     the    related
                        documentation are copyright.  You     may
                        not  use   or  modify   the  programs  or
                        documentation  or  any  copy   except  as
                        expressly provided in this agreement

    2.   LICENSE:            You have  the non-exclusive right to
                        use any enclosed program.   You  may load
                        the   program    into   your   computer's
                        temporary   memory   (RAM).      You  may
                        physically transfer  the program from one
                        computer  to   another.     You  may  not
                        decompile, disassemble, reverse engineer,
                        modify or translate the program.  After a
                        trial  period   of  3   months  you  must
                        register your copy of  FastCache for each
                        machine that FastCache is run on.
                             All   other   rights  and  uses  not
                        specifically  granted   in  this  license
                        relating to  items created  by the author
                        of FastCache  are reserved  by the author
                        of  FastCache.    Where  clarification is
                        required  of  the  above  paragraph,  the
                        author  of  FastCache  shall  decide  the
                        clarification.  Where  such clarification
                        is  deemed  illegal,  the latter sentence
                        will be withdrawn from this license.

    3.   BACKUP-UP AND TRANSFER:  You may make any number of
                        physical  backups  of  the   program  and
                        documentation    provided   the   backups
                        remain in your immediate possession.  You
                        must reproduce  and include the copyright
                        notice on any backup  copy.   You may not
                        transfer   or   license  the  product  to
                        another party.

    4.   TERMS:              This  license   is  effective  until
                        terminated.    You  may  terminate  it by
                        destroying the  program and documentation
                        and  all  copies  thereof.   This license
                        will also terminate if you fail to comply
                        with  any  term  or   condition  of  this
                        Agreement.      You   agree   upon   such
                        termination  you  agree  to  destroy  all
                        copies of the program and documentation.
                             FastCache  is  distributed under the
                        concept of Shareware.

    5.   PROGRAM DISCLAIMER: THE PROGRAMS ARE PROVIDED "AS IS"
                        WITHOUT  WARRANTY  OF  ANY  KIND,  EITHER
                        EXPRESSED OR  IMPLIED, INCLUDING, BUT NOT
                        LIMITED  TO,  THE  IMPLIED  WARRANTIES OF
                        MERCHANTABILITY   AND   FITNESS   FOR   A
                        PARTICULAR PURPOSE.   THE  ENTIRE RISK AS
                        TO  THE  RESULTS  AND  PERFORMANCE OF ANY
                        PROGRAM IS ASSUMED BY  YOU.    Should the
                        program  prove  defective, you assume the
                        entire cost of  all  necessary servicing,
                        repair,  or  correction.    Further,  the
                        author  of  FastCache  does  not warrant,
                        guarantee,  or  make  any  representation
                        regarding the use of,  or the  results of
                        the  use  of,  the  program  in  terms of
                        corrections,    accuracy,    reliability,
                        currentness,  or  otherwise; and you rely
                        on the program and results solely at your
                        own risk.

    6.   LIMITATION OF LIABILITY:      THE AUTHOR OF FastCache
                        ACCEPTS NO  LIABILITY FOR ANY DAMAGE THAT
                        MAY RESULT FROM USE  OF THIS  PRODUCT AND
                        SHALL  NOT  IN  ANY EVENT INCLUDE DAMAGES
                        FOR LOSS OF USE  OR  LOSS  OF ANTICIPATED
                        PROFITS  OR  BENEFITS OR OTHER INCIDENTAL
                        OR  CONSEQUENTIAL   COSTS,   EXPENSES  OR
                        DAMAGES, INCLUDING WITHOUT LIMITATION ANY
                        DATA OR INFORMATION WHICH MAY BE  LOST OR
                        RENDERED  INACCURATE,  EVEN IF THE AUTHOR
                        OF  FastCache  HAS  BEEN  ADVISED  OF THE
                        POSSIBILITY OF SUCH DAMAGES.

    7.   MISCELLANEOUS:      This agreement represents the entire
                        understanding regarding  the programs and
                        related documentation, and supersedes any
                        prior purchase  order,  communications or
                        representations.  This agreement may only
                        be modified by a written amendment signed
                        by  the  author  of  FastCache.    If any
                        provision  of  the  agreement   shall  be
                        deemed unlawful, void, or for any reason,
                        unenforceable it shall be deemed separate
                        from,  and  shall  in  no  way affect the
                        validity   and   enforceability   of  the
                        remaining provisions of the agreement.

              This  license  agreement  shall  be governed by the
         laws of the New Zealand.

    8.        The program License Agreement  shall  inure  to the
         benefit of the author of FastCache.



         You should  not be intimidated by this agreement.  It is
    expected that common sense should prevail.
         This agreement  is  modelled  after  the  copyright that
    comes with  the C  compiler, DICE  (by Matthew Dillon), and I
    acknowledge this.





                          Table of Contents
                          -----------------


    License for FastCache(.68030)  . . . . . . . . . . . . .    1
         COPYRIGHT . . . . . . . . . . . . . . . . . . . . .    1
         LICENSE . . . . . . . . . . . . . . . . . . . . . .    1
         BACKUP-UP AND TRANSFER  . . . . . . . . . . . . . .    1
         TERMS . . . . . . . . . . . . . . . . . . . . . . .    2
         PROGRAM DISCLAIMER  . . . . . . . . . . . . . . . .    2
         LIMITATION OF LIABILITY . . . . . . . . . . . . . .    2
         MISCELLANEOUS . . . . . . . . . . . . . . . . . . .    3

    Introduction . . . . . . . . . . . . . . . . . . . . . .    5
         History . . . . . . . . . . . . . . . . . . . . . .    5
         Features  . . . . . . . . . . . . . . . . . . . . .    6

    Requirements . . . . . . . . . . . . . . . . . . . . . .    7

    Warnings . . . . . . . . . . . . . . . . . . . . . . . .    7

    Installation . . . . . . . . . . . . . . . . . . . . . .    8
         DEVICE  . . . . . . . . . . . . . . . . . . . . . .    9
         UNIT  . . . . . . . . . . . . . . . . . . . . . . .    9
         NO_UNIT_CHECK . . . . . . . . . . . . . . . . . . .    9
         NUM_LINES . . . . . . . . . . . . . . . . . . . . .    9
         LINE_SIZE . . . . . . . . . . . . . . . . . . . . .   10
         DONOTWAIT . . . . . . . . . . . . . . . . . . . . .   10
         WRITE_RETENTION_TIME  . . . . . . . . . . . . . . .   10
         QUIET_WRITE_TIME  . . . . . . . . . . . . . . . . .   11
         NO_CHIP . . . . . . . . . . . . . . . . . . . . . .   11
         ? . . . . . . . . . . . . . . . . . . . . . . . . .   11

    Registration . . . . . . . . . . . . . . . . . . . . . .   12







                            Introduction
                            ------------

    History:

         In 1992 I came across a program called  SmartDisk.  This
    program was a hard drive cache.  After using this program for
    a short time I was very impressed by the performance increase
    it could give.
         During  that   year  I   learnt  about  cache's  at  the
    University of  Waikato, and  several caching  algorithms.  In
    particular, I  learned about  direct map, set associative and
    fully associative caches, and the merits of each.
         A direct map cache  is the  easiest to  implement, has a
    low  overhead,  but  can  waste  large  chunks of the cache's
    memory.
         A set associate cache (which is what SmartDisk  uses) is
    a little  smarter with  its memory usage.  Essentially, a set
    associate cache is a  whole lot  of little  direct map caches
    combined.   Obviously, a set associate cache is a little more
    tricky to implement since several direct  map caches  have to
    be managed.
         The most  complex of  the three  caching algorithms is a
    fully associate cache.    This  has  the  greatest processing
    overhead  of  the  three,  but  results  in much better cache
    memory usage.
         After  having  learned  about   these  three  particular
    caching algorithms,  and remembering what SmartDisk was like,
    and that it used a set associate cache  I decided  to write a
    hard drive  cache that  implemented the  more difficult fully
    associate cache algorithm.   And I'm  please to  say, it came
    out better that I expected.  Additionally, a second algorithm
    has to be used to determine what action  should occur  when a
    cache  miss  occurs.    I  chose  to  implement an LRU (Least
    recently Used)  algorithm, as  this is  also one  of the best
    available.




    Features:

         Below is  some of  the many  features I  have built into
    FastCache.

         * Fully associate cache (one of the best algorithms)
         * LRU cache replacement policy (one of the best)
         * Can handle multiple drives
         * *Should* be able to handle removable media
         * All cache settings are determined at run time
         * Optional write retention
         * Does not require large continuous chunks of memory
         * Uses a hashing system to locate date (one of the best)
         * Performs both forward and reverse prefetching
         * Will utilize the blitter to move data, if possible

         I have spared little in writing FastCache.  It uses some
    of the best algorithms (and more often than not, most complex
    algorithms) for nearly everything.







                            Requirements
                            ------------

         FastCache was design to be used under KS2.0.  However, I
    have used  only KS1.3  functions.   Because of this FastCache
    may also work under  KS1.3,  but  no  guarantees.   FastCache
    should  ONLY  be  used  on devices that support seeking, like
    hard drives.

         FastCache works best with at least  512K of  memory.  It
    runs  acceptably  in  256K,  but don't expect big performance
    gains.  If you  don't have  this much  memory free  then stop
    reading.  FastCache is not for you.
         With 512K  FastCache performs nicely.  However, the more
    memory  you  give  to   FastCache,   the   better   it  goes.
    Theoretically, there  should be  a point where if more memory
    is added, performance decreases.    However,  because  I have
    used a  hash searching  system, I  expect this limit would be
    vary high (>10M for a 68030).  As yet, I have been  unable to
    find this limit.
         There  are  two  version  of  FastCache supplied in this
    archive.  "FastCache.68000" is designed to run on a 68000, so
    it suitable  for all  Amigas.   "FastCache.68030" is designed
    for a 68030 or  better, and  makes use  of some  of its extra
    instructions.

                              Warnings
                              --------

         I  must  give  you  some  warnings  as  well.    Because
    FastCache uses RAM to store the  most often  used data, "bad"
    things could  happen if you have poorly behaved programs that
    trash memory.
         If you use write  retention MAKE  SURE YOU  WAIT FOR THE
    CACHE  TO   BECOME  EMPTY   BEFORE  RESETTING  YOUR  MACHINE.
    Otherwise, if data is waiting  to  be  written  out,  and you
    perform a  reset before  the cache  is flushed, then the data
    will be lost.
         You should use FastCache  with care  if your  hard drive
    has  errors  on  it.    FastCache  will  warn you if an error
    occurs, but it may be too  late if  you have  write retention
    enabled.   The worst  problem occurs  when a write request is
    made.  If write  retention is  on FastCache  *may* retend the
    data in  the cache (then again, it might write it straight to
    disk).  Then at some later  stage  it  may  write  it  to the
    disk.   If an error occurs FastCache can not report it to the
    program that made the request, because it would  have already
    been acknowledged.  If this occurs FastCache will give you an
    error (it pops up  a little  requester), but  there is little
    that can be done.




                            Installation
                            ------------

         FastCache can  be run  from either WorkBench or the CLI.
    For KS2.0 users, I recommend  placing  it  in  your WBStartup
    drawer.

         When   started   from   WorkBench,  the  parameters  are
    extracted from the ToolTypes fields.   When started  from CLI
    that parameters are obtained from after the command.

         Invoke  FastCache  once  to  start  it going.  Invoke it
    again with the same  parameters to  make it  quit.  FastCache
    will come  up with  a requester  asking you if you want it to
    quit.  You must acknowledge  this  before  it  actually will.
    Quitting automatically flushes the cache first.  Note that if
    write retention is enabled it may take some  time before this
    requester appears.

         An example  parameter for a WorkBench start that goes in
    the ToolTypes field is:
                   DEVICE=gvpscsi.device
         The equivalent parameter for a CLI start is:
                   FastCache -DEVICE=gvpscsi.device
         All  CLI  parameters  have  a  "-"  inserted  before the
    parameter name.


         Note that  all parameters have default values, and hence
    all are optional.  However, some  settings (e.g.  DEVICE) may
    have to be specified for you system.




         The available parameters and their descriptions are:

    DEVICE=<devicename>                   default: gvpscsi.device
    Example:       DEVICE=gvpscsi.device
    Description:   This specifies  the name of the device that is
                   to be cached.

    UNIT=<unit number>                                 default: 0
    Example:       UNIT=0
    Description:   This parameter specifies which  unit number to
                   cache.   Each drive  will have  a unit number.
                   The first drive is usually unit 0.   Note that
                   a Hard  Drive may  have many partitions on it.
                   This  unit  number  does  not  refer  to those
                   partitions,  but  to  the  drive  itself.  All
                   partitions on a selected drive will be cached.
    Warning:       There is no element  in a  device structure to
                   determine  which  unit  is  being  talked  to.
                   Hence this parameter may be unreliable on some
                   systems.    It  has  been tested on a GVP SCSI
                   interface  with  no  problems.    If  you have
                   multiple  drives,  use  FastCache with care to
                   begin with.
    See Also:      NO_UNIT_CHECK

    NO_UNIT_CHECK                                      default: -
    Example:       NO_UNIT_CHECK
    Description:   This  parameter  is  designed  for  those Hard
                   Drive cards that the unit selection above does
                   not work on.  ONLY USE IT IF YOU HAVE ONE HARD
                   DRIVE.  This option tells FastCache not to try
                   and check  IO requests  for the  unit they are
                   destined for.

    NUM_LINES                                        default: 256
    Example:       NUM_LINES=256
    Description:   This tells  FastCache how many lines it should
                   allocate for the cache.  I  wont give  you the
                   technical  description,  but in a multitasking
                   environment several programs could  be wanting
                   data  from  several  different  places  on the
                   disk.  To enable  effective management  of the
                   cache (especially  with regard to prefetching)
                   each of these requests  are  assigned  a line.
                   Several lines  can also  be combined to form a
                   longer line as well  for  programs  which make
                   many  requests  for  data  in a similar place.
                   This parameter can be any number  greater than
                   or equal  to 1.   If  you want  a bigger cache
                   this should be  one  of  the  first parameters
                   that you increase.
    NOTE:          To  calculate  the  size of the cache multiply
                   the number of lines  by the  line size  by the
                   block size (512).

    LINE_SIZE                                          default: 4
    Example:       LINE_SIZE=4
    Description:   This is  the line  size for the cache.  I wont
                   give  a   technical   description,   but  this
                   essentially controls  how much pre-fetching is
                   done.  For a device with a slow  seek time use
                   a small  line size.  For a fast seeking device
                   a bigger line size can  help.    Note,  if the
                   data on  your drive is not contiguous then use
                   a small line size (like 4,  or even  2).  This
                   parameter MUST  be a  power of two (e.g. 2, 4,
                   8) and must be greater than or equal to 1.  If
                   you supply a parameter which is not a power of
                   two, it will be rounded  to  a  power  of two.
                   Note that both reverse and forward prefetching
                   is done once the  direction of  the read/write
                   operation  is   established  (e.g.  Try  using
                   Aquarium and search backwards  for something).
                   I recommend  line sizes  no larger than 8.  To
                   get big caches try  increasing  the  number of
                   lines.
    NOTE:          To  calculate  the  size of the cache multiply
                   the number of lines  by the  line size  by the
                   block size (512).

    DONOTWAIT                                          default: -
    Example:       DONOTWAIT
    Description:   This  is  actually  a WorkBench parameter, and
                   tells WorkBench not to wait for the program to
                   finish.    This  is  recommended for WorkBench
                   starts.

    WRITE_RETENTION_TIME                              default: 60
    Example:       WRITE_RETENTION_TIME=60
    Description:   This controls the MAXIMUM  amount of  time (in
                   seconds) that  data which has been changed can
                   be  held  in  the  cache.    To  disable write
                   retention set this parameter to 0.
    WARNING:       If you  want to  reset your  computer you must
                   wait the  smaller  of  WRITE_RETENTION_TIME or
                   QUIET_WRITE_TIME  (in  the  case that no IO is
                   occurring) BEFORE you  can  safely  reset your
                   computer.    Note  that  if  you  try  to quit
                   FastCache  it  may  take  WRITE_RETENTION_TIME
                   before FastCache  responds and asks you if you
                   really want to quit.
    See Also:      QUIET_WRITE_TIME

    QUIET_WRITE_TIME                                   default: 1
    Example:       QUIET_WRITE_TIME=1
    Description:   This parameter only  takes  effect  when write
                   retention is  enabled and there is data in the
                   cache that has been changed.   If this  is the
                   case, then  FastCache must  at some time write
                   the changed data back  to  the  disk.   During
                   disk activity  there often  comes time when no
                   IO  occurs   because  a   program  is  working
                   something  out.    This  is  an  ideal time to
                   output changed data, since no other IO request
                   will be  impeded.  This parameter monitors the
                   time (in seconds) since  the last  IO request,
                   and if  there has  been no IO requests for the
                   specified amount of time  the changed  data is
                   written  back  to  the  disk  in the hope that
                   there will be no other disk IO requests during
                   that time.
    WARNING:       If you  want to  reset your  computer you must
                   wait the  smaller  of  WRITE_RETENTION_TIME or
                   QUIET_WRITE_TIME  (in  the  case that no IO is
                   occurring) BEFORE you  can  safely  reset your
                   computer.

    NO_CHIP                                            default: -
    Example:       NO_CHIP
    Description:   Not all  hard drive controllers are capable to
                   writing to all of  memory.    Hence, FastCache
                   normally  allocates  a  small CHIP buffer, and
                   all IO requests that  FastCache  makes  to the
                   hard drive  are done  through this buffer (and
                   the blitter will  be  utilized,  if possible).
                   On cards  that can write to all of memory this
                   parameter can be specified to prevent the CHIP
                   memory buffer being used.  In practice, I have
                   found  that  this  gives   little  performance
                   difference.

    ?                                                  default: -
    Example:       ?
    Description:   Displays help.





                            Registration
                            ------------

         FastCache  is  released  under the concept of Shareware.
    If after a  3  month  trial  period  you  still  wish  to use
    FastCache I  would appreciate  $20 (in cheque form) in either
    NZ, Australian or American  dollars.   The Australian  and US
    prices  (both  being  $20)  may seem artificially higher, but
    this covers the cost of changing the funds to $NZ.
         By registering you may  not  necessarily  gain anything.
    However, if  I get  enough support I will improve (yes, I can
    improve it further) FastCache.  If this is  the case,  I will
    attempt to notify all registered users.

         Please send this completed form to:

    Philip D'Ath
    9 Elmwood Crescent,
    Pukete,
    Hamilton,
    NEW ZEALAND.


    Name:     _________________________________________________

    Address:  _________________________________________________
              _________________________________________________
              _________________________________________________
              _________________________________________________

    Hard Drive Controller:   __________________________________

    Funds Enclosed:     $ ___________

    The most  important thing to add/change to/in FastCache is:
         ______________________________________________________
         ______________________________________________________
         ______________________________________________________


    Comments:
         ______________________________________________________
         ______________________________________________________
         ______________________________________________________
         ______________________________________________________

