CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE NAME concache.exe - DOS concurrent disk cache SYNOPSIS concache [memory-arguments] [drive-arguments] [option] [flags] device=concache.exe [memory-arguments] [drive-arguments] [option] [flags] concache VECTOR [interrupt-number interrupt-id] COMMAND LINE RULES Command line has following rules - Operands consist of options and terminating ';' (semi- colon). Except for ';' , the order is unimportant. - The character ';' (semicolon) terminates command line. Operands after the character are ignored. - All operands are case sensitive, and generally must be in lower case. In this version VECTOR is the only upper case operand. On config.sys line, operands are converted to lower case and then interpreted. - The character '/' can be placed anywhere ' ' (the white space) can be placed. - Alphabetic part of an option can be abbreviated down to one character, if there is no ambiguities. For example the delete option has the syntax [d[e[l[e[t[e]]]]]]. - Where drives are written, the character ':' (colon) can be written, if adjacent to drive letter, as many as wanted. For example, in concache.exe command line, "sfg" is equivalent to "s:f:g:", "sf:g::", and so on. The bitmap_length= and buffer_size= options and gang_interrupts and gnaw_interrupt options are the only those that at least leading two letters disambiguate. DESCRIPTION Conc286.exe has the same functionality with concache.exe except that it runs also on 286 based compatibles with obvi- ous limitation it is loaded only below 640kb of main memory when under 286 CPU. The concache.exe is the disk cache program for DOS environ- ments. The other programs ccdisk.exe and floppies.exe works Concache 1.10 Last Update: 20 June 1996 1 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE under the control of this program. It is possible to load concache.exe into UMB (upper memory block) by appropriate load command, such as devicehigh= instead of device= or using loadhigh command. Also, it loads its resident part into UMB with its option. This can be convenient since this method is not affected by initial concache.exe program size. See below for more. After loaded as a character device driver or as a TSR (Ter- minate and Stay Resident) program, concache.exe can change most of parameters from command.com command line. If used without any operand, concache.exe lists the flags in effect, state of memory, and state of disks in use. con- cache.exe gets this information from resident concache.exe program. After concache.exe has become resident, if windows is started, concache.exe is expected to be readable from the same drive and directory as it is loaded. For example, if it is loaded from a floppy drive, the floppy media is refer- enced at the same drive when windows starts. Memory Arguments These arguments determines the cache data area and their sizes to be used for keeping copies of disk data. At least one of them must be present for concache.exe to go resident. Each of the named memories are examined and if enough memory is available to satisfy the argument then they are used for cache data area. Memory argument takes following forms x[size] Allocate/redefine extended memory according to XMS (Extended Memory Specification) 2.0. e[size] Allocate/redefine expanded memory according to EMS (Expanded Memory Specification) 4.0. Concache.exe does not use page frames. p[size] Allocate raw protected memory, retrievable via BIOS int15. where size is the size to start or to continue concache.exe. If size is not given, concache.exe uses all of available memory of the type. Concache 1.10 Last Update: 20 June 1996 2 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE Int15 memory is not allowed to change its size after once concache.exe is loaded. Changing its size is only possible by unloading and reloading concache.exe. Extended and expanded memory can be changed at any time after concache.exe is loaded. However, this must not be exercised frequently, since this causes voiding accumulated cached data in memory. Size is written in decimal or in 0x preceded hexadecimal value optionally followed by no space intervening m, mb, k, kb, or b for megabytes, kilobytes, or bytes, respectively. (A trailing b is for "bytes". If the hexadecimal is fol- lowed by 'b' then it is interpreted as part of value but not to mean "bytes".) The size is truncated to nearest multiple of 64 kb. If total usable memory is less than 128 kb, caching is not done. The total maximum value concache.exe handles is 64 mb. Drive Arguments Drive arguments define cache refreshment policy for each drive. They take the forms c[drives] (default) to refresh cache using concurrent method, that is, con- cache.exe refreshes unwritten (wet) cache data back to drives concurrently with user programs and DOS, and possibly with the other devices, a[drives] to refresh cache not using concurrent method but using write after, w[drives] to refresh cache with "write through" method. This is the safest traditional disk cache method, s[drives] not to cache the data for the drives. Drives are written after each c, a, w, s letter with no spaces and tabs. Range expressions of drives are allowed. For example, wja-df-h is equivalent to wabcdfghj to mean drives a:, b:, c:, d:, f:, g:, h:, j: are to be cached with write through method but drives e:, i:, and those after j: are not. It makes no sense to specify different refreshment policies Concache 1.10 Last Update: 20 June 1996 3 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE for drives on the same devices. In these cases concache.exe uses the most pessimistic policy for the drive. Note actu- ally this happens only between concurrent and write after methods. If no drives are specified after any of c, a, w, s letter, then it means "all the other" drives. For example aabc w specifies drives a:, b:, c: are cached with write after method but all the other drives are write through. With similar syntax, following cache controls are available. r[drives] means refresh unwritten cache data back immediately. The command awaits the completion of the writes. f[drives] means discard all data for the drive unconditionally, written back or not. In practice, flush is seldom used. If however, for example, floppy change line does not work, then cached data for the device may have to be flushed with this method. n[drives] disallows prereading on the drives. Normally con- cache.exe schedules one block preread after a read request is completed. o[drives] reenables prereading on the drives disabled by n[drives]. The r[drives] and f[drives] are only meaningful after con- cache.exe is loaded. Thus these two are meaningless on con- fig.sys command line. Options. Among available options, the most frequently use ones are load_umb, io_buffers_low, and delete. All other options are for fine control of efficiency on particular configurations or applications, or for solving possible incompatibilities. bitmap_length=nbytes The value for nbytes must be less than 128 and even. This directs how the cache data area given by memory arguments described above is to be split into arenas which are multiple of 16kb. This option can be useful for very small or large cache data area, or the area is Concache 1.10 Last Update: 20 June 1996 4 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE frequently changed. Since the bit map length is corre- lated with max_directory_size= option, a more explana- tion is given below. buffer_size=nbytes The option specifies the size of each io buffer that may be specified by io_buffers= option (see below) to be used for cache io, which defaults to the size of largest block disks, normally 512 bytes. The value can be any multiple of this default. concurrency=max_concurrency The option specifies the number of devices that can perform io in parallel. The value must be larger than 1. This option is used to prepare stacks and working spaces for concurrency. delete The delete option is the option to tell resident (loaded as TSR) concache.exe to be unloaded from mem- ory. It ignores all the other operands. This option tries to refresh unwritten data before it attempts to delete the resident code and data. If delete is unsuccessful for any reason, then con- cache.exe stays in memory with stop mode. gang_interrupts This option is seldom, probably never, necessary. It tells concache.exe that programs other than multi- taskers and concache.exe need BIOS multitasking inter- rupts. Normally, concache.exe terminates int159[01] chain to prevent from stack overflow. However, if TSR or device driver loaded before concache.exe needs the interrupts, then this option must be used. If this option is used then stacksize= (see below) option should be specified to a larger value. gnaw_interrupt This option should be seldom necessary. Normally con- cache.exe handles floppy and IDE disk interrupts by Concache 1.10 Last Update: 20 June 1996 5 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE itself to guard against interrupt handlings of some BIOSes which cause stack overflow. This option tells disk interrupts should be handled by genuine BIOS. If this option is used then stacksize= (see below) option might be necessary to be a larger value. h[{c|d|h|m|w}...] The option controls status display from concache.exe, where 'c' displays the values of options in effect. The 'd' drive status, the 'h', together with 'd', clears drive statistics, the 'm' displays state of cache data area, and the 'w' displays concache.exe overall condi- tions. The 'c', 'd', 'm', 'w', and 'h' can be combined (with no intervening space) into one operand. If 'h' alone is given then concache.exe behaves as if hcdmw is given. io_buffers_low This option directs allocation of io buffers in low (conventional) memory. If this option is not used, then io buffers are allocated at the same region as for resident part of concache.exe. io_buffers=number-of-entries This option specifies the number of disk and floppy io buffers. The default is 16 (8kb if buffer_size = 512 bytes). Increasing this value improves performance. largest_io_buffer=number-of-entries This option specifies the maximum number of io buffers to be used for each buffer refresh operation. The default value is the value given by io_buffers= and bitmap_length= above, of whichever is smaller. But set- ting this value larger than these values has no effect, Specifying the value smaller than default can improve concurrency, but can make individual io operations slower. load_umb This option specifies the resident part of concache.exe be loaded into UMB if possible. If used with device- high or loadhigh command then this option is ignored (i.e., naturally satisfied). Concache 1.10 Last Update: 20 June 1996 6 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE max_directory_space=nbytes The default value is computed as the trade off between space required and hash table access efficiency. Although concache.exe computes this value and the bit map length and allocates space for all necessary bit map at start up, the value can be improper when the cache data area was changed without recomputing it, or when very large cache data area is used. The option allows redefine the size of concache.exe directory for cache data area. stackspace=nbytes specifies size of each stack space for concurrently driven devices. tick_delay=number-of-seconds This option specifies the delay after any DOS disk access to begin writing wet data back to devices. The value can be up to 254. Default value is one. Because io request clash is most expensive, a larger delay tend to avoid that of request to write back by concache.exe, the background, and requests that come from DOS, the foreground. Also, the more writes accumulate in cache data area, the smaller the number of actual writes. On the other hand, refreshing quickly may prepare future write requests' cache data area. unknown_drives_allowed This option tells concache.exe that drives unknown to it must be treated just like hard disks. In the case such as two drives are unknown but only one of them is to be handled as a hard disk, the remaining truly unknown one must be marked with s drive argument. Fol- lowing types of drives are treated as "unknown" drives by concache.exe. Number of fats are not two. These drives may represent ram disks, which don't need to be cached. Not a physical disk. In current directory structure in DOS, each drive is marked as a physical drive or not. Con- cache.exe faithfully believes this information. Concache 1.10 Last Update: 20 June 1996 7 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE Extraordinary block size devices. If physical block size is not 512 bytes or if log- ical block size is not 512, 1024, 2048, 4098, or 8192 bytes then the device is unknown. Drive is neither disk or floppy. If device parameter reports otherwise, then the drive is considered unknown. No device parameters. Drives on device driver which does not implement ioctl function (int21440d, get drive parameters call). Only this last type of disk drives can be forcefully "known" to concache.exe by using the option unknown_drives_allowed, in which case the drive is han- dled as if a known disk. Typically, device drivers that predate DOS 3.3 lack (or have undetectable) device parameters are rescued with this option. More on load_umb And io_buffers_low Options The load_umb option alone specifies that both resident part and io buffers are to be loaded high. If it is accompanied with io_buffers_low then io buffers are tried to load into low memory and resident part is attempted to be in upper memory. In the latter case if there is no upper memory to load resident memory both will be loaded low. The load_umb option is treated as a hint; if no upper memory to load res- ident part is found then the resident part is loaded where it happened to find adequate space. On the other hand, io_buffers_low is regarded as a mandatory requirement; if there is no low memory to load io buffers, then the loading concache.exe will be aborted. Flags Flags are specified after "+" or "-" to mean set or reset the flags. Default states of flags are all reset, irrespec- tive of options and arguments. h The flag h is to "hold" the cached data. If this flag is effective, no additional cache is made, while cached data are retrievable. This flag is useful to prevent a large copy of files from flushing useful cached data. Concache 1.10 Last Update: 20 June 1996 8 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE l, u The flag l "lock"s the succeeding cached data. To "unlock" the lock, use u flag. This flag starts unlock previously locked cache data. The +l starts locking referenced data, while -l stops locking further. The locked cached data are not purged out of cache until worst case (where no unwritten cache data area exist to additionally cache) arises. After l flag is set, con- cache.exe marks the data in cache as locked, to indi- cate subsequent space hunter keep away from those marked. If the flag is reset by either -l concache.exe stops the marking. The +u says start unlocking if data blocks touched are in locked state, while -u tells stop unlocking on further data reference. "Unlocking" means unmark the locked data touched while u flag is in effect. These data in cache becomes ordinary member of cached data. After this, space hunter can take the piece of memory into consideration. Since it is illogical to allow both locking and unlock- ing at the same time, the +l and the +u are considered to implicitly deny each other. The command line does not allow +ul or -ul. Locking is not a write protection. Locked data may get "wet". They obey the usual cache refreshment policy. There are two points to note. If too much records are locked, cache performance can degrade because concache.exe uses only the remaining space for the other. For write operations, if space to write cannot be found, an arbitrarily chosen locked space will be silently unlocked and used as an ordinary cache space. n The flag +n says not to perform prereads on any drive. -n restarts preread operation on drives that have no n specified. c, a, w, s These flags are alternate ways to define the cache refreshment policy for all drives. The +c flag speci- fies all drives specified by c argument to use fully concurrent write back. The +a flag specifies all drives specified by c or a argment to use non- concurrent write back. It allows concache.exe to syn- chronize with DOS. The +w flag specifies all drives Concache 1.10 Last Update: 20 June 1996 9 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE specified by c, a, or w argument to use write back. The flag +s specifies cache should not be done. These flags are mutually exclusive, and specifying one of these flags resets the other flags automatically. Resetting flags with -a, -w, and -s respectively resets +a, +w, and +s. (Note -c "resets" the +c but this is meaningless.) In general, each of them is meaningful iff the corresponding flag is set. Since these flags are specified independently from drive arguments, the overall refreshment policy can be maintained keeping the drive's default policies. The flag set is combined with drive refreshment policy and the pessimistic value is used for the drive's pol- icy. Resetting these options lets concache.exe go to the default c refreshment policy, even if -c is used. These options are asymmetric in this sense. VECTOR argument This argument is used to change interrupt convention used to communicate between resident and transient parts of con- cache.exe, ccdisk.exe, and floppies.exe. The programs do not become resident by invoking the programs using this argument. No interactions to resident programs are tried. They merely rewrite themselves and exit immediately. This argument must be written by its own; no other arguments can be written together. VECTOR must be in upper case. If interrupt-number and interrupt-id are missing then the current settings of interrupt conditions for the commands are displayed. The interrupt-number is a two digit hexadecimal number and interrupt-id is a four digit hexadecimal number loaded in register AX when the interrupt is used. They are inter- preted as hexadecimal values without leading 0x or trailing h. The default values are interrupt-number = 0xbe and inter- rupt-id = 0xefed. This default interrupt number is known to be used by IBM ROM BASIC. If the machine is using it, the interrupt number for above programs must be changed to the other than the range 0x86 - 0xf0. Concache 1.10 Last Update: 20 June 1996 10 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE Unfortunately, there are many settings that cause conflict with other programs. Further, there are no absolutely con- flict free values. Following are a few of known reminders. - External interrupts should not be chosen since they can have any value in register AX at the instance of inter- rupts. - Also, there are a few interrupts that can have any value in register AX, such as 0x00 - 0x0f, 0x18, 0x19, 0x20, 0x28, and 0x2e. - A few interrupt numbers are not really used for inter- rupts but rather for table addresses. These includes 0x1d - 0x1f. - Frequently used interrupts such as 0x21, 0x2a, 0x2f, and 0x13 should be avoided since such interrupts must pass through the chain of interrupt unnecessarily. - Larger interrupt-id values cause less conflicts, in general. WHEN TO USE DESCRIPTIONS Each of arguments on command line can or must be specified at load time or after loaded. Following clarifies these conditions. Arguments missing in the tables below can be used either at load time or after loaded. 1) Must be at load time Memory argument is the minimal must. The raw protected memory is specifiable only at load time. In addition, following options are only meaningful at load time. buffer_size= gang_interrupts gnaw_interrupt io_buffers= io_buffer_low largest_io_buffer= load_umb max_director_spaces= stackspace= tick_delay= unknown_device_allowed 2)Used only after loaded Options delete and h[c|d|h|m|w], device arguments o[drives], r[drives], and f[drives] are meaningful only after loaded. Concache 1.10 Last Update: 20 June 1996 11 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE WHEN TO LOAD CONCACHE.EXE Under DOS environment, it is important to load device drivers and TSRs in a specific order. Below is the loading order related to concache.exe. 1) Concache.exe must be loaded after block device drivers intended to be cached. It intercepts DOS device driver requests. 2) Ccdisk.exe must be loaded after ASPI manager, but due to the condition above, it must be loaded before con- cache.exe. Ccdisk.exe is loaded only by config.sys. 3) Floppies.exe may be loaded independent of all the other. 4) If disk-in-disk type of device drivers are used, then concache.exe must be loaded before them, except for those specifically noted. EXAMPLES Locking all executable's directory entries and stop locking concache /+l missing /nonexisting exe file concache /-l Using 2megabytes of EMS and XMS each at startup concache /x2m /e2m Startup anyway. The exact memory size other than raw pro- tected memory will be given afterwards. concache /x0 Change vectors for concache.exe, ccdisk.exe and floppies.exe to interrupt-number = 0x16 and interrupt-id = 0xbeef. concache V 16 beef ccdisk VE 16 beef floppies VEC 16 beef SEE ALSO ccdisk.txt, floppies.txt, eqanda.txt, overview.txt. Concache 1.10 Last Update: 20 June 1996 12 CONCACHE.EXE COPYRIGHT 1995-1996 horio shoichi CONCACHE.EXE Ralf Brown, Jim Kyle "PC interrupts" 2nd ed., Addison Wesly FEATURES Concache.exe works only on local physical block devices. No redirected nor character devices are considered. Depending on interrupt overlay order with the other pro- grams, delete option may not always work. The option io_buffers_low is effectively impossible if loaded by loadhigh or devicehigh= command, since the latter preoccupies whole conventional memory. Concache 1.10 Last Update: 20 June 1996 13