Figure 3 illustrates the performance benefits of Multiple Command Queuing in mass storage devices. In BOT mode without command queuing, the device has to finish each command before it can accept a new command. It has to wait for a new command to arrive, then process it and send a completion, and wait for the completion to be acknowledged. There is considerable waiting time associated with each command.

73593_fig3

Figure 3: UASP benefits from USB 3.0’s new dual-simplex and stream-transfer features.

UASP's Command Queuing capability reduces all the waiting delays by sending a new command to the device while the device may still be processing a previous command. The device, in turn, can begin processing the next command whenever it is ready to do so, without waiting for a new command to arrive, if a command has already been queued up in the device. Command queuing can also benefit USB 2.0 mass storage devices as well as USB 3.0, if the devices are designed to support that feature. The USB 2.0 link itself already has the ability, through the "pipe" concept in USB 2.0, to support command queuing.

Figure 4 depicts a mass storage drive that uses rotating media. If the drive is designed to support command queuing, a further performance gain can be achieved if the drive also has the ability to optimize the order in which the enqueued commands are processed. This capability is referred to as Native Command Queuing (NCQ). The key word is "Native," meaning performed by the drive. Without NCQ, as shown in the platter on the left, the commands might be issued and processed in 1-2-3-4 order. Depending on where each target sector is on the platter, the drive head might need to move to a different track for each command, and need to move across many tracks to reach the correct target track. It takes considerable time to move the head on a drive. Anything that can be done to reduce the number of head movements or the distance of each move (number of tracks) can provide a substantial performance improvement.

73593_fig4

Figure 4: What is Native Command Queuing (NCQ)? Hard-Drive optimizes order in which read and write commands are executed.

UASP can reduce head movement by allowing the drive to access more than one sector on the same track in response to enqueued commands. The platter on the right in Figure 4 illustrates a 3-2-4-1 processing order, allowing the head to move only a short distance to the next adjacent track in response to each enqueued command. If two target sectors happen to reside on the same track, the drive may also decide to access more than one sector on the track before moving the head again.

Note, in addition, that reducing head movement also reduces wear on the drive, which helps to increase the drive's useful operating life in drives that use rotating media.

To support NCQ most efficiently, an enhancement was added in the USB 3.0 specification to implement the concept of "streams" within a "pipe." USB 2.0 already implements the concept of a "pipe" for each "endpoint," but "streams" in USB 3.0 allow a further subdivision of each "pipe" into multiple "streams." Then, the host and drive can tag each command and completion with the stream number as well as the pipe (endpoint) number, to allow the completions to be correlated to the commands.

The UAS "tag" field in the Information Units ("IU") within Bulk transfers in USB 2.0 also allow command tagging and NCQ support in USB 2.0, but it is not as efficient in bus utilization as the "stream" feature in USB 3.0.