home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / DOS_HELP / DISKBUF.ZIP / DISKBUF.DOC < prev    next >
Encoding:
Text File  |  1987-05-18  |  12.5 KB  |  306 lines

  1.  
  2.  
  3.  
  4.                                      DISKBUF
  5.  
  6.                    A Program to Optimize the BUFFERS= Setting
  7.  
  8.                                        by
  9.  
  10.                                   W. G. Madison
  11.                         W.G. Madison and Associates, Ltd.
  12.                              8425 Greenbelt Rd. #101
  13.                                Greenbelt MD 20770
  14.                                   301/552-9309
  15.                              (CompuServe 73240,342)
  16.  
  17.                                   May 15, 1987
  18.  
  19.  
  20.         Acknowledgment: This program is based upon ideas gleaned from the 
  21.         public domain program THRASHER, by Monte Ferguson of Ravenna, OH.
  22.  
  23.         Disclaimer: This program is provided AS IS, with no claim for 
  24.         suitability for any particular purpose. Specifically, since the 
  25.         program is necessarily extremely disk intensive and therefore 
  26.         exercises the head positioning mechanism far more than is custom-
  27.         ary in normal use, the Author and W. G. Madison and Associates, 
  28.         Ltd. disclaim any and all responsibility for actual and/or con-
  29.         sequential damages to hardware and/or files resulting from the 
  30.         use of this program.
  31.  
  32.  
  33.         INTRODUCTION:
  34.  
  35.              All personal computers using the DOS operating system (PC-
  36.         DOS, MS-DOS, etc.) use buffered I/O when reading from or writing 
  37.         to the disk, unless the programmer who wrote the software being 
  38.         used went to great lengths to avoid it. The number of buffers 
  39.         used is specified in the file CONFIG.SYS, which is read at the 
  40.         time the computer is booted up.
  41.  
  42.              If you are not familiar with the CONFIG.SYS file or with the 
  43.         concept of buffered I/O, it is strongly suggested that you refer 
  44.         to your DOS reference manual before proceeding further.
  45.  
  46.              The problem of determining the proper number of buffers with 
  47.         which to configure a DOS computer is, at best, inadequately add-
  48.         ressed in most DOS reference manuals. Generally, the suggested 
  49.         approach is "Try a number, then use your computer, then try 
  50.         another number. Keep repeating this process until you are either 
  51.         fed up or have arrived at something which gives acceptable per-
  52.         formance." Some reference manuals give a suggested value to be 
  53.         used by those looking for an easy out. This suggested value may 
  54.         or may not yield performance which is close to optimum.
  55.  
  56.              DiskBuf provides a method for scanning through an entire 
  57.         range of values while you go out for coffee (or something 
  58.         stronger).
  59.  
  60.  
  61.                                    1
  62.  
  63.  
  64.  
  65.  
  66.  
  67.         WHY WORRY ABOUT THE NUMBER OF BUFFERS?
  68.  
  69.              As might be expected, buffering uses RAM. Specifically, each 
  70.         buffer added to a DOS system uses 33 paragraphs (528 bytes) of 
  71.         RAM. Assuming that plenty of RAM is available, it might be tempt-
  72.         ing to take the approach, "Let's just set the number of buffers 
  73.         way up, and fly with that." Unfortunately, one can reach the 
  74.         point where more time is spent searching buffers for information 
  75.         than is necessary or desirable. A point of diminishing returns is 
  76.         reached.
  77.  
  78.              Similarly, too few buffers will cause the computer to go to 
  79.         the disk more often than necessary. And, since disk operations 
  80.         are dreadfully slow in comparison to memory operations, unaccept-
  81.         able performance degradation will result.
  82.  
  83.  
  84.         WHY USE THE DISKBUF PROGRAM TO SOLVE THE PROBLEM?
  85.  
  86.              Basically, without an intimate knowledge of the insides of 
  87.         DOS plus a penchant for solving complex mathematical problems, 
  88.         there are three feasible methods for attacking the problem. The 
  89.         first is to pick a number (based either upon your liking for 
  90.         indulging in Russian roulette, or upon recommendations from 
  91.         friends or the DOS reference manual) and put your trust in the 
  92.         tooth fairy as to the appropriateness of the number. The second 
  93.         is to try to determine the number by systematic trial and error, 
  94.         editing your CONFIG.SYS file over a period of time. The third 
  95.         method is to set up an automatic process which can sweep through 
  96.         a series of values, perform a realistic test with each value, and 
  97.         record the results for later analysis.
  98.  
  99.              The DISKBUF program permits this third approach to be taken 
  100.         easily. After using DISKBUF, you can readily determine the op-
  101.         timum number of buffers to be used, based not only upon time to 
  102.         perform the test but also upon the amount of RAM occupied by the 
  103.         buffers. You can decide, and have some rational basis for the 
  104.         decision, whether you are willing to sacrifice X bytes of addi-
  105.         tional RAM in order to gain an additional Y% performance improve-
  106.         ment from your disk operations.
  107.  
  108.              Sure beats flying by the seat of the pants, no?
  109.  
  110.  
  111.  
  112.         HOW DO I USE DISKBUF?
  113.  
  114.              Four files are included in the file DISKBUF.ARC. They are, 
  115.         respectively:
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.                                    2
  123.  
  124.  
  125.  
  126.                             DISKBUF.DOC  (This file)
  127.                             DISKBUF.COM  (The operational program)
  128.                             AUTOEXEC.BAT (A specimen AUTOEXEC file)
  129.                             PLOTBUF.COM  (A program to produce a screen
  130.                                          plot of the test results. 
  131.                                          Duplicates code contained in
  132.                                          DISKBUF.COM)
  133.  
  134.              Examine the AUTOEXEC.BAT file. You will see, as the last 
  135.         line of the file, the line invoking DISKBUF. In the REMark lines 
  136.         preceding this, you will see guidelines for setting the switch 
  137.         values to be passed to DISKBUF. The switches are:
  138.  
  139.                             /TARGET:  (Sets the disk to be tested)
  140.                             /MAXBUF:  (Sets the stopping point for the 
  141.                                       test)
  142.                             /MINBUF:  (Sets the starting point for the
  143.                                       test)
  144.                             /PLOT     (If present, a screen plot of the
  145.                                       test results will be produced)
  146.  
  147.              The first two switches, /TARGET: and /MAXBUF: are required; 
  148.         the other two, /MINBUF: and /PLOT are optional.
  149.  
  150.              /TARGET:xx     takes as an argument a valid disk device 
  151.         designator, with the appended colon being optional. This deter-
  152.         mines the device which is to be tested. (Required)
  153.  
  154.              /MAXBUF:nn     takes as an argument an integer between 1 and 
  155.         99, and determines the greatest number of buffers to be used in 
  156.         the test. (Required)
  157.  
  158.              /MINBUF:nn     also takes as an argument an integer between 
  159.         1 and 99, and determines the starting number of buffers to be 
  160.         used in the test. If this switch is omitted, a starting value of 
  161.         3 will be used. (Optional)
  162.  
  163.              /PLOT          determines by its presence or absence whether 
  164.         or not a screen plot of the test results will be produced at the 
  165.         completion of the test. NOTE: If your computer does not have a 
  166.         graphics card, this switch must not be included! (Optional)
  167.  
  168.  
  169.              To use DISKBUF, four steps are required.
  170.  
  171.              STEP 1.   Format a disk using the /S switch to make the disk 
  172.         bootable.
  173.  
  174.              STEP 2.   Edit the AUTOEXEC.BAT file, to invoke DISKBUF with 
  175.         the switch settings you want to be used.
  176.  
  177.              STEP 3.   Copy the edited AUTOEXEC.BAT file and the program 
  178.         file DISKBUF.COM onto the disk prepared at Step 1.
  179.  
  180.              STEP 4.   Re-boot your computer.
  181.  
  182.  
  183.                                    3
  184.  
  185.  
  186.  
  187.  
  188.              STEP 5.   Go to lunch, and come back in an hour or so. 
  189.         (Optional)
  190.  
  191.  
  192.              When the test is completed, two new files will be on the 
  193.         disk:
  194.  
  195.                        BUFFERS.RPT contains the test results, giving for
  196.                                    each number of buffers tested a figure
  197.                                    of merit and the minimum requirement
  198.                                    of RAM (in bytes) for DOS.
  199.                        BUFFERS.PLT contains information used by the 
  200.                                    program PLOTBUF.COM. Specifically, 
  201.                                    each line contains the number of buff-
  202.                                    ers tested and the figure of merit.
  203.  
  204.  
  205.              The figure of merit for a given number of buffers is propor-
  206.         tional to the time required for the test. Thus, SMALLER is 
  207.         BETTER. The minimum figure of merit is the one you want (ignoring 
  208.         the amount of space occupied by the buffers).
  209.  
  210.              Note that, if /PLOT was selected, the screen plot only dis-
  211.         plays a limited range of the figure of merit values. Specific-
  212.         ally, the range displayed is from the minimum figure of merit to 
  213.         5% greater than this value. All figures of merit greater than 
  214.         this are clipped at this level for plotting purposes. 
  215.  
  216.              This was done in order to better present the detail of the 
  217.         values only slightly worse than the minimum value.
  218.  
  219.              The screen plot may be recreated at any time by running 
  220.         PLOTBUF. The only restriction is that the file BUFFERS.PLT must 
  221.         be in the current disk and directory. 
  222.  
  223.              Should you wish to test against two different disks, the 
  224.         files BUFFERS.* must be copied or renamed before the second test 
  225.         is conducted. If this is not done, the files will be over-written 
  226.         and the results of the earlier test will therefore be lost.
  227.  
  228.  
  229.         HOW DOES DISKBUF DO ALL THAT GOOD STUFF?
  230.  
  231.              When DISKBUF is invoked, it performs the following 
  232.         steps:
  233.  
  234.              STEP 0.   Read and parse command tail. Set operating par-
  235.              ameters, based on the contents of the command tail.
  236.  
  237.              STEP 1.   Check for the presence of the file CONFIG.SYS on 
  238.              the default disk.
  239.  
  240.  
  241.  
  242.  
  243.  
  244.                                    4
  245.  
  246.  
  247.  
  248.                   STEP 1A.   If present, read it to extract the current 
  249.                   BUFFERS=  setting. 
  250.  
  251.  
  252.                        STEP 1A1. If this setting is not between MINBUF 
  253.                        and MAXBUF then re-write CONFIG.SYS with a 
  254.                        BUFFERS=  setting equal to the value of MINBUF, 
  255.                        and go to STEP 1C.
  256.  
  257.                        STEP 1A2. If the setting is between MINBUF and 
  258.                        MAXBUF then go to STEP 2.
  259.  
  260.                   STEP 1B.  If not present, create it with a BUFFERS= 
  261.                   setting equal to the value of MINBUF.
  262.  
  263.                   STEP 1C.  Delete the BUFFERS.* files if they are pres-
  264.                   ent, and re-boot the system.
  265.  
  266.              STEP 2.   Start the timer. Create a file in the root direct-
  267.              ory of the disk to be tested, containing 1000 records of 100 
  268.              bytes each.
  269.  
  270.              STEP 3.   Perform the EXCHANGE test, by interchanging 
  271.              records 1 and 1000, 2 and 999,...,500 and 501.
  272.  
  273.              STEP 4.   Perform the SHUFFLE test, by interchanging records 
  274.              1 and 2, 2 and 3,...,999 and 1000. Stop the timer.
  275.  
  276.              STEP 5.   Calculate the figure of merit, and append a record 
  277.              to BUFFERS.RPT.  If /PLOT then append a record to 
  278.              BUFFERS.PLT.
  279.  
  280.              STEP 6.   Check the current setting of BUFFERS= against the 
  281.              value of MAXBUF.
  282.  
  283.                   STEP 6A.  If buffer setting < MAXBUF, overwrite the 
  284.                   existing CONFIG.SYS file, incrementing the buffer set-
  285.                   ting and re-boot the system.
  286.  
  287.                   STEP 6B.  Otherwise, the test is completed. 
  288.  
  289.                        STEP 6B1. Delete the test file from the root dir-
  290.                        ectory of the disk being tested. Delete CONFIG.SYS 
  291.                        from the default disk.
  292.  
  293.                        STEP 6B2. If /PLOT is selected, plot the test 
  294.                        results.
  295.  
  296.                        STEP 6B3. Exit to DOS.
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.                                    5
  306.