Home Page The Club Computers News Links Glossary EYAWTK
Before Amiga Background ICS OCS ECS AGA ??? AmigaOne
U-Boot SLB Linux Amiga OS Dual Boot Motherboards Peripherals Other
Initialisation Installation OS4 Updates About OS4 File Systems Networking Printing Other
Introduction File System Workbench Preferences Commands Error Msgs Miscellaneous

AmigaOS 4.0 - About OS4 - Commands

FS_PLUGIN_CACHE AmigaDOS
Purpose: To demonstrate the block cache plugin feature of the new file system API.
Format: fs_plugin_cache DEVICE=<device> [CACHESIZE=<number>] [READAHEAD=<number>] [QUIET] [WRITEAROUND] [NOCHECKSUMS]
Template: DEVICE/A, CACHESIZE/K, READAHEAD/K, QUIET/S, WRITEAROUND/S, NOCHECKSUMS/S
Path: C:FS_PLUGIN_CACHE
The fs_plugin_cache command demonstrates the block cache plugin feature of the new file system API. While it is an experimental feature, you can still give it a spin and expect something useful to be accomplished. This plugin will attempt to increase file system performance by buffering disk data that was accessed before and might be accessed again, or which was never accessed before but has a good chance of being needed soon.

DEVICE=<device> specifies the name of the device the cache is to be enabled for. Note that <device> must be the name of a file system which supports the plugin interface, such as the FFS reimplementation.

By default it will try to use a cache about 1% the size of the device it is installed on, however you can override how large the cache can become using the CACHESIZE=<number> parameter. The size you specify will be multiplied by 1024. Thus, a cache size of 8192 would result in a cache size of 8 MBytes. The minimum value is 128.

The cache plugin also supports a feature called read-ahead. With this feature enabled, the file system will always read a little more data than is strictly necessary in the hope that the data read will be useful later. You can tell the file system how many blocks should be read using the READAHEAD=<number> parameter. Note that a read-ahead cache makes sense only if reading the extra data does not noticeably increase the overhead of transferring data from the disk. Thus, smaller read-aheads sizes are likely to be more successful than larger ones.

The kind of cache implemented by this program is a so-called write-through cache. That is, data written to the medium is in fact written straight to the medium, but a local copy is stored in the cache. This is done in the hope that data, once written, will be reread again. This behaviour can be changed with the WRITEAROUND option. If you select this option, data blocks written will not have the effect of allocating cache entries for them. In effect, write accesses will bypass the cache unless there already is a cache entry present for a block to be written (in which case that cache entry will be updated).

Because the cache can fill up or reach its maximum size, some cache entries may have to be recycled and filled with new data. The strategy by which a candidate is selected to be replaced is called 'segmented least recently used' which promises to be very effective. The cache may also shrink in response to other applications trying to allocate memory from the free pool. By default all data that goes into the cache is protected by checksums to guard against corruption. Maintaining and verifying the checksums comes with a price tag: it takes time. If you believe you can do without the checksumming, use the NOCHECKSUMS option.

When you run fs_plugin_cache from the Shell, it will continue to run until you use Ctrl+C (^C) to end the program. While it is running you can use Ctrl+D (^D) to show the current cache usage statistics, and Ctrl+F (^F) to purge the current cache contents. After setting the cache, let it run for a while, then re-activate the Shell window it is running in and press ^D. That will print the usage statistics, showing you how well the caching works, and how much memory it uses.

Example 1:

3.OS4:> FS_PLUGIN_CACHE DH0:
Cache on 'DH0:' installed (maximum size=108,185,600 bytes); ^C to remove.

Installs a cache for DH0: using default values. Subsequently pressing ^C results in:

Cache on 'DH0:' removed.

Example 2:

3.OS4:> FS_PLUGIN_CACHE DH0: CACHESIZE=2 READAHEAD=5
Cache on 'DH0:' installed (maximum size=131,072 bytes); ^C to remove.

Installs a cache for DH0:, however the specified value is less than the minimum and that is defaulted instead, i.e. 128 (128MB or 131,072 bytes). The READAHEAD paremeter specifies that 5 blocks should be read at a time.

Example 3:

RUN >NIL: FS_PLUGIN_CACHE DEVICE=DH0: CACHESIZE=16384 WRITEAROUND

Using this format it can permanently be added to the User_Startup_Sequence and run at startup, but you cannot use ^D to print the statistics or ^F to purge the cache.


Return to Commands Selection

Disclaimer: Amiga Auckland have prepared the above Information for the use of its members based on our experiences and as such is subject to revision at any time. Amiga Auckland cannot guarantee any of the Information and cannot be held accountable for any issues that may result from using it.


Copyright 2006 Amiga Auckland Inc. All rights reserved.
Revised: December 24, 2006.