
Title: Windows 3.1 SMARTDrive: Questions and Answers 
Document Number: Q81617           Publ Date: 14-JUL-1992 
Product Name: Microsoft Windows 3 Retail Product 
Product Version:  3.10 
Operating System: WINDOWS 

 Summary: 
                      Microsoft Windows, Version 3.1 
                Automated Product Support Service Fax-Script 
                      Questions and Answers: SMARTDrive 
                -------------------------------------------- 
 1. Q. Why is SMARTDrive in both my CONFIG.SYS and AUTOEXEC.BAT files? 
    A. This is because there are really two device drivers in a single file: 
       a disk cache and a double buffer driver. See Question 2 for a 
       description of double buffering. The cache component of SMARTDRV.EXE 
       is installed in the AUTOEXEC.BAT file and the double buffer driver is 
       installed in the CONFIG.SYS file. 
 2. Q. What is double buffering? 
    A. Certain disk controllers support a concept called bus mastering where 
       the disk controller takes over a computer's bus in order to directly 
       transfer data to and from memory. Sometimes a problem can occur when 
       running an MS-DOS-based application in the 386 enhanced mode of 
       Windows. In this mode, MS-DOS applications are running in a virtual 
       machine. Virtual machines don't have physical memory addresses. So, 
       the address that is passed to your bus mastering controller is not 
       always a physical memory address. This can cause data to be read from 
       the wrong location or, worse, can cause data to be written to the 
       wrong place in memory. The result can be erratic or dysfunctional 
       system behavior. 
       Microsoft created a standard called Virtual DMA Services that 
       provides an interface that allows these bus master controllers to get 
       correct addresses and avoid this problem. However, some older bus 
       master controller cards do not support this standard. To provide a 
       solution for this, we have added a feature to SMARTDrive. SMARTDrive 
       can provide a memory buffer that has physical and virtual addresses 
       that are the same. This allows you to avoid the problem even with an 
       older bus mastering controller. 
       This feature is used by placing the following line in the CONFIG.SYS 
       file: 
          device=smartdrv.exe /double_buffer 
       This will install only the double-buffering capabilities of 
       SMARTDrive. You'll need to add SMARTDrive to your AUTOEXEC.BAT file 
       in order to install the disk cache. 
 3. Q. Do I need the double buffering that SMARTDrive provides? 
    A. Most disk controllers do not need double buffering. These include all 
       MFM, RLL, and IDE controllers as well as many ESDI and SCSI devices. 
       SMARTDrive has a feature to help you determine if your system needs 
       double buffering. Once your system is running with SMARTDrive loaded 
       for double buffering, type SMARTDRV at the MS-DOS prompt. You will 
       see a table with some information. Notice the column labeled 
       buffering. For each drive that is being cached, it can have one of 
       three values: yes, no, or a hyphen. A yes indicates that double 
       buffering is needed. A no indicates that buffering is not needed. A 
       hyphen indicates that SMARTDrive has not yet determined the necessity 
       of double buffering. If the buffering column has all no's in it, the 
       double buffer driver is not needed. 
       An important note: If the double buffer driver is not loaded, you 
       will see only no's in the buffer column, whether or not your system 
       needs double buffering. 
 4. Q. Is it OK to load the double buffer driver into the Upper Memory Area, 
       or to load it high? 
    A. The double buffer driver must be loaded into conventional memory, or 
       in other words, it must be loaded low. In order for the double buffer 
       driver to work, it needs to operate in memory that has real, physical 
       addresses. Memory that is provided by a software memory manager, like 
       EMM386, QEMM386, or 386MAX, should not be used. Loading the double 
       buffer driver into the Upper Memory Area will result in the same 
       problem that you are trying to avoid; once again, you will be 
       buffering memory in a location that does not have a true physical 
       address. 
       You will not lose much conventional memory because the double buffer 
       driver only takes about 2.5K. 
 5. Q. Can the disk cache portion of SMARTDrive be loaded high? 
    A. Yes. It will automatically load itself high under MS-DOS 5.0 if 
       EMM386 is loaded and configured to provide upper memory support. If 
       you are unsure how to configure EMM386, check your MS-DOS 5.0 Upgrade 
       documentation or your "Microsoft Windows User's Guide" for version 
       3.1. 
       SMARTDrive can also be loaded high with a third-party memory manager 
       such as 386MAX or QEMM386. Check your memory manager documentation 
       for more information on loading programs into upper memory. 
 6. Q. Does SMARTDrive work with Stacker? 
    A. Yes, SMARTDrive works quite well with Stacker. SMARTDrive is aware of 
       Stacker and will automatically cache the underlying drive that 
       Stacker uses. This provides significantly better cache performance 
       due to the fact that SMARTDrive will be caching compressed code. For 
       the same amount of memory, you can cache twice as much code because 
       of Stacker's compression ratio. 
 7. Q. Why doesn't my Stacker volume show up in the SMARTDrive status 
       screen? 
    A. This is because SMARTDrive is caching underneath Stacker. You should 
       see the underlying drive letter listed in the SMARTDrive status 
       screen. 

