README
上传用户:wzy860708
上传日期:2015-12-24
资源大小:39k
文件大小:23k
源码类别:

磁盘编程

开发平台:

DOS

  1.                         COMBI-Disk -
  2.                    RAM disk & disk cache
  3. Preface.
  4. --------
  5.         - Why don't You use disk cache?
  6.         - I'd like, but memory constrains prevent me from using it:
  7.           I need more memory for  RAM disk.
  8. -----
  9.         - Why don't You use RAM disk?
  10.         - I'd like, but memory constrains prevent me from using it:
  11.           I need more memory for disk cache.
  12. -----
  13.         - Why don't You use RAM disk or disk cache?
  14.         - I'd like, but some of my applications require free extended
  15.           memory.
  16. If one of these answers is Yours then COMBI-Disk is for You!
  17. You may hit THREE targets with a single shot - installing COMBI-Disk
  18. You get a RAM disk and a Disk-Cache and free XMS memory at the same
  19. time in the SAME area of extended memory!
  20. When You install COMBI-Disk You specify amount of extended memory for
  21. it and You get a RAM disk of the specified size and a Disk-Cache of the
  22. same size. You may also specify amount of memory which should be
  23. released if some program requires it. Then when You work with Your PC,
  24. You enjoy COMBI's disk cache which is not worse than others (I hope it
  25. is better).  Suppose now that You start a program which needs a disk
  26. buffer for temporary storage and tell it to use RAM disk.  Then the
  27. program may use the whole amount of the RAM disk's space (though
  28. contracting the size of cache).  When it terminates and deletes
  29. temporary files You get back your cache buffer!  If a program requests
  30. XMS memory COMBI-disk may loan some of its memory to the program (if it
  31. has the requested amount free of RAM disk data). When the program
  32. releases the memory COMBI-disk reallocates it back.
  33. Applications.
  34. ------------
  35. Some programs (e.g. compilers, word-processors etc.) need a buffer for
  36. temporary storage, and if the storage is RAM disk then their performance
  37. may be increased few times compared with the case of usage of hard disk
  38. instead. That's why You may sometimes need a RAM disk. But if You use
  39. standard RAM disk (Microsoft (C) RAMDRIVE.SYS or IBM (C) VDISK.SYS or any
  40. other) it often comes out that it stays empty most of the time though
  41. consuming Your extended (expanded) memory. That's why You may wish to
  42. give up using RAM disk or make it less in order to have more memory
  43. for disk cache which is always useful.
  44. Moreover, some of programs can take advantage of XMS memory if it is
  45. available. That's why You may wish to give up using disk cache (though
  46. some of caches support memory reallocation without reinstallation).
  47.                 Don't get disappointed!
  48.      COMBI-Disk
  49. is a nice solution of this problem! It uses a little more memory for
  50. RAM disk than is needed to keep all files written into it while all the
  51. remaining memory is used for cache.  You need not bother to make this
  52. memory larger - just WRITE Your file(s) into RAM disk, all the rest it
  53. does itself! You need not bother as well to contract RAM disk's size
  54. and increase cache size - just DELETE files from RAM disk and all the
  55. released memory will be used for cache!  You need not bother to
  56. reconfigure Your system when You need some free XMS memory - COMBI-disk
  57. takes care of that itself (however, if You forgot to specify amount of
  58. memory COMBI-disk would release, You have to run COMBI control program
  59. to tell COMBI-disk that You need certain amount of free XMS memory).
  60. System requirements.
  61. -------------------
  62.         1. 80x86 based machine with extended memory.
  63.         2. DOS 3.30+.
  64.         3. Extended memory manager which supports XMS 2.0 specifications
  65.    which supports "reallocate XMS" function (Microsoft (C) HIMEM.SYS
  66.            ver 2.77+ or Quarterdeck (C) QEMM.SYS will do, as well as most
  67.            others).
  68. General features.
  69. ----------------
  70.         - COMBI-disk may use up to 16 Mbytes of extended (XMS) memory.
  71.         - Up to 8 physical hard disks are supported.
  72.         - Starting from version 1.00 background write caching is
  73.           supported.
  74.         - Automatic reallocation of XMS memory.
  75.         - Variable size of cache block (memory allocation unit) -
  76.           from 1 to 8 disk sectors (512 bytes each).
  77.         - IOCtl interface to control program.
  78.         - HMA may be used for COMBI-disk data tables (even when MS-DOS
  79.           5.0 is loaded into HMA and under DR-DOS 6.0 as well).
  80. Installation.
  81. ------------
  82. Warning! It is recommended to make backup of hard disk before
  83. installation of COMBI-disk (as well as any other disk cache program).
  84. COMBI-Disk installation process is quite straightforward, although it
  85. requires some tweaking with the contents of your CONFIG.SYS file. Copy
  86. COMBI.SYS into Your hard-disk and insert the following line into Your
  87. CONFIG.SYS file
  88.         DEVICE=[drive:][path]COMBI.SYS [<parameters>]
  89. The proper place in CONFIG.SYS would be after all memory managers,
  90. after disk managers and if possible before disk write-protection
  91. programs (otherwise You should not turn on write caching).
  92. The <parameters> are all optional and include:
  93. [<buff_size> [<rls_size>]] [/V [<RAMd_parms>]] [/C [<cache_parms]] [/H] [/Q]
  94. <buff_size> -  the amount of XMS memory (Kbytes) You want to use for
  95.                COMBI-Disk. Minimum  is 128K, maximum is about 14000K.
  96.                If it is omitted then all available memory is default.
  97.                There is no harm if You specify more memory than really is
  98.                available - then COMBI-disk uses all available memory.
  99. <rls_size>  -  maximum number of XMS memory (Kbytes) COMBI-disk should
  100.                release when it is requested. Default is 0. Note, if You
  101.                want to specify this number You should also specify
  102.                <buff_size>.
  103. /V          -  means that RAM disk parameters follow.
  104. <RAMd_parms> - RAM disk parameters may be the following:
  105. F:<disk_size>- specifies formatted size of RAM disk. By default COMBI
  106.                creates RAM disk of the size (<buff_size> - <rls_size> -
  107.                - <min_cache>) Kbytes, so that there would never arise
  108.                problem that there is not enough free XMS memory to
  109.                allocate for RAM disk. But You may (and I recommend You)
  110.                specify larger size: up to (<buff_size> - <min_cache>) -
  111.        that gives You maximum flexibility though sometimes may
  112.        cause errors if the same program that borrowed XMS from
  113.        COMBI tries to write a lot to RAM disk.
  114. R:<root_num> - number of entries in root directory of RAM disk. Default
  115.                is 64. If You encounter DOS error "can't create file..."
  116.                when number of file in root directory is 63 (plus one
  117.                for volume label) then try specifying, say, R:128.
  118. S:<sect_size>- sector size for RAM disk - 256 or 512 bytes, default is
  119.                512 bytes. Using 256 bytes sectors may sometimes save
  120.                some space on RAM disk but this is effective only if
  121.                RAM disk size is less than 1 Mbyte.
  122. N           -  tells RAM disk not to return 'sector not found' error
  123.                (see also below). This setting may be always changed by
  124.                control program.
  125. /C          -  means that cache parameters follow.
  126. <cache_parms>- cache parameters may be the following:
  127. M:<min_cache>- specifies minimum cache size (Kbytes). This reduces size
  128.                of RAM disk but guarantees that specified amount of
  129.                memory will be always allocated to cache. Default is 0.
  130. U:<block_sec>- number of sectors per cache block (from 1 to 8). Using
  131.                smaller blocks may result in more effective usage of
  132.                memory (if You have not much of it) but leads to slower
  133.                operation for large read/write transfers. Default is 8.
  134. O           -  tells COMBI-disk to turn OFF disk cache after
  135.                installation. Cache may be turned ON at any time by
  136.                control program. This may be useful for testing period
  137.        if You have some problems.
  138. B           -  enable background disk writes. By default background
  139.                writes are set off on installation. May be changed at
  140.                any time by control program.
  141. I           -  forces COMBI's disk cache to start background writing
  142.                immediately. By default background writing starts within
  143.                18 timer ticks (approx. 1 sec.) after last access to hard
  144.                disk. This is in effect only when background writing is
  145.                enabled. I admit that sometimes it may be more safe to
  146.        start writing immediately rather than wait a second, but
  147.        as a rule that slows down cache performance, especially
  148.        for large transfers.
  149. /H          -  tells COMBI-disk to use HMA for data tables.
  150. /Q          -  tells COMBI-disk not to display installation parameters.
  151. In short, recommended installation parameters for best performance are:
  152. DEVICE=<drive>:<path>COMBI.SYS 16000 16000 /V F:16000 /C B /H
  153. In this case COMBI allocates all available XMS memory but will release
  154. almost all when it is requested, RAM disk is created of maximum size
  155. and write caching is enabled. (You may use other numbers instead of 16000
  156. if You have less than 16 Mbytes of XMS or don't want to spend all XMS
  157. for COMBI.)
  158. Note:   Minus ('-') may be used everywhere in command line instead of
  159.         slash ('/'), and equal sign ('=') instead of colon (':'). Case
  160.         of the letters is insignificant. Spaces are required only after
  161.         COMBI.SYS name and between two adjacent numbers.
  162. Installation messages.
  163. ---------------------
  164.                 COMBI-Disk: RAM disk & disk cache
  165.         Copyright (C) 1991, 1992 by Vadim V. Vlasov, Moscow, Russia,
  166.                         Version 1.10
  167.              - This banner always appears and tells You that
  168.                COMBI-disk is being installed.
  169. ERROR: Incorrect DOS version!
  170.              - DOS version must be above or equal to 3.30 and below 6.00.
  171. ERROR: Invalid parameter!
  172.              -  An invalid parameter appears in command line or some
  173.                 parameter is specified in improper place.
  174. ERROR: Extended Memory Manager not present!
  175.              -  COMBI-Disk needs XMM driver. Check that Your XMM driver
  176.                 is installed before COMBI-Disk.
  177. ERROR: No extended memory available!
  178.              -  All Your extended memory is used by some other programs
  179.                 or less than 128K is available.
  180. ERROR: Can't allocate extended memory!
  181.              -  An error encountered when COMBI-Disk tried to allocate
  182.                 extended memory.
  183. ERROR: Not enough memory!
  184.              -  Not enough memory for COMBI-disk's code and data. This
  185.                 is almost impossible.
  186. ERROR: No hard drives on system(?!)
  187.              -  COMBI-disk can't determine presence of hard disk(s) and
  188.                 its (their) parameter(s).
  189. WARNING: Inconsistent parameters.
  190.              -  Some of numeric parameters conflict with each other. As
  191.                 a rule this is not fatal - some of the numbers will be
  192.                 adjusted.
  193. WARNING: Can't hook XMS driver entry chain.
  194.              -  COMBI-disk won't intercept XMS (re)allocation calls and
  195.                 hence automatic reallocation of COMBI's memory is
  196.                 disabled. However, You may change amount of used XMS
  197.                 memory by control program.
  198. WARNING: Not enough HMA for data tables or HMA not available.
  199.              -  COMBI-disk will use more low memory for its data tables.
  200.                 (For 3 Mbytes buffer it is about 10K)
  201. If "ERROR:..." message is displayed COMBI-disk aborts installation.
  202. If the installation is successful a table appears (if it is not
  203. disabled by /Q switch) which summarizes installation options and
  204. announces how much memory is used by COMBI-disk.
  205. Note. Some of numeric parameters specified in command line may be
  206. adjusted by COMBI-disk.
  207. Testing.
  208. -------
  209. A simple test program CMBTEST.COM is supplied with the package. It
  210. writes randomly to few files, deletes some of them etc. Its objective
  211. is to convince You that memory allocation strategy used by COMBI-disk
  212. is reliable. It may also be used to test write caching reliability.
  213. Usage:
  214.         CMBTEST <dirname> [<options>]
  215. where <dirname> is name of directory (or drive) where CMBTEST  will
  216. write the files - it may be a directory on a hard drive or COMBI's RAM
  217. disk. <options> may be used if You want to run multiple test series.
  218. (For more details see the source code CMBTEST.C) I suggest You to
  219. run
  220.         CMBTEST <COMBI's_RAM_drive_letter>:
  221. and then
  222.         CMBTEST <some_temporary_directory_on_hard_disk>
  223. and compare the resulted files:
  224.         COMP <path1>*.* <path2>
  225. (<path1(2)> - pathnames of target directories). If all the "files
  226. compare O'K" then there is no error and You may delete the files or
  227. repeat the test with other options. Note: options must be the same for
  228. both runs otherwise the files will be different.
  229. You may also change the program if You have any new ideas how to
  230. improve the test.
  231. Control of operation.
  232. --------------------
  233. A control program COMBI.COM is supplied with the package. It allows
  234. You to change cache or RAM disk options or change memory setting
  235. without reconfiguring and rebooting. It also displays some statistic
  236. information which may be helpful: current options, number of read/write
  237. accesses to hard/RAM disk etc.
  238. Usage:
  239.         COMBI [+/-<mem_change] [<options>...]
  240. where
  241. <mem_change> -  amount of memory (Kbytes) to add to or release from
  242.                 COMBI-disk. If memory can't be reallocated by specified
  243.                 amount COMBI will report that.
  244. <options>    -  a sequence of any of letters 'i', 'o', 'b', 'z', 'f',
  245.                 'r', 'n' which may be separated by spaces and/or
  246.                 followed by '-' which reverses the meaning of the
  247.                 option. Case of the letters is insignificant.
  248. i            -  turn off delayed writing (write immediately) ('i-'
  249.                 turns delayed writing on),
  250. o            -  turn cache on ('o-' - turn off),
  251. b            -  enable background writing ('b-' - disable),
  252. z            -  'freeze' cache - after freezing the sectors which are
  253.                 already in cache remain there (are not purged) while
  254.                 no new sectors are copied to cache. This may be useful
  255.                 e.g. if You have small cache and want to keep there
  256.                 only FAT and directories, then You might run "CHKDSK"
  257.                 (which reads the whole FAT and all the directories)
  258.                 and then "COMBI z". 'z-' returns cache to normal
  259.                 operation.
  260. f            -  fix memory settings - this disables automatic
  261.                 reallocation of XMS memory to other programs.
  262. n            -  tells RAM disk not to return 'sector not found' error.
  263. r            -  resets all statistic counters (there is no 'r-'
  264.                 option).
  265. "COMBI ?" displays quick help on parameters usage.
  266. Source code COMBI.C and header file IOCTL.H are provided if You wish
  267. to implement some control over COMBI-disk into Your applications
  268. Compatibility.
  269. -------------
  270. COMBI-disk is compatible with:
  271.   - MS-DOS versions 3.30 - 5.00 (if it were not it would be useless);
  272.   - DR-DOS version 6.00 (version 5.00 was not tested);
  273.   - Borland's Turbo-debugger TD386 (TD386 uses XMS memory released by
  274.     COMBI-disk);
  275.   - MS-WINDOWS;
  276.   - DJGPP (GNU C++ compiler for DOS and GO32 DOS extender by
  277.     DJDelorie), however LD (DJGPP linker) often runs into "Sector not
  278.     found" error if some of object files are on RAM disk, usage of "N"
  279.     installation option or "COMBI n" solves the problem;
  280.   - many other programs.
  281. COMBI-disk is incompatible with:
  282.   - Maybe some multitasking programs (please report me about any
  283.     incompatibilities).
  284. Possible errors.
  285. ---------------
  286. Sector not found - You tried to read a sector which does not contain
  287.         any valid data (You haven't written into it yet or have  already
  288.         deleted the file that occupied this sector). This never happens
  289.         with the majority of programs. However, for some programs this
  290.         occurs regularly. It is recommended to reply 'Ignore' to the
  291.         'Retry, Ignore, Fail?' DOS prompt. If You are sure that this
  292.         causes no errors You may specify option 'N' as one of
  293.         installation parameters (or run "COMBI n"). In this case the
  294.         'not found' sectors are also not read, but error status is not
  295.         returned by COMBI-disk.
  296. Warning! Once a file is deleted from RAM disk, it might not be correctly
  297. unerased by any means. It's data is lost immediately.
  298. Data error writing drive <RAM_disk> - this may happen when some XMS
  299.         memory has been loaned to a program and that program also tries
  300.         to write some files to RAM disk which has not enough memory for
  301.         that. Suggested action - specify less amount of memory which
  302.         COMBI-disk should release for other programs or configure the
  303.         program to use other drive for temporary files.
  304.         The same problem may arise if a program which used XMS memory
  305.         terminated (or has been aborted) but not released memory. In
  306.         this case COMBI-disk can't reallocate XMS memory back to the
  307.         full size. It continues working but won't use the full buffer
  308.         size for cache or RAM disk data.
  309.         Other errors indicate that either COMBI-Disk internal data tables
  310. are corrupt (e.g. overwritten by other program) or error in XMM driver
  311. encountered.
  312. Some hints.
  313. ----------
  314. "TEMP" environment variable is used by MS-DOS as a directory for
  315. temporary files, in particular when COMMAND.COM creates pipes
  316. (e.g. "dir | sort | more" etc.).
  317. "TMP" environment variable is used by many programs (e.g. Microsoft
  318. compilers) as a directory for temporary files. So, setting TEMP and TMP
  319. in AUTOEXEC.BAT to point to Your RAM disk may improve Your system
  320. performance.
  321. Many other programs also can take advantage of RAM disk - see their
  322. manuals and configure them.
  323. Using write caching is not very dangerous as it might seem. In fact,
  324. when COMBI-disk is configured for background writing it often takes
  325. less time to finish writing to hard disk than without write caching.
  326. Moreover, while data is being written to disk You program continues
  327. working and that saves You a lot of processor time. Enabling delayed
  328. writing as a rule decreases number of hard disk accesses and hard disk
  329. head motions. However, if You start a program that hooks INT 08 (timer)
  330. and does not pass control to former INT 08 handlers (some games often
  331. do so) it would be better if You disable delayed writes ("COMBI i")
  332. before starting such a program and enable it later ("COMBI i-").
  333. Freezing cache ("COMBI z") when it contains certain data may be useful
  334. if COMBI-disk's buffer size is relatively small. E.g. Freezing cache
  335. after "CHKDSK" results in faster search for a file or directory change,
  336. freezing cache after run of some program (whose size is less than cache
  337. size) results in faster loading of that program on future runs (while
  338. other programs operate as without cache).
  339. The name of the game.
  340. --------------------
  341. The name "COMBI" originates from "COMBInation" of such incompatible
  342. (maybe even contradicting) at the first sight programs: RAM disk and
  343. disk cache.
  344. History information.
  345. -------------------
  346. Version 1.10 (01 Dec 1992):
  347. Few bugs of version 1.00 were fixed. These include:
  348.   - "Not enough memory" error under DOS other than MS v.5.00;
  349.   - Very poor performance (worse than without cache) if VERIFY is set ON.
  350. Now COMBI may use HMA under DR-DOS as well.
  351. Performance of cache improved.
  352. Write delay time increased from 5 to 18 clock ticks (1 sec).
  353. Added Ctrl-Alt-Del handling to flush cache before reboot.
  354. COMBI control program renamed from "CMBCTL" (which was hardly typeable
  355. and hardly rememberable) to "COMBI", ANSI sequences are used to provide
  356. color output.
  357. Version 1.00 (08 Aug 1992):
  358. A lot of new features added compared to previous versions: write
  359. caching, reallocation of XMS memory, IOCtl interface to control
  360. operation of COMBI-disk etc. Most of the code has been completely
  361. rewritten. However, the main idea of dynamical memory reallocation
  362. between RAM disk and disk cache remained the same.
  363. Version 0.31 (15 Feb 1992):
  364. Few minor bugs of version 0.30 fixed.
  365. No other serious changes.
  366. Version 0.30 (08 Nov 1991):
  367. Performance of delete from RAM disk operations increased compared to
  368. previous versions.
  369. For certain configuration parameters (e.g. 320 /v 128 256) COMBI-Disk
  370. created FAT larger than really needed. However, it was O'K for DOS 5.0
  371. but led to errors with DOS 3.30.
  372.       - Now it is fixed.
  373. Version 0.20 (28 Oct 1991):
  374. A bug has been discovered in version 0.10: RAM disk failed after an
  375. attempt to write into boot sector and one or more sectors of FAT.
  376.       - Now it is fixed.
  377. DOS 4.0+ CHKDSK did not work with version 0.10 due to simplified
  378. format of boot sector of RAM disk.
  379.       - This is now corrected for MS-DOS 5.0 but some DOS versions need
  380.         a certain text be written into boot sector (e.g. for IBM-DOS 4.0
  381. it is "RDV 1.20" at offset 3 of boot sector). If You are aware
  382.         what You are doing, You may correct this problem for Your DOS.
  383. Version 0.10 (13 Aug 1991):
  384. The very first beta version of COMBI-Disk was version 0.01 (24 Jun 1991).
  385. In this version (0.10) two minor bugs have been fixed:
  386.         A. COMBI-Disk v.0.01 refused to work under DOS 3.30 - not
  387.            just it couldn't but only refused.
  388.         B. Device return codes were corrected.
  389. No any serious bugs were discovered yet.
  390. Future.
  391. ------
  392. Here are some of my ideas about future developement of COMBI:
  393.   - Caching of floppy disks;
  394.   - Special version for 80386 processor (probably, usage of 80386
  395.     instructions may increase performance);
  396.   - Reallocation of XMS memory allocated to other programs is not
  397.     currently supported (some of programs allocate XMS and then reallocate
  398.     it to larger size) - that will be certanly done;
  399.   - As regards usage of EMS instead of XMS, I'm not sure that it would be
  400.     an advantage. However, if there is enough interest in that I'll implement
  401.     EMS support;
  402.   - Further improvement of performance.
  403. ----------------
  404. If You have any questions, comments or find out any problems with
  405. COMBI-disk usage please contact:
  406.         Vadim V. Vlasov,
  407.         Inst. for Nuclear Research of Russian Acad. Sci.,
  408.         60th October Anniversary prospect, 7a,
  409.         117312, Moscow, Russia.
  410.         phone:    7-095-133-6533
  411.         Internet: vvlasov@inucres.msk.su