Older Operating Systems
Total Page:16
File Type:pdf, Size:1020Kb
Older Operating Systems Class Notes # 13 Hard Drive Performance November 13, 2003 Your computer’s performance is strongly influenced by the characteristics of your hard disk. These characteristics of your hard disk include the following: • The speed of your hard disk influences the speed of your system. • The amount of space on your hard disk. • The reliability of the hard disk to store data. DOS provides several techniques to increase the speed at which programs can access information. These techniques are: • Disk Cache • Fastopen • Ram Disk • Defragmenting Disk Cache The most significant way to enhance the performance of your hard disk is to use a disk- caching program. Most programs access the same programs and data repeatedly. Disk cache takes advantage of this by allocating some of the memory for temporary data storage. For example, if a program accesses data, the disk-caching program saves that data in memory (e.g. RAM), on the assumption that the same data will be used again. If a program requires access to the same data again, the disk-caching program intercepts the disk access and gives the program the data stored in memory. The program receives the data quicker since DOS doesn’t require reading the data from hard disk; instead, the disk- caching program finds the data in its cache buffer. The disk-caching program that comes with DOS is called SMARTDRV.EXE, or SMARTdrive. SMARTdrive builds its buffer area in XMS (Extended memory specification) or EMS (Expanded memory specification) memory, using very little conventional memory. When DOS reads information from the disk, it places that information in the cache (due to SMARTdrive), and sends the requested information to the program that requested it. SMARTdrive reads more information than the program requests and stores that information in memory. If the program later requests information that is already in memory, then cache supplies that information faster than DOS can retrieve the information from hard disk. SMARTdrive also eliminates redundant disk writing by placing information on disk only when the data differs from data already stored. The program also accumulates information, writing out data to the hard disk only when a certain amount has accumulated. If you use write caching and a power failure occurs while SMARTdrive is accumulating data, you lose the data that it has not yet written to disk. 1 When the cache must be recycled (new data stored in the cache), the program retains the data in the most frequently used areas and discards the data in the less frequently used area. A cache tends to keep in memory the most heavily used areas of the disk. To start SMARTdrive, enter a command in your autoexec.bat file that has the following syntax: SMARTDRV /X drive± … initsize winsize /E:esize /B:bsize /switches /X: specifies that you want to disable write-behind cache for all drives by default. You can then enable or disable individual drives with the drive± parameter. drive±: If you just specify the drive letter then this will enable read caching and disable write caching. If you specify the drive+ parameter then this will enable read and write caching. If you specify the drive- parameter then this will disable the cache for that drive. initsize: The size (kilobytes) of the cache when SMARTdrive starts. The default values for this parameter is given in table one. winsize: The size (kilobytes) by which SMARTdrive reduces its cache when Microsoft windows starts, freeing that memory for Windows to use. When you quit Windows, that memory is returned to SMARTdrive and defaults to the values listed in table one. Table one: The default memory values for initsize and winsize Extended Memory initsize (cache) winsize (cache) Up to 1 Mbytes All XMS Zero (no caching) Up to 2 Mbytes 1 Mbyte 256 kbytes Up to 4 Mbytes 1 Mbyte 512 kbytes Up to 6 Mbytes 2 Mbyte 1 Mbyte More than 6 Mbytes 2 Mbyte 2 Mbyte /E:esize The element size (bytes), which the amount of cache data that SMARTdrive moves in one operation. Values can be 1024 bytes, 2048 bytes, 4096 bytes, 8192 bytes. The default is 8192 bytes. The smaller the number, the less memory SMARTdrive takes and the slower the performance. /B:bsize The size of the read ahead buffer (bytes that are a multiple of esize), which is how much SMARTdrive reads beyond a disk request. The default is 16384 bytes. The smaller the number, the less conventional memory SMARTdrive takes and the slower the performance. 2 Table two: SMARTdrive switches Switch Description /U If you specify this switch, then SMARTdrive will not load the CD-ROM caching module. /C Clears SMARTdrive by writing all write buffers to disk. /R Resets SMARTdrive by clearing all caches and restarting SMARTdrive /F Writes cached data to the disk after each command finishes, before the DOS command prompts reappears. /N Writes cached data to the disk whenever the system is idle. /V Forces “verbose” mode, so status messages appear when SMARTdrive starts. You cannot use this switch with /Q /Q Forces quite mode, so status messages do not appear when SMARTdrive starts. Only error messages will appear. /Q is the default /S Displays SMARTdrive’s status, including what and how drives are cached and a cache hit statistic. /L Forces SMARTdrive to load into low (conventional) memory even if room exists in upper memory. For SMARTdrive to use extended memory, you must load HIMEM.SYS or some other extended memory manager. Also, if you want SMARTdrive to cache a CD-ROM drive, you have to load MSCDEX into memory before SMARTdrive. Example: To enable read caching for drive C, read and write caching for drive D, and using a 4Mbyte cache for DOS that can get no smaller than 2Mbytes when Microsoft Windows is running, issue the following command: C:\DOS\SMARTDRV C D+ 4096 2048 FASTOPEN Another way to improve hard disk performance is to use the FASTOPEN program. FASTOPEN is an executable program that you can include in AUTOEXEC.BAT. You can also load FASTOPEN through CONFIG.SYS using the install command. You can use FASTOPEN only with hard drives. FASTOPEN caches directory information, holding in memory the locations of frequently used files and directories. DOS typically holds the File Allocation Table (FAT) in the disk buffers, FASTOPEN was developed to hold directory entries in memory. FASTOPEN’s syntax is: FASTOPEN.EXE C:= n /X The C: parameter is the name of the first hard drive that you want FASTOPEN to track. You can specify up to 24 hard disk or hard disk partitions at one time. The /X switch enables FASTOPEN information to reside in EMS. By default, FASTOPEN uses conventional memory. The n parameter is the number of directory entries that FASTOPEN should cache. Each file or subdirectory requires one directory entry. You 3 can enter a value ranging from 10 through 999. If you do not specify a value for n, DOS uses a default value of 48. Each directory entry stored in memory takes 48 bytes. Therefore, the practical range for n is between 100 and 200 per disk. Using too small a number for n also can be a disadvantage. FASTOPEN discards the least recently used entry when it needs space for a new entry. If the n value is too small, DOS discards entries that it still may need. The objective is to have enough entries in memory so that FASTOPEN operates efficiently, but not so many entries that FASTOPEN wastes time searching through directory entries. To load FASTOPEN as part of your regular configuration, use the INSTALL command in your CONFIG.SYS file, as follows: INSTALL = FASTOPEN.EXE C: To load FASTOPEN in upper memory, use LOADHIGH in AUTOEXEC.BAT. For example, LOADHIGH C:\DOS\FASTOPEN C: Note: you must disable FASTOPEN to run the defrag program. Also do not use FASTOPEN with Windows. RAM Disk A RAM disk is a device driver that uses a portion of your computer’s memory to emulate a disk drive. You can use RAM drive as you use any other disk drive. A RAM disk is extremely fast compared with a real disk drive. You must, however, give up a significant amount of memory to create a useful RAM disk. Also you cannot store anything permanent like the disk drive, since the contents of RAM disk disappears when you turn off your computer. The RAM disk driver that comes with DOS is named RAMDRIVE.SYS. To install RAMDRIVE and create a virtual disk, include RAMDRIVE.SYS as a device driver in CONFIG.SYS. The syntax for including RAMDRIVE is: DEVICE = RAMDRIVE.SYS disksize sectorsize entries /E /A The disksize parameter indicates the size of the RAM disk in kilobytes. This number can range from 16 kbytes to 32,767 kbytes. The default is 64 kbytes. The sectorsize parameter represents the size of the sectors used in the virtual disk. You can specify one of three sector sizes: 128 bytes, 256 bytes, or 512 bytes (default = 512 bytes). The entries parameter determines the maximum number of directory entries permitted in the RAM disk’s root directory. This parameter can be a value ranging from 2 through 1024. The default value is 64. 4 Normally, DOS creates a RAM disk in conventional memory. You can include the /E switch to cause the RAM disk to be created in XMS memory. Even with this switch, RAMDRIVE still uses some conventional memory, so you may want to try loading the RAMDRIVE.SYS device driver into upper memory. The following command (in CONFIG.SYS) creates a 1024kbyte RAM disk in XMS memory and loads the device driver into upper memory: DEVICEHIGH = C:\DOS\RAMDRIVE.SYS 1024 /E The /A switch creates the RAM disk in EMS memory.