COPYRIGHT Microsoft Corporation, 1992.



Title: Troubleshooting Problems with SMARTDrive 4.0 
Document Number: Q83303           Publ Date:  8-MAY-1992 
Product Name: Microsoft Windows 3 Retail Product 
Product Version:  3.10 
Operating System: WINDOWS 

 Summary: 
 This article discusses solutions to problems that may occur when you 
 use SMARTDrive version 4.0 (SMARTDRV.EXE), which is included with 
 Microsoft Windows operating system version 3.1. 
 More Information: 

 Double Buffering 
 ---------------- 
 The Windows Setup program attempts to install the double-buffering 
 portion of SMARTDrive if Setup detects that it is needed. To verify 
 that SMARTDrive's double buffering is not needed, load the double 
 buffer portion of SMARTDrive from the CONFIG.SYS file by adding the 
 following line to the CONFIG.SYS file. 
    DEVICE=C:\WINDOWS\SMARTDRV.EXE /DOUBLE_BUFFER 
 Note: This does not load the disk cache portion of SMARTDrive. 
 To see if double buffering is needed, type the following command at 
 the MS-DOS command prompt: 
    SMARTDRV 
 If all of the buffering entries list "no", then double buffering is 
 not necessary, and the double buffer line can be safely removed from 
 the CONFIG.SYS file. The SMARTDRV entry in the AUTOEXEC.BAT 
 file should not be disabled, as this is the portion that actually 
 loads the disk cache. 
 For more information on SMARTDrive and double buffering, please query 
 on: 
    SMARTDRV and DOUBLE_BUFFER and CACHE and STATUS 

 Loading SMARTDrive Low 
 ---------------------- 
 SMARTDrive 4.0 attempts to load into the upper memory blocks (UMBs) 
 automatically on a 386 or higher machine with a UMB provider such as 
 EMM386.EXE loaded. If there is a memory conflict in the UMB, 
 SMARTDrive may have problems. If SMARTDrive loads into a UMB that is 
 currently in use by some other device, such as a video card or network 
 card, all disk transfers become unreliable. 
 If you are having problems with SMARTDrive, modify the AUTOEXEC.BAT 
 file to load the cache low with the following command: 
    SMARTDRV /L 
 If problems disappear when SMARTDrive is loaded low, you need to use 
 an exclude statement on your UMB provider to exclude the area of 
 memory in conflict. You may be able to use Microsoft Diagnostics (MSD) 
 to find the ranges that need to be excluded. 

 Parity Errors 
 ------------- 
 Parity error messages come from the system BIOS, not Windows or 
 MS-DOS. A parity error indicates that there is a hardware problem; one 
 of the memory chips is not functioning properly. 
 If a parity error occurs using SMARTDrive, it is likely that some 
 areas of extended memory are being used, which may not have been used 
 before. 
 If you are getting parity errors, your memory is unreliable and should 
 be serviced. 

 Simulating SMARTDrive Memory Usage for Testing 
 ---------------------------------------------- 
 Sometimes, problems are cause by memory configurations unrelated to 
 but exacerbated by SMARTDrive. To verify that a problem is related to 
 the memory configuration, and not SMARTDrive, RAMDrive can be loaded 
 using the same amount of extended memory as SMARTDrive. You may have 
 to manipulate the free conventional memory to match when RAMDrive is 
 loaded instead of SMARTDrive. You can do this by loading a TSR that 
 causes the first free block of memory to be in the same place as 
 before. You can do this using MS-DOS 5.0 with the following steps: 
 1. Use the MEM /DEBUG command to show how much conventional memory 
    is available when SMARTDrive is loaded 
 2. Edit the CONFIG.SYS and AUTOEXEC.BAT files. Add RAMDrive to the 
    CONFIG.SYS and remove SMARTDrive from the AUTOEXEC.BAT. 
 3. Load TSRs to reduce the free conventional memory to the value 
    found in step one. The MS-DOS 5.0 utility DOSKEY is convenient for 
    this because you can control its conventional memory size with the 
    /REINSTALL /BUFSIZE= parameters. 
 Additional reference words: 3.10 SCSI Future Domain 

