I read this asynchronous io disk file this tutorial , however it does not let me understand, and in fact it confuses me more.
According to this tutorial, there are two different models of asynchronous I / O:
- Asynchronous blocking I / O: open the file with O_ASYNC, and then use epoll / poll / select.
- Asynchronous I / O: using glibc AIO in this article. since the glibc implementation is just a simulation through a thread pool, what I am looking at in this question is the AIO kernel , i.e. io_submit.
At least from the point of view of the concept there is not much difference, true, io_submit can allow you to issue several io reqeusts, and on the other hand, using reading with O_ASYNC, you can simply issue one request with the estimated file position.
And this guide also mentioned that using epoll as an alternative to Linux AIO:
Epoll. Linux has limited support for using epoll as a mechanism for asynchronous I / O. To read a file opened in buffer mode (this is without O_DIRECT), if the file is opened as O_NONBLOCK, then read will return EAGAIN until the corresponding part is in memory. It writes to the buffer file, as a rule, immediately, since they are written out from another write-back stream. However, these mechanisms do not provide an I / O control level that provides direct I / O.
What is the problem of using epoll as an alternative to AIO? Or, in other words, what is the problem that we need a new io_submit interface to solve?
Chang source share