HDD Command Queuing Optimization (TCQ)
For the first time, the description of command queuing optimization (TCQ) appeared in the ATA/ATAPI-4 standard. Support of this technology allows the hard disk drive to reorder commands independently in order achievement the best performance and to reduce the deterioration of kinematics. Commands are put in the queue before their actual performance, and HDD electronics dynamically reconstructs queue the of the commands which came in the store to increase the general efficiency of the hard drive work. The purpose of optimization is the minimization of motions of the magnetic head during the execution of all the commands which are put in the queue for the execution as it is the search for a track and the sector waiting for are the longest phases of data reading/data recording operations.
Algorithms of queue optimization can be divided into two categories:
- Optimization of positioning time. The hard drive analyzes all the raw queries and reconstructs them in the order of their remoteness from the path on which there is a magnetic head now. This mechanism is similar to the work of the quick lift.
- Optimization of access time. Besides the optimization of positioning time, the HDD also takes into account the delay connected with waiting for the important sector on track during the rotation of magnetic disks. The given method requires a significant computational capability since the HDD needs to know exactly the current position of the head, the exact position of required sector, the exact current speed of spindle motor rotation, the time of reaching the necessary track by the magnetic head, the time of stabilization of heads on a track, etc. Only one small error in the given calculations will lead to hard drive standing idle and thus losing precious time, waiting for magnetic disks making an almost whole turn.
The use of TCQ provides the support of the following commands by the storage device and their use by the driver:
- NOP AUTO POLL
- READ DMA QUEUED
- READ DMA QUEUED EXT
- WRITE DMA QUEUED
- WRITE DMA QUEUED EXT
- WRITE DMA QUEUED FUA EXT
The use of any other command dumps the existing queue. Commands of reading/record of TCQ are supplemented with the unique number from 0 to the maximum depth of commands queue of a hard drive (32 commands) which are used for identification in case of disordered execution of commands. If the hard disk drive is ready for the full execution of a command, it can execute it immediately and if it is not ready it can release the bus and start the optimization of the commands which are in the queue, or the execution of one of them. The driver or the controller of a motherboard should interrogate hard drives for the determination of whether they require service or not. Interrogation can be executed using the hardware and also programmatically by the SERVICE command. The use of program type of interrogations implies a considerable workload of the central microprocessor. Hardware interrogation is initiated by the "NOP AUTO POLL" command which is processed by the controller of a motherboard and ignored by the HDD.