What is DMA?

Your disks may be performing below par for want of simple checkbox setting. This article is taken from the September 1999 Help Screen and is essential background reading to this month's follow-up item on DMA.

What is 'DMA' and why does Windows 98 warn me, when trying to turn it on for my disk drives, that the sky might crash down upon my head as a consequence? For that reason I haven't dared try it. Should I take the plunge, and what benefits would there be? I assume it's a good thing, if the option is there.
Alex Cutler, London

It is definitely a good thing when working reliably. Applied to modern IDE disk drives, DMA is closely allied to bus mastering.

Without bus mastering/DMA, when data is exchanged between memory and drive, the CPU has to manage the operation. Any other running processes will slow down, because the data transfer is CPU-intensive. This mode of operation is the way IDE was originally designed, and is called PIO (programmed input/output) mode.

With PIO, you might notice, for example, that an application reading video off a disk and displaying it at the same time runs irregularly. If the CPU had only to read or display the video data, it could cope. Both at the same time is too much.

The peripheral devices in your PC, such as the hard disk controller, network, display and audio adapters - sit on a bus. This is an internal highway along which data is exchanged between these components and the core of the computer - the CPU and memory - which is where programs are running.

Bus mastering enables a peripheral device to take charge of the bus and cut the CPU out of data transfer operations between devices. Data is transferred directly from one device to another, and the CPU's resources aren't tapped during the process.

DMA stands for direct memory access. This enables a device to exchange data with the PC's memory without the CPU having to look after the operation. Again, there is a benefit in that the CPU is used hardly at all, leaving it to get on with all the other jobs that a modern multi-tasking operating system demands of it.

A hard disk sub-system capable of bus-mastering/DMA will not show much benefit if the CPU has nothing much else to do anyway - as will be the case with a single-task operating system like MS-DOS. But in a multi-tasking environment such as Windows, it will improve performance when a lot of things are happening at once.

In order to use bus-mastering/DMA with a hard disk, a number of criteria must be fulfilled:

If you have the hardware, Windows is a suitable operating system in terms of multi-tasking, but not all versions came with bus-mastering drivers. These were introduced with Windows 95 OSR2 (so Win98 is okay, too) and NT4 Service Pack 2. When using the Microsoft-supplied drivers, a bus-mastering aware BIOS is required.

In the case of the first release of Win95, bus-mastering was not in the operating system, though it could be enabled if the hardware manufacturer provided a suitable driver. This was the case with Intel, whose BM-capable IDE chipset was used on many motherboards of the time. The Intel bus mastering driver for Win95 didn't require a BM-aware BIOS.

An interesting aside on the Intel Win95 driver: although it is designed to enable DMA for IDE drives, only when I installed it on my Win95 test-bed did the Matrox Millenium display adapter configuration utility allow me to turn on DMA transfers for graphics, too.

A common problem with enabling DMA on your IDE drives under Windows is that it might be incompatible with some drives, or interfere with other parts of the system. There are plenty of reports of people having to turn off DMA for hard disks, simply because a particular component or Windows itself became unstable. Having the latest drivers for the various bits and bobs inside your PC helps.

Potential instability is the reason for the warning message when you try to turn on DMA in Windows. There is a small chance that any resulting problems will be catastrophic, so make sure you back up important files beforehand.

The checkbox which turns on DMA is found in the System Properties dialog (right-click on My Computer and select Properties). On the Device Manager tab, open up the branches for CD-ROM and disk drives. Open the Properties dialog for each drive, and DMA is an option on the Settings tab.

If you now reboot Windows, the DMA settings should be automatically turned off for devices which the operating system finds incompatible with its bus mastering drivers. Some drives may be listed as capable of DMA, but not implement enough of the specification to be compatible with the Microsoft drivers.

The above discussion has been based on EIDE drives. DMA/bus-mastering shouldn't be an issue with SCSI drives - it should be there from birth, and partly explains the traditional performance superiority of SCSI.

A couple of other notes about DMA and IDE drives. Older controllers and disks may not have it at all, or not on the secondary channel. For that reason, try putting hard disks on the primary channel if DMA doesn't work when it should, and the disk in question is on the secondary channel. Be careful, though: when faced with two devices on the same channel that run at different speeds, some controllers are unable to cope and run both devices at the lower of the two speeds. Others are fine.

While DMA is out for an airing, we should note that there are two flavours: third-party and first-party. Third-party DMA refers to a component inside every PC - the DMA controller. It's called third-party because you have a sender and a receiver of data, and the DMA controller - the third party - does the transfer. In first-party DMA, the peripheral doing the transfer handles it directly. This is bus mastering, and is faster than third-party DMA but is only available over the PCI bus. Third-party DMA works over the ISA bus.