PIO Mode Versus DMA Mode
ATA defines two classes of transfer mode, called PIO Mode (Programmed I/O Mode) and DMA Mode (Direct Memory Access Mode). PIO mode transfers are much slower and require the processor to arbitrate transfers between the device and memory. DMA mode transfers are much faster and occur without processor intervention. If either device on an ATA channel uses a PIO mode, both devices must do so. That cripples throughput and puts a heavy load on the processor, bogging down the system whenever the drive is accessed.
All modern ATA and ATAPI devices support DMA mode, but for backward compatibility, most can be set to use PIO mode. Using PIO mode is a mistake. When you upgrade a system, if you find any drives that support only PIO mode, replace them. Only very old hard drives and optical drives are limited to PIO mode anyway, so replacing them is a no-brainer.
Depending on what level of DMA your hard disk and interface support, enabling DMA transfers may or may not increase disk performance noticeably, but enabling DMA is always worthwhile, because it greatly reduces the burden that PIO transfers place on the processor. If a computer has 75% CPU utilization using PIO transfers, that same computer using DMA transfers may provide the same or better disk performance at perhaps 1.5% CPU utilization. With multitasking operating systems, those extra free CPU ticks translate into faster system response.
To use DMA transfers, the hard drive, BIOS, and chipset must explicitly support DMA, and the operating system must have DMA drivers installed, loaded, and enabled. All recent versions of Windows support DMA transfers, but DMA is not always enabled by default, as follows:
- A fresh Windows install automatically installs DMA-capable drivers and tests the BIOS, interface, and hard drive for DMA compatibility. If any of these tests fail, DMA is disabled. If all three succeed, DMA is enabled automatically at the fastest DMA mode common to the drive and interface.
- Upgrading an existing system to Windows XP automatically enables DMA only if DMA was previously enabled. If DMA was previously disabled, you'll have to enable it manually.
When you install a second hard drive and restart the system, immediately check the current DMA status of that drive and enable DMA if it is not currently enabled. To do so, take the following steps:
Figure 7-13: Windows XP shows this hard drive is using the UDMA-5 (UltraATA-100) transfer mode
- Right-click My Computer and choose Properties to display the System Properties dialog.
- Click the Hardware tab and then Device Manager button to display the Device Manager.
- Locate and expand the IDE ATA/ATAPI controllers item. On a standard system with both ATA controllers enabled, there are three items listed. The first describes the ATA controller itself and may be ignored. The other two items are the Primary IDE Channel and Secondary IDE Channel.
- Right-click the channel to which the device for which you want to enable DMA is connected, choose Properties, and then click the Advanced Settings tab to display the dialog shown in Figure 7-13.
- This dialog displays the Device Type and Current Transfer Mode for Device 0 (master) and Device 1 (slave) on the selected ATA channel. The Current Transfer Mode field shows the transfer mode currently in use, and may be changed as follows:
Windows is using the indicated MDA or UDMA mode, which is the fastest mode supported by the interface, cable, and device. For example, if the hard drive supports UltraATA-100 and the embedded motherboard interface supports UltraATA-66, but you use a standard 40-wire ATA cable, Windows configures the interface to use UltraATA-33. If you replace that cable with an 80-wire UltraDMA cable and restart the system, Windows reconfigures the interface to use UltraATA-66. You cannot explicitly choose the UDMA mode to be used.
Windows is using the fastest PIO mode supported by the interface and device, typically PIO-4 (16.7 MB/s). If Transfer Mode is currently set to PIO Only, you may be able to enable DMA by setting Transfer Mode to "DMA if available" and restarting the system. If the Current Transfer Mode for the device still shows PIO Mode after the system is restarted, that device cannot be used in DMA mode. Replace the device with one that supports DMA.
No device is installed.
All recent versions of Windows automatically disable DMA transfers at boot and revert to PIO transfers if they detect an obvious DMA problem. A DMA checkbox that won't stay checked when you restart the system is a good indication that your computer does not support DMA properly. Unfortunately, this method of determining support is not foolproof. DMA may appear to install successfully, but may have intermittent problems anyway. Any of the following symptoms may (or may not) indicate a DMA problem:
- You cannot access the hard disk at all, or you notice corrupt or missing files.
- The drive sometimes hangs briefly or seems to speed up and slow down during file access.
- The keyboard or the foreground application sometimes stops responding for short periods, or the mouse becomes jerky or nonresponsive.
- Windows locks up during the Plug and Play detection phase of Setup.
- Windows will start only in Safe Mode.
- Windows shutdown takes a lot longer than before you enabled DMA.
If any of these problems occur, it does not necessarily mean that you cannot use DMA with your computer. The following are likely causes of the problems:
According to the ATA standard, cables can be no longer than 18"(0.45 m), but we often see PATA cables of 24" and even 36". These long cables may not work reliably, if at all, with high-speed DMA modes. Cables also vary greatly in quality. The ones you see for $1.99 in bins at the computer store are less likely to work reliably at high speeds than those that are supplied with a new hard drive. When you're installing a hard drive, always replace the old ATA cable with the cable that comes with the drive. If no cable came with the drive, buy a good-quality DMA cable separately. If you have problems with DMA, replacing the cable with a better cable may solve them.
All current drives support DMA properly, but some early UltraATA-33 drives did not implement DMA modes correctly. If you reconfigure an older drive to use DMA, first check the manufacturer's web site for details on that model. Software patches for some models are available.
Some early BIOS implementations that nominally provide DMA support do not do so correctly. If a more recent BIOS revision is available for your computer, downloading it and installing it may resolve intermittent DMA problems. If your current BIOS does not support DMA, you may find that a revised version is available to add that capability.
SATA MAKES THINGS EASY
Unlike PATA drives and interfaces, which may use various PIO and DMA modes, SATA drives and interfaces use only DMA mode. You don't need to configure settings manually. If the SATA drive is running at all, you can be sure that it's using optimum settings.