Programmed I/O (PIO) Modes

The oldest method of transferring data over the IDE/ATA interface is through the use of programmed I/O. This is a technique whereby the system CPU and support hardware directly control the transfer of data between the system and the hard disk. There are several different speeds of programmed I/O, which are of course called  programmed I/O modes, or more commonly, PIO modes.

Through the mid-1990s, programmed I/O was the only way that most systems ever accessed IDE/ATA hard disks. Three lower-speed modes were defined as part of the original ATA standards document; two more were added as part of ATA-2 (as well as part of several unofficial standards.) The table below shows the five different PIO modes, along with the cycle time for each transfer and the corresponding throughput of the PIO mode:

PIO Mode

Cycle Time (nanoseconds)

Maximum Transfer Rate (MB/s)

Defining Standard

Mode 0

600

3.3

ATA

Mode 1

383

5.2

ATA

Mode 2

240

8.3

ATA

Mode 3

180

11.1

ATA-2

Mode 4

120

16.7

ATA-2

A few things about this table bear mention. First of all, the PIO modes are defined in terms of their cycle time, representing how many nanoseconds it takes for each transfer to occur. The maximum transfer rate is the reciprocal of the cycle time, doubled because the IDE/ATA interface is two bytes (16 bits) wide. (For a basic explanation of cycle time and related issues, check out this fundamentals section). Also, conspicuous by its absence from the table above is the so-called "PIO mode 5", which does not exist and was never implemented in any IDE/ATA hard disks. Apparently, at one point some discussion occurred about creating a faster PIO mode, which was tentatively called "PIO mode 5". This mode was to support a transfer rate of 22.2 MB/s, but it was never implemented (probably because the much faster 33 MB/s Ultra DMA mode 2 was on the horizon). Some motherboard manufacturers made a point of providing early support for this proposed mode in their BIOS setup programs, so you may occasionally see it mentioned.

Obviously, faster modes are better, because they mean a higher theoretical burst transfer rate over the interface. This transfer rate represents the external data transfer rate for the drive. Remember that this is the speed of the interface and not necessarily the sustained transfer rate of the drive itself, which is almost always slower (and should be). Of course today all new drives have sustained transfer rates well in excess of what even the fastest PIO mode can handle, which is one reason why PIO has fallen out of favor. Also worth mention is that very old systems using ISA hard disk controllers cannot use even PIO modes 3 or 4, because their transfer rate exceeds the capacity of the ISA bus!

As I mentioned, programmed I/O is performed by the system CPU; the system processor is responsible for executing the instructions that transfer the data to and from the drive, using special I/O locations. This technique works fine for slow devices like keyboards and modems, but for performance components like hard disks it causes performance issues. Not only does PIO involved a lot of wasteful overhead, the CPU is "distracted" from its ordinary work whenever a hard disk read or write is needed. This means that using PIO is ideally suited for lower-performance applications and single tasking. It also means that the more data the system must transfer, the more the CPU gets bogged down. As hard disk transfer rates continue to increase, the load on the CPU would have continued to grow. This is the other key reason why PIO modes are no longer used on new systems, having been replaced by DMA modes, and then later, Ultra DMA.

As discussed in detail here, each IDE channel supports the use of two devices, designated as master and slave. Modern systems allow the use of master and slave devices running at different PIO modes on the same channel; this is called independent device timing and is a function of the system chipset and BIOS. When this feature is not supported, both devices may be limited to the slower of the two devices' maximum PIO mode, but this hasn't been a big issue since the mid-to-late 1990s.

PIO modes do not require any special drivers under normal circumstances; support for them is built into the system BIOS. This universal support, along with their conceptual simplicity, is why they were traditionally the default way that most drives are used. Today, however, PIO is just not up to handling modern drives, which use Ultra DMA to keep the load on the CPU down and to allow access to Ultra DMA's much higher performance. Support for PIO modes is still universal on almost all systems and drives made since the mid-1990s, for backwards compatibility. It is used, for example, as a "last resort" when driver or software issues cause problems with Ultra DMA accesses.