Native Command Queuing
Native Command Queuing is a technology designed to increase performance of SATA
Sata is a traditional dish from the Malaysian state of Terengganu, consisting of spiced fish meat wrapped in banana leaves and cooked on a grill.It is a type of Malaysian fish cake, or otak-otak...

 hard disk
Hard disk
A hard disk drive is a non-volatile, random access digital magnetic data storage device. It features rotating rigid platters on a motor-driven spindle within a protective enclosure. Data is magnetically read from and written to the platter by read/write heads that float on a film of air above the...

s under certain conditions by allowing the individual hard disk to internally optimize the order in which received read and write commands are executed. This can reduce the amount of unnecessary drive head movement, resulting in increased performance (and slightly decreased wear of the drive) for workloads where multiple simultaneous read/write requests are outstanding, most often occurring in server
Server (computing)
In the context of client-server architecture, a server is a computer program running to serve the requests of other programs, the "clients". Thus, the "server" performs some computational task on behalf of "clients"...

-type applications.


Native Command Queuing was preceded by Parallel ATA's version of Tagged Command Queuing
Tagged Command Queuing
Tagged Command Queuing is a technology built into certain ATA and SCSI hard drives. It allows the operating system to send multiple read and write requests to a hard drive. ATA TCQ is not identical in function to the more efficient native command queuing used by SATA drives...

 (TCQ). ATA's attempt at integrating TCQ was constrained by the requirement that ATA host bus adapters use ISA
Industry Standard Architecture
Industry Standard Architecture is a computer bus standard for IBM PC compatible computers introduced with the IBM Personal Computer to support its Intel 8088 microprocessor's 8-bit external data bus and extended to 16 bits for the IBM Personal Computer/AT's Intel 80286 processor...

 bus device protocols to interact with the operating system. The resulting high CPU overhead and negligible performance gain contributed to a lack of market acceptance for TCQ.

NCQ differs from TCQ in that with NCQ each command is of equal importance, but NCQ's host bus adapter also programs its own first party DMA
Direct memory access
Direct memory access is a feature of modern computers that allows certain hardware subsystems within the computer to access system memory independently of the central processing unit ....

 engine with CPU-given DMA parameters during its command sequence whereas TCQ interrupts the CPU during command queries and requires it to modulates the ATA host bus adapter's third party DMA engine. NCQ's implementation is preferable because the drive has both more accurate knowledge of its performance characteristics and is able to account for its rotational position. Both NCQ and TCQ have a maximum queue length of 32 outstanding commands (31 in practice).

For NCQ to be enabled, it must be supported and enabled in the SATA host bus adapter and in the hard drive itself. The appropriate driver must be loaded into the operating system to enable NCQ on the host bus adapter.

Many newer chipsets support the Advanced Host Controller Interface
Advanced Host Controller Interface
The Advanced Host Controller Interface is a technical standard defined by Intel that specifies the operation of Serial ATA host bus adapters in a non-implementation-specific manner....

 (AHCI), which allows operating systems to universally control them and enable NCQ. Newer mainstream Linux kernel
Linux kernel
The Linux kernel is an operating system kernel used by the Linux family of Unix-like operating systems. It is one of the most prominent examples of free and open source software....

s support AHCI natively, and FreeBSD
FreeBSD is a free Unix-like operating system descended from AT&T UNIX via BSD UNIX. Although for legal reasons FreeBSD cannot be called “UNIX”, as the direct descendant of BSD UNIX , FreeBSD’s internals and system APIs are UNIX-compliant...

 fully supports AHCI since version 8.0. Windows Vista
Windows Vista
Windows Vista is an operating system released in several variations developed by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs, and media center PCs...

 and Windows 7 also natively support AHCI, but their AHCI support (via the msahci service) must be manually enabled via registry editing if controller support was not present during their initial install. Windows 7's AHCI enables not only NCQ but also TRIM
Trim may refer to:* Cutting small pieces off something** Book trimming, a stage of the publishing process** Editing*** Editing a posting style in online discourse** Pruning, trimming as a form of pruning often used on trees-Places:...

 support on SSD
-Computing:* Solid-state drive, a type of data storage device which uses memory rather than rotating media* Seven-segment display, a display which uses 7 segments to display mostly numbers* System sequence diagram, a type of UML software engineering diagram...

 drives (with their supporting firmware). Older operating systems such as Windows XP
Windows XP
Windows XP is an operating system produced by Microsoft for use on personal computers, including home and business desktops, laptops and media centers. First released to computer manufacturers on August 24, 2001, it is the second most popular version of Windows, based on installed user base...

 require the installation of a vendor-specific driver (similar to installing a RAID
RAID is a storage technology that combines multiple disk drive components into a logical unit...

 or SCSI
Small Computer System Interface is a set of standards for physically connecting and transferring data between computers and peripheral devices. The SCSI standards define commands, protocols, and electrical and optical interfaces. SCSI is most commonly used for hard disks and tape drives, but it...

 controller) even if AHCI is present on the host bus adapter, which makes initial setup more tedious and conversions of existing installations relatively difficult as most controllers cannot operate their ports in mixed AHCI - SATA/IDE/legacy mode.

NCQ in solid-state drives

NCQ is also used in newer solid-state drives
Solid-state drive
A solid-state drive , sometimes called a solid-state disk or electronic disk, is a data storage device that uses solid-state memory to store persistent data with the intention of providing access in the same manner of a traditional block i/o hard disk drive...

 where the drive encounters latency on the host, rather than the other way around. For example, Intel's X25-E Extreme solid-state drive uses NCQ to ensure that the drive has commands to process while the host system is busy processing CPU tasks.

NCQ also enables the SSD controller to complete commands concurrently (or partly concurrently, for example using pipelines) where the internal organisation of the device enables such processing.

For example, the SandForce 1200
SandForce is an American "fabless" semiconductor company based in Milpitas, California, that designs and manufactures flash memory controllers for solid-state drives . On October 26th 2011 it was acquired by LSI Corporation....

based OCZ Vertex II 50GB drive running on a Dell Perc 5i (which doesn't support SATA NCQ) delivers about 7,000 4k IOPS (50% write) at a controller queue depth of 32 IOs. Moving the drive to the similar Dell Perc 6i (which does support SATA NCQ) increases this to over 14,000 IOPS on the same basis.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.