Efficient Algorithm to Share Common Buffer Resource in I/O Device Driver
Original Publication Date: 2007-Apr-05
Included in the Prior Art Database: 2007-Apr-05
This algorithm provides an efficient way to share common pool of buffers among multiple devices and use a single buffer assigned to each device to avoid issues in buffer starvation situation which affect device driver's performance.
Efficient Algorithm to Share Common Buffer Resource in I /O Device Driver
Disclosed is an algorithm used in a device driver which needs to manage the resource shared by multiple devices.
Following diagram shows the design of the invention:
The algorithm works as:
When device driver receives requests from upper layer, it determines which device the request is made for:
a. When device driver receives requests from upper layer, if there are free buffers, device driver will copy the request to the pre-allocated buffers, and invoke the start I/O routine to send the I/O buffers to the device or the layer underneath.
Also if there are any previously saved requests in the device's linked list to be processed, then device driver will combine both the new request and the saved request together and send them to the device or the layer below.
b. If the pre-allocated buffers are used out:
b1. Device driver will use the single buffer assigned to this device, and copy the
request to this buffer and invoke the start I/O routine to send I/O buffer to the device or the layer below.
b2. If both global pool of free buffers and the single buffer assigned to this device are used out, the device driver then saves the original request in the linked list associated with this device, and wait for either iodone is invoked or a new request for the same device arrives.