|
I/O operations on a file can be either synchronous or asynchronous. For synchronous I/O operations, the process calling the I/O request is blocked until the I/O operation is complete and regains control of execution only when the request is completely satisfied or fails. For asynchronous I/O operations, the process calling the I/O request immediately regains control of execution after the I/O operation is queued to the device. When the I/O operation is completed (either successfully or unsuccessfully), the calling process can be notified of the event by a signal passed through the io control block structure for the asynchronous I/O function. Alternatively, the calling process can poll the io control block structure for completion status. Asynchronous I/O permits efficient overlap of CPU and I/O processing, which can dramatically increase the performance of demanding applications. Using Asynchronous I/OAsynchronous I/O is most commonly used in real-time applications requiring high-speed or high-volume data collection or low-priority journaling functions. Compute-intensive processes can use asynchronous I/O instead of blocking. For example, an application can collect intermittent data from multiple channels. Because the data arrives asynchronouslythat is, when it is available rather than according to a set schedulethe receiving process must queue up the request to read data from one channel and immediately be free to receive the next data transmission from another channel. Another application might require such a high volume of reads, writes, and computations that it becomes practical to queue up a list of I/O operation requests and continue processing while the I/O requests are being serviced. Applications can perform multiple I/O operations to multiple devices while making a minimum number of function calls. You can perform asynchronous I/O operations using any open file descriptor. Asynchronous I/O FunctionsThe asynchronous I/O functions combine a number of tasks normally performed by the user during synchronous I/O operations. With synchronous I/O, the application typically calls the lseek function, performs the I/O operation, and then waits to receive the return status. Asynchronous I/O functions provide the following capabilities:
The following functions perform and manage asynchronous I/O operations:
|
|