COPYRIGHT Microsoft Corporation, 1992.



Title: Configuring SMARTDRV.EXE 4.0 DOUBLE_BUFFERING Properly 
Document Number: Q82856           Publ Date:  2-APR-1992 
Product Name: Microsoft Windows 3 Retail Product 
Product Version:  3.10 
Operating System: WINDOWS 

 Summary: 
 Failure to use the double-buffering feature of the SMARTDrive 
 (SMARTDRV.EXE) utility included with the Microsoft Windows operating 
 system version 3.1 when this feature is required may cause MS-DOS 
 virtual machines to crash, Windows to crash at startup, and other 
 random operational problems. 

 The Windows Setup program attempts to install the double-buffering 
 portion of SMARTDrive if Windows detects that it is needed. These 
 problems may occur if the DOUBLE_BUFFERING entry is disabled in the 
 CONFIG.SYS file. 
 More Information: 
 To verify whether the SMARTDrive utility is necessary, enter the 
 following command at the MS-DOS command prompt: 
    smartdrv 
 If all of the buffering entries list "no", then double buffering is 
 not necessary. If the double-buffering entry is contained within the 
 CONFIG.SYS file, it may be disabled. The entry in the AUTOEXEC.BAT 
 file should not be disabled. 

 If the 32-Bit Disk Access option is available, then double-buffering 
 is probably not necessary. If the 32-Bit Disk Access option is not 
 available, the following command line should be present in the 
 CONFIG.SYS file 
    DEVICE=C:\WINDOWS\SMARTDRV.EXE /DOUBLE_BUFFER 
 where C is the drive and Windows is the directory location of the 
 Windows 3.1 SMARTDrive utility. 
 If at any time the buffering entries list "yes", then the problem has 
 been corrected. If the entry "-" appears in the DEVICE= buffering 
 line, SMARTDrive hasn't yet determined if double buffering is 
 necessary. This entry may be forced to change (from a "-" to a "yes" 
 or a "no") by one of the following methods: 
 1. Loading drivers or TSRs (terminate-and-stay-resident) programs into 
    UMBs (upper memory blocks). 
 2. Run Windows and start multiple instances of MS-DOS virtual 
    machines. This may not trigger it to change, however, because only 
    certain types of writes (DMA into linear != physical memory) will 
    cause the buffering to start. If problems occur and the line still 
    says "-",  then this is most likely not the problem. 
 Some disk ROM BIOS versions cause Windows to crash when multitasking 
 occurs. (Technically, this occurs when a page-fault or instance fault 
 occurs during a read of memory-mapped I/O). Double buffering usually 
 works around this problem because faults will not occur on the double 
 buffer. In these cases, double buffering can be forced to start by 
 adding a plus sign (+) to the end of the command line in the 
 CONFIG.SYS file as follows 
    DEVICE=C:\WINDOWS\SMARTDRV.EXE /DOUBLE_BUFFER+ 
 where C is the drive and Windows is the directory location of the 
 Windows 3.1 SMARTDrive utility. 
 Usually, a better approach is to disable the 32-Bit Disk Access option 
 and use a temporary swap file. 
 If the machine continues to exhibit random operational problems while 
 the 32-Bit Disk Access option is disabled, install the DOUBLE_BUFFER+ 
 entry into the CONFIG.SYS file. Because "instance faults" on the 
 double buffer may still occur, the complete solution is to load a 4K 
 memory buffer before and after the double-buffer line in the 
 CONFIG.SYS file. (Most any driver will work, as long as it does not 
 contain Windows instance data. The idea is to ensure there is no 
 Windows instance data in the same 4K page[s| as the double buffer.) 
 Additional reference words: 3.10 win31 

COPYRIGHT Microsoft Corporation, 1992.


Title: SMARTDRV Cache Status -- What Does Buffering Mean? 
Document Number: Q82709           Publ Date:  1-APR-1992 
Product Name: Microsoft Windows 3 Retail Product 
Product Version:  3.10 
Operating System: WINDOWS 

 Summary: 
 In Microsoft Windows operating system version 3.1, the character mode 
 display of the status of SMARTDRV.EXE has a column for buffering 
 status. The entries in this column can be "yes", "no" or "-" (minus 
 sign). This article describes the meaning of these entries. 
 More Information: 
 The following is an example of the printout you receive if you access 
 SMARTDRV.EXE from the MS-DOS prompt by typing "smartdrv" (without the 
 quotation marks) and pressing the ENTER key: 
    Microsoft SMARTDrive Disk Cache version 4.0 
    Copyright 1991,1992 Microsoft Corp. 
    Cache size: 1,048,576 bytes 
    Cache size while running Windows: 1,048,576 bytes 
                Disk Caching Status 
    drive   read cache   write cache   buffering 
    -------------------------------------------- 
      A:       yes           no           no 
      B:       yes           no           no 
      C:       yes           yes          yes 
      F:       yes           yes          - 
      G:       yes           no           no 
    For help, type "Smartdrv /?". 
 The column labeled "buffering" describes the state of double 
 buffering. There are three possible states: yes, no and maybe. A "yes" 
 in this column means that double buffering is being performed on the 
 drive (noted under the "drive" column). A no means that buffering is 
 not being performed on the drive. The maybe state (indicated by a 
 minus sign) means that SMARTDRV.EXE cannot determine if buffering is 
 needed. 
 SMARTDRV.EXE watches each data transfer to determine the need for 
 buffering. If it sees a transfer to an upper memory block (UMB), it 
 may be unable to determine if there is a need for double buffering. 
 The double buffer driver must be loaded for SMARTDRV.EXE to determine 
 if there is a need for buffering. If the double buffer driver is not 
 loaded, all entries in the buffering column read "no." The double 
 buffer driver is loaded from the CONFIG.SYS file. Below is an sample 
 line to install the double buffer driver: 
    DEVICE=C:\WINDOWS\SMARTDRV.EXE /DOUBLE_BUFFER 
 Even if you install the double buffer driver, SMARTDRV.EXE may decide 
 that it is not needed. In this case, the double buffer driver is not 
 loaded and does not take up any memory. 
 You can force the double buffer driver to load even if SMARTDRV.EXE 
 decides that it is unnecessary. Using a plus sign (+), as in the 
 following example, forces the double buffer to load: 
    DEVICE=C:\WINDOWS\SMARTDRV.EXE /DOUBLE_BUFFER+ 
 Additional reference words: 3.10 

COPYRIGHT Microsoft Corporation, 1992.




Title: SmartDrive 4.0 Design Overview 
Document Number: Q82203           Publ Date:  2-JUN-1992 
Product Name: Microsoft Windows 3 Retail Product 
Product Version:  3.10 
Operating System: WINDOWS 

 Summary: 
 SMARTDrive version 4.0 is designed as block-oriented disk cache. It 
 hooks into the system at the MS-DOS device driver level rather than at 
 the ROM BIOS INT13 level. Each block device driver on the MS-DOS 
 device driver chain is "front-ended" by SMARTDrive 4.0, which provides 
 the caching. 

 SMARTDrive 4.0 is a utility included with Microsoft Windows operating 
 system version 3.1. 
 More Information: 
 SMARTDrive 4.0 calls the MS-DOS level device driver to perform any 
 needed physical disk I/O. This design yields the following benefits: 
 1. It is independent of the INT13 interface. Many device drivers do 
    not use the INT13 interface. This means that these devices can be 
    cached where INT13-level caches cannot. Examples are Bernoulli 
    drives, some hard cards, and many SCSI and WORM drives. SMARTDrive 
    4.0 can cache any disk controller that uses an MS-DOS block device 
    driver. 
 2. It is independent of disk geometry. Some disk managers and disk 
    controllers use a disk-geometry mapping scheme that causes the 
    "logical" geometry (that is, what MS-DOS sees) to be different from 
    the physical geometry. Examples are many PS/2 systems, Ontrack's 
    Disk Manager, and several disk controllers. 
    INT13-based caches are sensitive to this difference and often have 
    problems. For example, some disk-management software will actually 
    change the ROM BIOS specified disk geometry on the fly and thus 
    confuse INT13-based caches. 
    There usually is an interface to determine the true geometry, but 
    this requires detection of the specific disk manager driver and 
    generally complicates the disk cache software. Often, logical 
    tracks will actually cross physical track boundaries, which then 
    causes track caches to incur performance penalties (inter-track 
    seeks and rotational latencies). Also, in order to get around the 
    ROM BIOS 1024 cylinder limitation, disk managers and controllers 
    will "fold" multiple tracks into 1 logical track. Doing this yields 
    the above problem as well as forcing track caches to have a very 
    large track buffer. In some cases, this cache is as large as 31.5K 
    and must reside in low memory. The design of SMARTDrive 4.0 
    eliminates the geometry mismatch problem. 
 3. SMARTDrive 4.0 is also a write-behind cache. It adds significant 
    performance improvement when files are being written. An 
    application will write data to what it thinks is the disk. 
    SMARTDrive will take this data and place it in a cache rather than 
    physically writing it to the disk. This write-behind data will stay 
    in the cache until one of the following events occurs: 
    a. The cache fills up. The oldest block in the cache is freed up 
       and if it is write-behind data, it is physically written to the 
       disk. 
    b. The system goes idle. SMARTDrive will write the oldest 
       write-behind data block to the physical disk. As long as the 
       system is idle, it will continue to write data until all the 
       write-behind data has been written. This includes both Windows 
       and MS-DOS applications being idle. 
       When a disk-reset operation occurs (INT21H, function 0DH), 
       SMARTDrive will write all write-behind data to the physical 
       disk. This is a synchronous operation--SMARTDrive does not give 
       up control until all data has been written. Because of this 
       feature, disk defragmenters and other utilities (such as CHKDSK) 
       do not get the benefit of write-behind caching, but this feature 
       provides safety since this is a common way to "commit files" 
       (that is, to make sure that all writes have completed) under 
       MS-DOS. A number of applications force a system reboot, and they 
       generally issue a disk reset prior to jumping to FFFF:0. 
    c. If a block is older than 5 seconds, it is written to the 
       physical disk. 
    Note: SMARTDrive cannot flush its buffers when exiting Windows if 
    you are running a version of QEMM earlier than 6.02. Earlier 
    versions of QEMM trap the INT 2Fh shutdown broadcast. After exiting 
    Windows in this configuration, SMARTDrive would not increase its 
    cache size to the cache size prior to starting Windows, nor would 
    the cache be flushed. 
 4. SMARTDrive 4.0 implements a shrink algorithm that frees memory for 
    Windows that is similar to the one in SMARTDrive 3.x. The 
    difference is that SMARTDrive 4.0 watches for the Windows startup 
    broadcast while SMARTDrive 3.x provides an IOCTL interface. The net 
    effect is identical but the SMARTDrive 4.0 code is much simpler. 
    When Windows is exited, the process is reversed and the memory is 
    reacquired by SMARTDrive 4.0. 
 Testing the Performance of SMARTDrive 4.0 
 ----------------------------------------- 
 1. Hard disk performance tests will not produce representative results 
    since they often use the disk-reset function. These are designed to 
    test the physical performance of the disk, not the disk cache. Disk 
    defragmenters and other utilities that directly manipulate the disk 
    (such as CHKDSK) also issue a disk reset to make sure that the data 
    is really written to the disk. These will not show performance 
    gains with write-behind caching. 
 2. Cache size. SMARTDrive will automatically determine a reasonable 
    cache size based on the amount of free extended memory when it 
    initially loads. Any tests should load SMARTDrive with the cache 
    size specified on the invocation line. A small cache will not 
    perform as well as a large cache. 
 3. Windows startup speed is not a good test of SMARTDrive's 
    performance since the shrink algorithm causes the cache to be 
    flushed. 
 Double Buffering and Bus Masters 
 -------------------------------- 
 Certain disk controllers support a concept called bus mastering. This 
 is where the actual disk controller takes over the bus in order to 
 transfer data to or from system RAM. Some SCSI controllers have this 
 feature. A problem occurs when running in the virtual 8086 mode that 
 Windows 3.0 and 3.1 virtual machines provide. Popular memory managers 
 also use virtual 8086 mode. The read or write address that is passed 
 to MS-DOS is often not the same as the actual physical memory address. 
 This can cause data to be read from the wrong location or worse, can 
 cause data to be written to the wrong RAM. The result can be erratic 
 system behavior. 
 Microsoft created a standard called Virtual DMA Services, which 
 provides an interface that allows these bus-master controllers to get 
 the correct address and avoid the problems mentioned above. However, 
 some older bus-master controller cards do not support this standard. 
 To this end, a feature has been added to SMARTDrive that provides a 
 memory buffer that has physical and virtual addresses that are the 
 same. This avoids the problem at the cost of 2.5K of conventional 
 memory and a small amount of performance (the cost of moving the data 
 to and from the buffer.) To use this feature, place the following line 
 in the CONFIG.SYS file: 
    DEVICE=SMARTDRV.EXE /DOUBLE_BUFFER 
 This line does not install the cache, only the double-buffer driver. 
 (The cache must be installed in the AUTOEXEC.BAT file.) 
 Most disk controllers do not need double buffering. This includes all 
 MFM, RLL, and IDE controllers as well as many ESDI and SCSI devices. 
 The Windows 3.1 Setup program will not install the double buffer 
 driver in most cases. In the cases where Setup is unable to determine 
 if double buffering is needed or not, it will install the driver based 
 on the reasoning that it is better to err on the side of safety. A 
 feature has been added to SMARTDrive to help determine if double 
 buffering is unneeded and allow removal of the driver. Once the system 
 is running with SMARTDrive loaded, type "SMARTDRV" (without quotation 
 marks) at the MS-DOS prompt. The following will appear: 
    Copyright 1991,1992 Microsoft Corp. 
    Cache size: 1,048,576 bytes 
    Cache size while running Windows: 1,048,576 bytes 
                 Disk Caching Status 
    drive   read cache   write cache   buffering 
    -------------------------------------------- 
    A:       yes           no           no 
    B:       yes           no           no 
    C:       yes           yes          yes 
    D:       yes           yes          - 
        Microsoft SMARTDrive Disk Cache version 4.00 
    For help, type "Smartdrv /?". 
 Note the column labeled buffering. For each drive that is being 
 cached, it can have one of three values: yes, no, or -. "Yes" 
 indicates that double buffering is needed, "no" indicates that 
 buffering is not needed. "-" indicates that SMARTDrive has not yet 
 determined the necessity of double buffering. If the buffering column 
 has all "no"'s in it, the double buffer driver is unneeded. 
 Additional reference words: 3.10 3.1 SMARTDRV.EXE smart drive 

COPYRIGHT Microsoft Corporation, 1992.


