4

I read 2 posts related to Linux AIO (native AIO).

  1. https://blog.cloudflare.com/io_submit-the-epoll-alternative-youve-never-heard-about/

It's important to note the iocb requests passed to kernel are evaluated in-order sequentially.

  1. https://github.com/littledan/linux-aio

io_submit allows an array of pointers to struct iocbs to be submitted all at once. In this function call, nr is the length of the ios array. If multiple operations are sent in one array, then no ordering guarantees are given between the iocbs.

The 2. article uses #include <liaio.h> and as far as I know, it's merely a wrapper of Linux AIO system calls. So I am confused why one of the articles says "in-order" while another says "no ordering guarantees"?

Which description is wrong? It would be appreciated if someone could provide a code snippet to test.

Haris
  • 12,120
  • 6
  • 43
  • 70
Rick
  • 7,007
  • 2
  • 49
  • 79
  • The manual page for the system call [`io_submit(2)`](http://man7.org/linux/man-pages/man2/io_submit.2.html) indicates that (a) GLIBC does not provide a cover function for this system call and (b) you should probably be using `-laio`, a library, which does provide a slightly different function interface to this system call. It also does not specify the (important) detail you want to know about, AFAICS. I've not managed to track down what I regard as definitive information for the `libaio` library. The best I've found (and not read) is for [ArchLinux](https://man.archlinux.org/man/io.3.en). – Jonathan Leffler Sep 16 '22 at 18:04
  • A cursory examination of the Linux kernel source at https://elixir.bootlin.com/linux/latest/source/fs/aio.c sure seems to support the assertion that even though **A**IO stands for **asynchronous** IO, Linux performs the IO operations sequentially when submitted via `io_submit()`. I don't know offhand whether or not Linux fully supports true asynchronous IO via POSIX-standard calls such as [`lio_listio()`](https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/lio_listio.html). – Andrew Henle Sep 16 '22 at 19:31
  • 1
    There's a new game in town (since May 2019, or thereabouts): Wikipedia describes the [io_uring](https://en.wikipedia.org/wiki/Io_uring) system calls. It is meant to be a replacement for `io_submit()` et al, available from kernel 5.1. – Jonathan Leffler Sep 16 '22 at 21:50

0 Answers0