Microsoft KB Archive/39535

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 17:56, 18 July 2020 by 3155ffGd (talk | contribs) (importing KB archive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


Performance Degradation when Accessing Large Subdirectories

Article ID: 39535

Article Last Modified on 5/10/2003



APPLIES TO

  • Microsoft MS-DOS 2.11 Standard Edition
  • Microsoft MS-DOS 3.1
  • Microsoft MS-DOS 3.2 Standard Edition
  • Microsoft MS-DOS 3.21 Standard Edition
  • Microsoft MS-DOS 3.3 Standard Edition
  • Microsoft MS-DOS 3.3a
  • Microsoft MS-DOS 4.0 Standard Edition
  • Microsoft MS-DOS 4.01 Standard Edition
  • Microsoft MS-DOS 5.0 Standard Edition
  • Microsoft MS-DOS 5.0a
  • Microsoft MS-DOS 6.0 Standard Edition
  • Microsoft MS-DOS 6.2 Standard Edition
  • Microsoft MS-DOS 6.21 Standard Edition
  • Microsoft MS-DOS 6.22 Standard Edition



This article was previously published under Q39535

SUMMARY

You may notice a performance slowdown for MS-DOS when creating many files in a subdirectory. MS-DOS is much slower at accessing a subdirectory that contains many files or deleted files than at accessing a new subdirectory (that is, a subdirectory containing no deleted files).

This slowdown occurs because MS-DOS directories do not get smaller when you delete a file. MS-DOS inserts a "no file here" mark for each deleted file in a directory. There are two different "No file here" marks in the first bytes of directories:

   Value   Description
   -----------------------------------------------------------------
   E5H     No file at this location
   05H     No file at this location
   00H     No file at this location and no files after this location
                

Whenever you create a file, MS-DOS searches to the end of the directory to see if a file with that name already exists. Even if files have been deleted from the directory, MS-DOS must still check for the "No file here" entry for each deleted file.

MORE INFORMATION

The following is an example that demonstrates the reason for the performance slowdown:

  1. Create a directory DIR. Initially, this new directory looks like the following:

          .
          ..
          00H
  2. Create the file FILE1. MS-DOS has to look at two entries to determine that there is no file by that name. The directory now looks like the following:

          .
          ..
          FILE1
          00H
  3. Create the file FILE2. MS-DOS now has to look at three entries to determine that there is no file by that name. The directory now looks like the following:

          .
          ..
          FILE1
          FILE2
          00H
  4. Create the file FILE3. MS-DOS now has to look at four entries to determine that there is no file by that name. The directory now looks like the following:

          .
          ..
          FILE1
          FILE2
          FILE3
          00H
  5. Delete FILE*. The directory now looks like the following:

          .
          ..
          E5
          E5
          E5
          00H
  6. Create the file FILE1. MS-DOS still has to look at four entries to determine that there is no file by that name. (Note that MS-DOS must look at the empty entries thus performance does not improve after the deletion.) The directory now looks like the following:

          .
          ..
          FILE1
          E5H
          E5H
          00H
  7. Create the file FILE2. Again, MS-DOS has to look at four entries to determine that there is no file by that name. The directory now looks like the following:

          .
          ..
          FILE1
          FILE2
          E5H
          00H
  8. Create the file FILE3. MS-DOS has to look at four entries to determine that there is no file by that name. The directory now looks like the following:

          .
          ..
          FILE1
          FILE2
          FILE3
          00H

The performance decreases more when deleted entries exist in a subdirectory; performance can be even slower, depending on the size and type of the disk and the size of the MS-DOS buffer cache (the BUFFERS command in the file CONFIG.SYS). Disk access is very expensive in terms of performance, and depending on the interaction with the MS-DOS buffer cache LRU (Least Recently Used) management, you may have to do more disk accesses.

There are third-party utilities that edit directories and eliminate unused directory entries, improving the performance of MS-DOS.


Additional query words: 6.22 2.x 3.x 4.00 4.01 5.00 5.00a 6.00 6.20 grows

Keywords: KB39535