home *** CD-ROM | disk | FTP | other *** search
/ Zodiac Super OZ / MEDIADEPOT.ISO / FILES / 16 / CCACHE11.ZIP / EQANDA.TXT < prev    next >
Text File  |  1996-06-22  |  21KB  |  532 lines

  1. EQANDA          COPYRIGHT 1995-1996 horio shoichi          EQANDA
  2.  
  3.  
  4.  
  5. NAME
  6.      eqanda.txt - Expected Questions And Answers
  7.  
  8.  
  9. CONTENTS
  10.      This section contains the questions probably raised in using
  11.      concache.exe and the family programs,  the  DOS  disk  cache
  12.      program,  and  their  answers.  Following is the contents of
  13.      this section.
  14.  
  15.           Why And How Cache Programs Speed Up Disk Io ?
  16.           What Are The Elements To Limit Concurrency ?
  17.           How Much Memory Should Be Prepared For Cache ?
  18.           How Concache.exe Can Be Tuned,  In  Terms  Of   Conven-
  19.           tional Memory ?
  20.           Is  There Anything To Note With Relation To Serial Com-
  21.           munications Software ?
  22.           Troubleshooting
  23.  
  24.  
  25. QUESTION
  26.      Why And How Cache Programs Speed Up Disk Io ?
  27.  
  28. ANSWER
  29.      Actually, disk  cache  programs  don't  speed  up  disk  io.
  30.      Instead, they reduce the number of disk io operations.  They
  31.      work to the user program as if disk io is completed as  soon
  32.      as  possible.   They buffer disk data in a large memory area
  33.      called disk cache buffer (hereafter  simply  termed  cache).
  34.      For  read  requests,  if  the  data to be read reside in the
  35.      cache, data is supplied from cache.  Also, data to  be  read
  36.      next by user programs are read and stored in the cache. This
  37.      method of speed up is called "read ahead" or "preread".  For
  38.      write  requests,  the  data to be written is copied into the
  39.      cache and user programs "think" the data to be written   are
  40.      really  written  to  disks. The data are actually written at
  41.      the cache program's convenience. This method of speeding  up
  42.      the  write requests is called "delay write", "write behind",
  43.      "write after", or "postwrite".
  44.  
  45.      First generation of PC cache programs were generally  reluc-
  46.      tant  to  use postwrite. This is thought of as a too special
  47.      luxury.  Data to be written are written to disks as soon  as
  48.      requested.   The  method to handle writes this way is called
  49.      "write-through".
  50.  
  51.      When cache programs arrived on the market  which  use  post-
  52.      write,  it  is found the programs more than double the speed
  53.      of writes. This is because disk allocation table,  known  as
  54.      FAT,  is  located  at  the top of disk and data space at the
  55.  
  56. Concache 1.10       Last Update:  19 June 1996                  1
  57.  
  58.  
  59.  
  60. EQANDA          COPYRIGHT 1995-1996 horio shoichi          EQANDA
  61.  
  62.  
  63.  
  64.      opposite corner, every write request first writes FAT  mark-
  65.      ing  as  used  and then turns head to the allocated area and
  66.      write data sectors.  Postwrite in effect eliminates repeated
  67.      writes  on  FAT  by submitting to DOS yet unwritten FAT. So,
  68.      not only actual number of write operations are  reduced  but
  69.      most  head  movements are eliminated by not needing to actu-
  70.      ally go back and forth to FAT area.
  71.  
  72.      When working on floppy, you might  have  experienced  severe
  73.      performance  degradation if buffers= statement in config.sys
  74.      file is inadequately written.  Also you might have  observed
  75.      writes  get  slow  down as your program proceed.  What cache
  76.      programs do, up to this generation, is to  extend  the  con-
  77.      fig.sys statement buffers= to a large cache buffer.
  78.  
  79.      Next  come so called "advanced" cache programs which attempt
  80.      to write data back concurrently with  user  programs.  These
  81.      cache  programs  don't wait keyboard idle time, for example,
  82.      to write back cached data.  This means traditional DOS  pro-
  83.      grams'  common  inception  that because disk writes are slow
  84.      they must be held into application program's  buffers  until
  85.      absolute  needs  arise to write them back is wrong.  Writing
  86.      data as required is in fact faster and, perhaps less  impor-
  87.      tant, eliminates the need of huge buffers from each applica-
  88.      tion program.  In addition, because data are written as they
  89.      are  produced,  there  are  less  chances of accidental data
  90.      loss.  They become faster, safer and leaner.
  91.  
  92.      It might be possible to think disk speed up has taken  place
  93.      beginning with this generation.
  94.  
  95.      Concache.exe  belongs  to  this  generation,  and  has added
  96.      another generality. It allows concurrency as far as there is
  97.      no  reason  to  refrain  from. The result is one floppy, one
  98.      BIOS disk, and as many as SCSI disks configurable  into  DOS
  99.      can be driven concurrently with DOS/user programs.
  100.  
  101.  
  102. QUESTION
  103.      What Are The Elements To Limit Concurrency ?
  104.  
  105. ANSWER
  106.      From  hardware  point  of  view, floppies can not perform io
  107.      concurrently each other due  to  floppy  controller  design.
  108.      Also, IDE disks cannot.  SCSI disks can perform io in paral-
  109.      lel, as seen on many multiprogramming operating systems.  At
  110.      this  level,  one  floppy,  one  IDE disk and SCSI disks can
  111.      operate concurrently.
  112.  
  113.  
  114.  
  115. Concache 1.10       Last Update:  19 June 1996                  2
  116.  
  117.  
  118.  
  119. EQANDA          COPYRIGHT 1995-1996 horio shoichi          EQANDA
  120.  
  121.  
  122.  
  123.      The next level to consider is BIOS to support io operations.
  124.      As  far  as published BIOS listing is concerned, there is no
  125.      reason floppy and  IDE  disk  cannot  operate  concurrently.
  126.      SCSI drivers are usually written to do io asynchronously.
  127.  
  128.      Here comes BIOS capability to distinguish disk events. Stan-
  129.      dard BIOS handle only two "type"s of disks, which is  suffi-
  130.      cient  for  floppies  and IDE disk environments, as found in
  131.      most PC configurations.  Fortunately,  ASPI  (advanced  SCSI
  132.      programming  interface) specification, now broadly employed,
  133.      supports a mechanism effectively similar to BIOS disk  event
  134.      notification,  called command posting. (See appropriate man-
  135.      ual about  this.)   This  allows  handle  individual  disk's
  136.      events.
  137.  
  138.      At  this  level  no  situations  about  concurrency issue is
  139.      changed.
  140.  
  141.      The next  level  of  the  factor  is  device  driver's  non-
  142.      reentrancy.  Even  if a device driver manages several disks,
  143.      it expects its requests come serially but not while the pre-
  144.      vious  requests are in  progress. In fact, most known device
  145.      drivers lose reentrancy necessary  for  concurrency  at  the
  146.      very first two steps of driver code execution.
  147.  
  148.      Also,  io.sys  handles  int13,  which  is  passed through by
  149.      almost any disk device call, in non-reentrant way.  So,  you
  150.      may  think if third party device driver is used, for example
  151.      using io.sys for  floppies  and  that  for  the  other  disk
  152.      devices, then at least the combination of one floppy and one
  153.      hard disk should work concurrently.  But no. If  both  share
  154.      int13, then they don't work concurrently.
  155.  
  156.      Next  comes the DOS drive letter availability. If, for exam-
  157.      ple, a SCSI disk is split into  two  partitions,  with  many
  158.      good  reasons, the user loses one drive letter for one disk.
  159.      These two partitions cannot share the io operation time.
  160.  
  161.      Those constitute inherent limitations  of  concurrency.   In
  162.      practice,  there are resource limitations for programs under
  163.      DOS.  For example ASPI drivers may limit the number of pack-
  164.      ets that it can accept at once.
  165.  
  166.      Likewise, ccdisk.exe can limit the concurrency of SCSI disks
  167.      from its command line.
  168.  
  169.      Finally, concache.exe can limit concurrency in two ways.
  170.  
  171.      1)   concurrency= option limits  the  number  of  concurrent
  172.           devices.
  173.  
  174. Concache 1.10       Last Update:  19 June 1996                  3
  175.  
  176.  
  177.  
  178. EQANDA          COPYRIGHT 1995-1996 horio shoichi          EQANDA
  179.  
  180.  
  181.  
  182.      2)   io_buffers= option specifies insufficient io buffers to
  183.           let devices work concurrently.
  184.  
  185.  
  186. QUESTION
  187.      How Much Memory Should Be Prepared For Cache ?
  188.  
  189. ANSWER
  190.      There are certainly optimal points of cache  size.  Unfortu-
  191.      nately,  the points are too dependent on application and the
  192.      mix.  There is no clear way to estimate the size and perfor-
  193.      mance of cache.
  194.  
  195.      Fortunately,  concache.exe  allows  change cache size on the
  196.      fly. You can observe the performance of various cache sizes.
  197.      If  adding  memory  doesn't  improve, then probably your mix
  198.      needs more memory, or you decide decrease cache memory  size
  199.      without degrading performance.
  200.  
  201.      A  "pathetic"  looking example is presented below. This kind
  202.      of anomaly is not uncommon in practice.
  203.  
  204.      Consider following hypothetical example.  I  edit,  compile,
  205.      link,  and  debug  programs, just cyclically repeating these
  206.      steps.  For simplicity, assume each  step  requires  exactly
  207.      one  megabyte.   And  assume  each step needs a set of files
  208.      completely unrelated to the other steps (unrealistic  ?  but
  209.      think  simple this way for now.)  Now let's have 3 megabytes
  210.      cache. Then how this 3 mb will be used ?
  211.  
  212.      Each of first three steps loads editor and source files into
  213.      first  megabyte,  loads compiler, header, source, and object
  214.      files into the next megabyte, finally loads loader, library,
  215.      object and exe files into the last megabyte.
  216.  
  217.      The  fourth  step  finds no free megabyte. So it must select
  218.      one from among three. Now familiar algorithm is in its turn.
  219.      Since  the content of first megabyte is least recently used,
  220.      it is considered unlikely to be  used  very  soon.   So  the
  221.      algorithm loads exe file, debugger, test data into, you see,
  222.      into the first megabyte.
  223.  
  224.      I go back to editor. It is not in the first megabyte as  you
  225.      have  just  witnessed.   The editor etc. must be loaded into
  226.      second megabyte under similar fuss.  This  will  purge  com-
  227.      piler and so on from second megabyte. ...
  228.  
  229.      In  this  example  cache  performance is no better than if I
  230.      used only one megabyte cache.  If I added  another  megabyte
  231.      then  the  performance  will be jump improved but adding the
  232.  
  233. Concache 1.10       Last Update:  19 June 1996                  4
  234.  
  235.  
  236.  
  237. EQANDA          COPYRIGHT 1995-1996 horio shoichi          EQANDA
  238.  
  239.  
  240.  
  241.      more does no good.  If your job mix consists of  five  mutu-
  242.      ally  unrelated  steps each requiring one megabyte and cache
  243.      size is four megabytes, then four megabyte space is no  bet-
  244.      ter than one megabyte.
  245.  
  246.      This  extremity comes out of commonly used LRU algorithm and
  247.      extremely simplistic assumptions of usage pattern. The least
  248.      recently  used  space  is unlikely to be used very soon, but
  249.      actually it is in this case.  So, to pick up a victim out of
  250.      already  used  three  megabytes,  let us select it randomly.
  251.      The probability of the survival of the next needed  megabyte
  252.      is  0.67, and cache performance is improved that much, isn't
  253.      it ?
  254.  
  255.      A similar situation is when copying a large file. Never read
  256.      again and never written again records continually flows into
  257.      cache data area, thereby erasing useful data from there. So,
  258.      more  than  double  the file size cache area is necessary to
  259.      keep important data cached.
  260.  
  261.      In practice, however, situation is not that  bad.  Even  for
  262.      file copying, FAT and directory images are repeatedly refer-
  263.      enced from cache data area so disk head movements,  as  well
  264.      as  repeated  reads  and  writes  to these area on disks are
  265.      avoided, thus improving the speed of the copy operation.  In
  266.      the  case  of  file copy, a rather small cache area works as
  267.      well as large ones.
  268.  
  269.  
  270. QUESTION
  271.      How Concache.exe Can Be Tuned, In Terms Of Conventional Mem-
  272.      ory ?
  273.  
  274. ANSWER
  275.      An inevitable penalty of concurrency is memory requirements.
  276.      Each concurrently driven device needs  its  own  io  buffer,
  277.      control and stack space to switch to and fro, request packet
  278.      to organize io, and, for ccdisk.exe, SCSI control block,  in
  279.      addition  to  descriptors  needed for drives managed by con-
  280.      cache.exe.
  281.  
  282.      Following is the description to save memory space used up by
  283.      concache.exe.
  284.  
  285.      First,  you  can load concache.exe into upper memory, either
  286.      through  config.sys  as   a   device   driver   or   through
  287.      autoexec.bat as a TSR (terminate and stay resident).
  288.  
  289.      Second,  io  buffer  size  can  be  changed  by buffer_size=
  290.      option, which can slow down data transfers.  Note  the  size
  291.  
  292. Concache 1.10       Last Update:  19 June 1996                  5
  293.  
  294.  
  295.  
  296. EQANDA          COPYRIGHT 1995-1996 horio shoichi          EQANDA
  297.  
  298.  
  299.  
  300.      must  be  at  least  the  size  of  the largest sector to be
  301.      cached.
  302.  
  303.      Third, the number of io buffers can be changed. This  change
  304.      can  affect  io  performance done by concache.exe so experi-
  305.      ments are needed.
  306.  
  307.      Fourth, directory space can be made at a minimum to the con-
  308.      currency you want.
  309.  
  310.      Fifth,  if  full  stack space, currently 440 - 500 bytes, is
  311.      not used, then it can be reduced to bare minimum  320  bytes
  312.      provided  no  SCSI  disks  are  used.  However,  this may be
  313.      affected by the other external interrupt devices so  experi-
  314.      ments  may  be  needed.  (After all, under DOS, the proof of
  315.      the stack is in the eating.)
  316.  
  317.      Finally, on ccdisk.exe command  line,  concurrency  require-
  318.      ments  can  be  reduced  down  to somewhere bare minimum. If
  319.      unfortunately concurrency mode cannot be used,  then  saying
  320.      "concurrency=1" would save hundreds of bytes.
  321.  
  322.  
  323. QUESTION
  324.      How Concache.exe Can Be Tuned, In Terms Of Performance ?
  325.  
  326. ANSWER
  327.      Speeding  up  is gained by either letting io efficient or by
  328.      taking maximal concurrency.
  329.  
  330.      First, make tick_delay= value larger, to avoid clash between
  331.      DOS  and  concache.exe  write  back actions.  This goes with
  332.      almost no penalties.
  333.  
  334.      Second, make io buffer size or number of io buffers  larger.
  335.      Options  for  these  two  factors  work almost synonymously,
  336.      since concache.exe doesn't do  io  in  fixed  size  buffers.
  337.      This  will improve each io time and, if number of buffers is
  338.      sufficiently large, will also allow concurrent actions.
  339.  
  340.      Third, as cache data area is split into  multiple  units  of
  341.      8kb,  which  is  fairly  large compared to cluster size many
  342.      people prefer, if the drives are heavily fragmented, then  a
  343.      large  amount  of  space  can be wasted in cache area.  Note
  344.      drive fragmentation is not the least influential on  perfor-
  345.      mance, and this is not particular to concache.exe but to all
  346.      disk cache programs that work on FAT oriented file  systems.
  347.  
  348.      Fourth,  splitting  files into disks in a scheme io overlap-
  349.      ping is possible would avoid the io clashes.
  350.  
  351. Concache 1.10       Last Update:  19 June 1996                  6
  352.  
  353.  
  354.  
  355. EQANDA          COPYRIGHT 1995-1996 horio shoichi          EQANDA
  356.  
  357.  
  358.  
  359.      Fifth, although preread improves performance in most  cases,
  360.      it can degrade overall performance in certain cases; if read
  361.      pattern is random then preread is not only useless but  also
  362.      further  slows  down  by  access clashes.  If such files are
  363.      frequently accessed, it might be better move them to a  par-
  364.      tition  that  does  not  preread.   If cache data area is of
  365.      marginal size then preread can purge still useful data  from
  366.      there and instead read out yet unnecessary data.
  367.  
  368.  
  369. QUESTION
  370.      Is There Anything To Note With Relation To Serial Communica-
  371.      tions Software ?
  372.  
  373. ANSWER
  374.      Serial communications are notorious for their severe  timing
  375.      requirements.   For  example,  when  communication  speed is
  376.      38.4kb and the communication device is a  model  that  lacks
  377.      buffer, then each character received through it must be han-
  378.      dled within 25 microsecond.  Failing to handle the  received
  379.      character  within the interval would result in overrun error
  380.      familiar to programmers.  Note this problem is particular to
  381.      receive  side;  a  few  delays  on send side usually make no
  382.      severe problems.
  383.  
  384.      On the other hand since  concache.exe  works  asynchronously
  385.      with  serial  io, disk io is initiated and completed concur-
  386.      rently  with  character  transmissions.   This  means   con-
  387.      cache.exe  causes various housekeepings in DOS context to be
  388.      performed within the short interval, which is almost  impos-
  389.      sible on most PCs other than recent high performance ones.
  390.  
  391.      Alleviations  do exist, fortunately. Following lists several
  392.      of possible ways.
  393.  
  394.  
  395.      write after mode
  396.           This is to avoid  overlapping  operations  with  serial
  397.           transfers, thus the severe timing problem disappears.
  398.  
  399.      buffered controller
  400.           If controller used for serial communication has receive
  401.           buffer it allows  extend  the  short  interval  several
  402.           times longer.  For example, using NS16550 chip enables,
  403.           when properly  programmed,  lengthen  the  interval  16
  404.           times.
  405.  
  406.      hardware flow control
  407.           If  this  is  possible  on your PC and the counterpart,
  408.           this prevents receiving when there is no room to do so,
  409.  
  410. Concache 1.10       Last Update:  19 June 1996                  7
  411.  
  412.  
  413.  
  414. EQANDA          COPYRIGHT 1995-1996 horio shoichi          EQANDA
  415.  
  416.  
  417.  
  418.           thus the short interval is (unlimitedly ?) extended.
  419.  
  420.  
  421. Troubleshooting
  422.      In the following, common conflicts such as irq, dma, memory,
  423.      SCSI option settings are not discussed. They are treated  in
  424.      respective manufacturer's manual, and (probably) not partic-
  425.      ular to concache.exe per se.
  426.  
  427.      First, stack issue  must  be  tried,  as  this  causes  most
  428.      obscure effects on the workings of DOS programs.
  429.  
  430.      Concache.exe   is   designed  to  work  in  the  environment
  431.      stacks=0,0.  However, because of variety of BIOS manufactur-
  432.      ers  and  existence of so many BIOS versions, it is not cer-
  433.      tain the estimate on concache's own  stack  requirements  is
  434.      enough  in  every  environment  it encounters.  In addition,
  435.      there may exist programs which expect a large stack space is
  436.      available  at  any  time.   For  testing  purpose, first try
  437.      "extremely wasteful" stack space  in  config.sys.   If  this
  438.      solves  problem,  your  remaining  task is find out the best
  439.      values for the config.sys line.
  440.  
  441.      Alternately, stacksize= option on concache.exe can be  tried
  442.      to find if concache.exe is experiencing stack overflow.
  443.  
  444.      Let's  discuss  the  problem  in  each mode of concache.exe.
  445.      Respective mode is  to  be  given  by  option  or  by  drive
  446.      description.
  447.  
  448.  
  449.   Fail On Stop Mode
  450.      If  concache.exe  fails in stop mode, there are two cases to
  451.      consider.
  452.  
  453.      CPU overhead concache.exe incurs can be the problem. See the
  454.      section on the relations to communication.  There is no gen-
  455.      eral solutions whatsoever.
  456.  
  457.      The conflict can be between third party  device  drivers  or
  458.      hardware.   The  gnaw_interrupt  option  on concache.exe may
  459.      help in some cases.
  460.  
  461.  
  462.   Write Through Mode Doesn't Work
  463.      Added complexity from stop mode to write through mode is the
  464.      actual access to memory manager and device driver.
  465.  
  466.      Empirically,  conflicts  with memory managers are very rare,
  467.      except for pre-'90 EMS managers.
  468.  
  469. Concache 1.10       Last Update:  19 June 1996                  8
  470.  
  471.  
  472.  
  473. EQANDA          COPYRIGHT 1995-1996 horio shoichi          EQANDA
  474.  
  475.  
  476.  
  477.      Some device drivers may not be prepared with  recent  device
  478.      driver conventions.
  479.  
  480.  
  481.   Write After Mode Doesn't Work
  482.      Concurrency  problems  start  from  this  mode. A variety of
  483.      assumptions about single-taskness of DOS programs  where  io
  484.      actions  are enclosed within DOS context begin to cause con-
  485.      flicts.
  486.  
  487.      Interrupt intensive applications can fail due  to  switching
  488.      overhead caused by concache.exe.  If this might be the case,
  489.      then try write through mode. Slowing down is far better than
  490.      losing data.
  491.  
  492.   Concurrency Mode Fails
  493.      If  write  after mode works but concurrency mode doesn't, it
  494.      seems most of problems  are  of  synchronizations.   One  of
  495.      cases  encountered  while testing compatibilities are due to
  496.      improper int2a8x handling.
  497.  
  498.      For example a network program ignores int2a8x critical  sec-
  499.      tion  interrupts while within int13 period, exactly which is
  500.      what concache.exe is going to do. Consequently, the  program
  501.      miscounts   int2a8x  and  erroneously  identifies  DOS  idle
  502.      period.
  503.  
  504.      Another example.  There  are  certain  periods  concache.exe
  505.      does not want to be interrupted and reentered. In such cases
  506.      it issues DOS synchronization interrupt  and  warns  not  to
  507.      call  DOS.   Unfortunately, the interrupt is ignored or ill-
  508.      treated, thus causing hang.
  509.  
  510.  
  511. SEE ALSO
  512.      ccdisk.txt, concache.txt, floppies.txt, overview.txt.
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528. Concache 1.10       Last Update:  19 June 1996                  9
  529.  
  530.  
  531.  
  532.