Native command queuing is a system that allows serial advanced technology attachment (SATA) hard drives to govern their own internal queue of read and write requests. In systems that don’t use native command queuing, the drive executes commands in the order they were received from the main system. Native command queuing allows the drive to reorder commands in order to make the retrieval process more efficient. This speeds up information recovery time and decreases physical wear on the drive.
The data on a hard drive is stored on paper-thin magnetic sheets called platters. Each drive has several platters, all containing information. To read and write on the platter, hard drives use an arm similar to the one on a record player. As the platter spins, the arm moves back and forth over the platter sections containing the data.
When observed by a human, the data on a hard drive appears totally random. Two related pieces of information may be widely spaced on the drive. To read both pieces, the arm finds the first and then moves in position to locate the second. If the drive receives one read or write command after another, the arm will need to constantly move in order to line up with the data. If each of the commands requires the arm to move to the opposite side of the same platter, a great deal of time is lost in the back-and-forth process.
By using native command queuing, the drive may choose the order in which it executes a given command set. In essence, it performs as many operations in one area as possible, then moves to a different area. This means that the drive has reduced seek time and waiting between commands. As an added side benefit, the drive spends less time making unnecessary motions. This will reduce the wear on the drive by a small amount.
Advanced systems may take advantage of another benefit of native command queuing. When a processor is busy and unable to accept commands, the drive can push all of the write requests to the front of the queue. Since the processor is too busy to accept read commands, the drive may choose not to resolve any. This may result in a huge performance improvement, especially in systems with multiple drives and multiple cores.
This technology is used on some forms of solid-state drives as well. These drives don’t use the arm-and-platter system of standard drives, so they generally work much faster. Since they are so fast, they will often work faster than the rest of the system and end up bottlenecked. By using native command queuing, they can reorder their commands to send reads whenever possible and write when the system falls behind.