## Physical Device Driver Reference

[prev][next][parent][TOC]

### Request Packet Queue Management

The strategy routine can either queue a request packet or process it immediately. Typically, only READ and WRITE requests need to be queued because the device is busy. Other types of requests can usually be handled immediately by the strategy routine.

A block device driver, such as the physical disk device driver, can process queued requests in any order. For instance, the block device driver can choose to sort the requests to optimize device access time. A character device driver must always handle queued requests in the order it received them; otherwise, mixed output could result.

The request packet queue is a linked list that contains a linkage field which allows the packets to be chained together. The device driver can manage its work queue of request packets with the DevHlp services for request queue management.

To use the request queue management DevHlp services, the physical device driver must allocate a DWORD variable as a queue header, with one header for each queue. The DWORD variable must be initialized to zero to indicate an empty linked list or the end of the linked list.

The DevHlp services use the queue header to identify a specific linked list of request packets and set the header to the first request packet in the list. The linkage field in the request packet then chains the request packet to another request packet.