home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / DOS_HELP / DISKBUF2.ZIP / DISKBUF.DOC < prev    next >
Encoding:
Text File  |  1989-11-02  |  18.3 KB  |  428 lines

  1.  
  2.  
  3.                                      DISKBUF
  4.  
  5.                    A Program to Optimize the BUFFERS= Setting
  6.                                  Version 2.00(2)
  7.  
  8.                                        by
  9.  
  10.                                   W. G. Madison
  11.  
  12.  
  13.                                Copyright 1987, '89 
  14.                         W.G. Madison and Associates, Ltd.
  15.                               All rights reserved.
  16.  
  17.  
  18.                                 November 1, 1989
  19.  
  20.  
  21.         NOTICE: The program DiskBuf and this associated documentation are 
  22.         copyrighted products. They may be freely distributed, provided 
  23.         only that both the program and documentation are distributed 
  24.         together, that no modification is made to either the program or 
  25.         the documentation, and that no charge other than a copying charge 
  26.         not to exceed $6.00 is levied on the recipient. Disk distributors 
  27.         may include promotional text with this program, provided that 
  28.         such text appears as a separate file or as text appended to this 
  29.         documentation. If appended to this document, such text must be 
  30.         readily identifiable as to its source and must appear ONLY at the 
  31.         end of the document file. Finally, neither the author nor MADISON 
  32.         AND ASSOCIATES assume any responsibility or liability for actual 
  33.         or consequential damages arising from the use of this program, 
  34.         even if they have been notified in advance of the possibility of 
  35.         occurrence of such damages.
  36.  
  37.         We would like to know of your experience with DiskBuf. Please 
  38.         address any criticisms or comments to:
  39.  
  40.                         W.G. Madison and Associates, Ltd.
  41.                         Consultants / Information Systems
  42.                                   P. O. Box 898
  43.                                Greenbelt, MD 20770
  44.                                   (301)552-7234
  45.                              (CompuServe  73240,342)
  46.  
  47.  
  48.                 * * * * * * * * * * * * * * * * * * * * * * * * *
  49.  
  50.  
  51.         Acknowledgment: Release 1 of this program was based upon ideas 
  52.         gleaned from the public domain program THRASHER, by Monte Fergu-
  53.         son of Ravenna, OH. This release, 2.00(2), has been enhanced as a 
  54.         result of several user suggestions received over the intervening 
  55.         two years. My thanks to all who have contributed.
  56.  
  57.  
  58.  
  59.  
  60.                                    1
  61.  
  62.  
  63.  
  64.         Disclaimer: This program is provided AS IS, with no claim for 
  65.         suitability for any particular purpose. Specifically, since the 
  66.         program is necessarily extremely disk intensive and therefore 
  67.         exercises the head positioning mechanism far more than is custom-
  68.         ary in normal use, the Author and W. G. Madison and Associates, 
  69.         Ltd. disclaim any and all responsibility for actual and/or con-
  70.         sequential damages to hardware and/or files resulting from the 
  71.         use of this program.
  72.  
  73.  
  74.         INTRODUCTION:
  75.  
  76.              All personal computers using the DOS operating system (PC-
  77.         DOS, MS-DOS, etc.) use buffered I/O when reading from or writing 
  78.         to the disk, unless the programmer who wrote the software being 
  79.         used went to great lengths to avoid it. The number of buffers 
  80.         used is specified in the file CONFIG.SYS, which is read at the 
  81.         time the computer is booted up.
  82.  
  83.              If you are not familiar with the CONFIG.SYS file or with the 
  84.         concept of buffered I/O, it is strongly suggested that you refer 
  85.         to your DOS reference manual before proceeding further.
  86.  
  87.              The problem of determining the proper number of buffers with 
  88.         which to configure a DOS computer is, at best, inadequately add-
  89.         ressed in most DOS reference manuals. Generally, the suggested 
  90.         approach is "Try a number, then use your computer, then try 
  91.         another number. Keep repeating this process until you are either 
  92.         fed up or have arrived at something which gives acceptable per-
  93.         formance." Some reference manuals give a suggested value to be 
  94.         used by those looking for an easy out. This suggested value may 
  95.         or may not yield performance which is close to optimum.
  96.  
  97.              DiskBuf provides a method for scanning through an entire 
  98.         range of values while you go out for coffee (or something 
  99.         stronger).
  100.  
  101.  
  102.         WHY WORRY ABOUT THE NUMBER OF BUFFERS?
  103.  
  104.              As might be expected, buffering uses RAM. Specifically, each 
  105.         buffer added to a DOS system uses 33 paragraphs (528 bytes) of 
  106.         RAM. Assuming that plenty of RAM is available, it might be tempt-
  107.         ing to take the approach, "Let's just set the number of buffers 
  108.         way up, and fly with that." Unfortunately, one can reach the 
  109.         point where more time is spent searching buffers for information 
  110.         than is necessary or desirable. A point of diminishing returns is 
  111.         reached.
  112.  
  113.              Similarly, too few buffers will cause the computer to go to 
  114.         the disk more often than necessary. And, since disk operations 
  115.         are dreadfully slow in comparison to memory operations, unaccept-
  116.         able performance degradation will result.
  117.  
  118.  
  119.  
  120.  
  121.                                    2
  122.  
  123.  
  124.  
  125.         WHY USE THE DISKBUF PROGRAM TO SOLVE THE PROBLEM?
  126.  
  127.              Basically, without an intimate knowledge of the insides of 
  128.         DOS plus a penchant for solving complex mathematical problems, 
  129.         there are three feasible methods for attacking the problem. The 
  130.         first is to pick a number (based either upon your liking for 
  131.         indulging in Russian roulette, or upon recommendations from 
  132.         friends or the DOS reference manual) and put your trust in the 
  133.         tooth fairy as to the appropriateness of the number. The second 
  134.         is to try to determine the number by systematic trial and error, 
  135.         editing your CONFIG.SYS file over a period of time. The third 
  136.         method is to set up an automatic process which can sweep through 
  137.         a series of values, perform a realistic test with each value, and 
  138.         record the results for later analysis.
  139.  
  140.              The DISKBUF program permits this third approach to be taken 
  141.         easily. By using DISKBUF, you can readily determine the optimum 
  142.         number of buffers to be used, based not only upon time to perform 
  143.         the test but also upon the amount of RAM occupied by the buffers. 
  144.         You can decide, and have some rational basis for the decision, 
  145.         whether you are willing to sacrifice X bytes of additional RAM in 
  146.         order to gain an additional Y% performance improvement from your 
  147.         disk operations.
  148.  
  149.              Sure beats flying by the seat of the pants, no?
  150.  
  151.  
  152.  
  153.         HOW DO I USE DISKBUF?
  154.  
  155.              Seven files are included in the file DISKBUF.ZIP. They are, 
  156.         respectively:
  157.  
  158.                   DISKBUF.DOC    (This file)
  159.                   DISKBUF.EXE    (The operational program)
  160.                   AUTOEXEC.BAT   (A specimen AUTOEXEC file)
  161.                   BUFTST-1.EXE   (One of the two provided test modules. 
  162.                                  This is the test you would probably want 
  163.                                  to use if your typical activity involved 
  164.                                  accessing many files scattered over the 
  165.                                  disk.)
  166.                   BUFTST-2.EXE   (The second of the two provided test 
  167.                                  modules. This is the test you would 
  168.                                  probably want to use if your typical 
  169.                                  activity involved random accessing of a 
  170.                                  relatively few large files.)
  171.                   BUFFTEST.EXE   (A copy of BUFTST-1.EXE. This copy is 
  172.                                  the one which will actually be used in 
  173.                                  testing.)
  174.                   PLOTBUF.COM    (The program to produce a screen plot of 
  175.                                  the test results. Assumes a CGA card.) 
  176.  
  177.              Examine the AUTOEXEC.BAT file. You will see, as the last 
  178.         line of the file, the line invoking DISKBUF. In the REMark lines 
  179.         preceding this, you will see guidelines for setting the switch 
  180.  
  181.  
  182.                                    3
  183.  
  184.  
  185.  
  186.         values to be passed to DISKBUF. The switches are:
  187.  
  188.                             /TARGET=     (Sets the disk to be tested)
  189.                             /MAXBUF=     (Sets the stopping point (maxi-
  190.                                          mum number of buffers) for the 
  191.                                          test)
  192.                             /MINBUF=     (Sets the starting point (mini-
  193.                                          mum number of buffers) for the 
  194.                                          test)
  195.                             /PLOT        (If present, a screen plot of 
  196.                                          the test results will be pro-
  197.                                          duced)
  198.  
  199.              The first two switches, /TARGET= and /MAXBUF= are required; 
  200.         the other two, /MINBUF= and /PLOT are optional.
  201.  
  202.              /TARGET=xx     takes as an argument a valid disk device 
  203.         designator, with the appended colon being optional. This deter-
  204.         mines the device or partition which is to be tested. (Required)
  205.  
  206.              /MAXBUF=nn     takes as an argument an integer between 1 and 
  207.         99, and determines the greatest number of buffers to be used in 
  208.         the test. (Required)
  209.  
  210.              /MINBUF=nn     also takes as an argument an integer between 
  211.         1 and 99, and determines the starting number of buffers to be 
  212.         used in the test. If this switch is omitted, a starting value of 
  213.         3 will be used. (Optional)
  214.  
  215.              /PLOT          determines by its presence or absence whether 
  216.         or not a screen plot of the test results will be produced at the 
  217.         completion of the test. NOTE: If your computer does not have a 
  218.         graphics card, this switch must not be included! (Optional)
  219.  
  220.  
  221.              To use DISKBUF, the following steps are required.
  222.  
  223.              STEP 1.   Format a floppy disk using the /S switch to make 
  224.         the disk bootable.
  225.  
  226.              STEP 2.   Edit the AUTOEXEC.BAT file provided with the 
  227.         DISKBUF distribution set, to invoke DISKBUF with the switch set-
  228.         tings you want used.
  229.  
  230.              STEP 3.   Copy the edited AUTOEXEC.BAT file and the program 
  231.         file DISKBUF.COM onto the disk prepared at Step 1.
  232.  
  233.              STEP 4.   Copy your own CONFIG.SYS file onto the disk 
  234.         prepared at Step 1. If necessary, edit the CONFIG.SYS to make 
  235.         sure that the BUFFERS= parameter is ***OUTSIDE*** the range 
  236.         determined by the MAXBUF= and MINBUF= parameters in the 
  237.         AUTOEXEC.BAT file. (For that matter, if you simply delete the 
  238.         BUFFERS= line from the CONFIG.SYS file, DISKBUF will manage it 
  239.         appropriately.)
  240.  
  241.  
  242.  
  243.                                    4
  244.  
  245.  
  246.  
  247.              STEP 5.   Copy any device drivers to be installed by the 
  248.         CONFIG.SYS over to the floppy. Do the same for any resident 
  249.         programs to be installed by the AUTOEXEC.BAT.
  250.  
  251.              STEP 6.   Copy DISKBUF.EXE to the floppy. If /PLOT is 
  252.         selected in the AUTOEXEC.BAT, copy PLOTBUF.EXE to the floppy.
  253.  
  254.              STEP 7.   Decide, based on the descriptions given above, 
  255.         which of the two test modules you wish to use. Copy the desired 
  256.         module to the floppy as BUFFTEST.EXE using the DOS COPY command. 
  257.         (For the average user, we believe that BUFTST-1.EXE more nearly 
  258.         reflects typical usage; it is therefore the one already set up.)
  259.  
  260.              STEP 8.   Re-boot your computer.
  261.  
  262.              STEP 9.   Go to lunch, and come back in an hour or so. 
  263.         (Optional)
  264.  
  265.  
  266.              When the test is completed, two new files will be on the 
  267.         floppy disk:
  268.  
  269.                        BUFFERS.RPT contains the test results, giving for 
  270.                                    each number of buffers tested a figure 
  271.                                    of merit and the minimum requirement 
  272.                                    of RAM (in bytes) for DOS.
  273.                        BUFFERS.PLT contains information used by the pro-
  274.                                    gram PLOTBUF.COM. Specifically, each 
  275.                                    line contains the number of buffers 
  276.                                    tested and the figure of merit.
  277.  
  278.  
  279.              The figure of merit for a given number of buffers is propor-
  280.         tional to the time required for the test. Thus, SMALLER is 
  281.         BETTER. The minimum figure of merit is the one you want (ignoring 
  282.         the amount of space occupied by the buffers).
  283.  
  284.              Note that, if /PLOT was selected, the screen plot only dis-
  285.         plays a limited range of the figure of merit values. Specific-
  286.         ally, the range displayed is from the minimum figure of merit to 
  287.         5% greater than this value. All figures of merit greater than 
  288.         this are clipped at this level for plotting purposes. This was 
  289.         done in order to better present the detail of the values only 
  290.         slightly worse than the minimum value.
  291.  
  292.              The screen plot may be recreated at any time by running 
  293.         PLOTBUF. The only restriction is that the file BUFFERS.PLT must 
  294.         be in the current disk and directory. 
  295.  
  296.              Should you wish to test against two different disks, the 
  297.         files BUFFERS.* must be copied or renamed before the second test 
  298.         is conducted. If this is not done, the files will be over-written 
  299.         and the results of the earlier test will therefore be lost.
  300.  
  301.  
  302.  
  303.  
  304.                                    5
  305.  
  306.  
  307.  
  308.              Should you wish to re-test the disk using the other provided 
  309.         test, simply return to Step 7 above and proceed from there. It 
  310.         will not be necessary to edit the CONFIG.SYS file, since (unless 
  311.         you are also increasing the MAXBUF= setting in the AUTOEXEC.BAT 
  312.         file) the BUFFERS= setting is guaranteed to be outside the 
  313.         testing range.
  314.  
  315.  
  316.         HOW CAN I DESIGN MY OWN TEST MODULES?
  317.  
  318.              Two fundamentally different test modules are provided which 
  319.         represent quite different testing scenarios. 
  320.  
  321.              BUFTST-1.EXE examines the directory entry for each file in 
  322.         every directory on the disk being tested. Thus, it simulates a 
  323.         situation in which the user is accessing many files in any given 
  324.         session.
  325.  
  326.              BUFTST-2.EXE writes a single large (1000 record, 100 bytes 
  327.         per record) file in the root directory of the target disk. It 
  328.         then interchanges record 1 with record 1000, record 2 with record 
  329.         999, etc. Having completed this sub-test, it then interchanges 
  330.         record 1 with record 2, record 2 with record 3, ... record 999 
  331.         with record 1000. Thus, it simulates both sequential and random 
  332.         usage of large files.
  333.  
  334.              You are free to generate your own tests as you will. These 
  335.         tests can be implemented in either executable (.EXE or .COM) 
  336.         files, or in batch control (.BAT) files. In either case, the file 
  337.         name **must** be BUFFTEST (i.e., BUFFTEST.COM, BUFFTEST.EXE, or 
  338.         BUFFTEST.BAT). The test module must expect a single command line 
  339.         parameter of the form <d>:\ where <d> is the drive letter of the 
  340.         drive to be tested. 
  341.  
  342.              One word of caution. It is important that the operations 
  343.         being performed be exactly duplicated from run to run, if the 
  344.         output data are to accurately reflect your system behavior. Thus 
  345.         if you have, e.g., put together a batch file (BUFFTEST.BAT) which 
  346.         performs a MAKE, it is important that you recognize ahead of time 
  347.         just which files will be created as a result of the MAKE, and 
  348.         delete them prior to terminating your BUFFTEST.BAT.
  349.  
  350.  
  351.         HOW DOES DISKBUF DO ALL THAT GOOD STUFF?
  352.  
  353.              When DISKBUF is invoked, it performs the following 
  354.         steps:
  355.  
  356.              STEP 0.   Read and parse command tail. Set operating par-
  357.              ameters, based on the contents of the command tail.
  358.  
  359.              STEP 1.   Edit the file CONFIG.SYS on the floppy disk.
  360.  
  361.  
  362.  
  363.  
  364.  
  365.                                    6
  366.  
  367.  
  368.  
  369.                   STEP 1A.   If the BUFFERS= line is present, read it to 
  370.                   extract the current BUFFERS=  setting. 
  371.  
  372.  
  373.                        STEP 1A1. If this setting is not between MINBUF 
  374.                        and MAXBUF then re-write CONFIG.SYS with a 
  375.                        BUFFERS=  setting equal to the value of MINBUF, 
  376.                        and go to STEP 1C.
  377.  
  378.                        STEP 1A2. If the setting is between MINBUF and 
  379.                        MAXBUF then go to STEP 2.
  380.  
  381.                   STEP 1B.  If not present, append a BUFFERS= statement 
  382.                   with a BUFFERS= setting equal to the value of MINBUF.
  383.  
  384.                   STEP 1C.  Delete the BUFFERS.* files if they are pres-
  385.                   ent, and re-boot the system.
  386.  
  387.              STEP 2.   Start the timer. 
  388.  
  389.              STEP 3.   Perform the selected test.
  390.  
  391.              STEP 4.   Stop the timer.
  392.  
  393.              STEP 5.   Calculate the figure of merit, and append a record 
  394.              to BUFFERS.RPT.  Also append a record to BUFFERS.PLT.
  395.  
  396.              STEP 6.   Check the current setting of BUFFERS= against the 
  397.              value of MAXBUF.
  398.  
  399.                   STEP 6A.  If buffer setting < MAXBUF, re-edit the 
  400.                   existing CONFIG.SYS file, incrementing the buffer set-
  401.                   ting and re-boot the system.
  402.  
  403.                   STEP 6B.  Otherwise, the test is completed. 
  404.  
  405.                        STEP 6B1. Leave the CONFIG.SYS file on the floppy 
  406.                        disk with a BUFFERS= setting at MAXBUF + 1.
  407.  
  408.                        STEP 6B2. If /PLOT is selected, plot the test 
  409.                        results.
  410.  
  411.                        STEP 6B3. Exit to DOS.
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.                                    7
  427.  
  428.