Command Queuing can be literally described as a line of incoming commands, which are constantly analyzed in order for them to be reordered for an optimized execution sequence. Almost every access to a certain area of the rotating platter requires the read/write heads to move. If these movements can be reduced by simply putting commands into a different order, much time can be saved. Two variables are particularly important in this aspect: The search time and the rotational latency. The first one stands for the time needed to bring the read/write arms into position. The latter one results from the time that usually passes until the corresponding sector on the media passes the heads.
Looking at Command Queuing technologies, some differences can be found. Until now, Native Command Queuing (NCQ) has only been applied to SATA, while Tagged Command Queuing (TCQ) has been well known in SCSI computing since the beginning of the 1990s. TCQ has also been integrated into the ATA 4 standard for UltraATA. Due to its few advantages for desktop computers, the technology was never really used. Here, TCQ operated by rearranging the commands on the basis of their LBA address (Logical Block Addressing). Afterwards, the commands were executed one after another.
In case of TCQ for SCSI, several commands are marked with a so called tag. A hard drive treats the commands in a certain way, according to their tag:
Those commands are executed in the same order as they arrive.
- Head of queue
This command gets executed right after the current command.
In that case the hard disk controls the sequence of all commands in queue. This makes sense, since the hard drive knows its own characteristics (cylinder/heads/sections) best.
Native (NCQ) works just like the "simple" mode of (TCQ), but doesn't offer the other two options.
Command Queuing Puts incoming commands in a line. The length of this line is known as the queue depth. The maximum queue depth for NCQ is 32 commands per initiator. In theory, 216 tags are possible for TCQ, but this has never been used. In real life applications, the common queue depth is most often 64 commands.
Last but not least, there is one more feature that NCQ provides, which TCQ does not. Called 'Out of Order Data,' this feature allows a drive to deliver parts of a demanded data package only, which reduces the search time even more.