Page 1 of 1

How much is POSIX AIO used today?

Posted: Sun Dec 18, 2022 6:44 am
by OSwhatever
POSIX AIO has been around now for quite a while. It has been in the Linux kernel for something like 15 years. I've been looking into a few contemporary libraries (like HTTP servers libraries) and still see that they are not using POSIX AIO but the more classical methods (select/epoll). I haven't looked into all libraries of course and that's why I'm asking here.

What is your impression how much POSIX AIO is used where it would make sense?

Re: How much is POSIX AIO used today?

Posted: Sun Dec 18, 2022 3:44 pm
by qookie
I think the main problem with POSIX AIO is that it signals completion via signals, which are more annoying to deal with.

On Linux you can get the benefits of AIO (async disk I/O) with io_uring, which operates based on submission and completion queues, with no explicit notification mechanism (apart from having a call to suspend if there are no events in the completion queue, a la poll). In other cases you can just use sockets or pipes internally and spawn helper threads for blocking I/O.

Re: How much is POSIX AIO used today?

Posted: Sun Dec 18, 2022 11:02 pm
by nullplan
You can also use aio_error() to poll the error status of your aiocbs, and aio_suspend() to suspend the thread until one operation is available. It almost looks like you could implement POSIX AIO with io_uring, and wouldn't that be a wonderful thing? I think that was the point of POSIX, to abstract OS specific APIs to portable ones.

To the original question, Debian Code Search finds 1384 results for aio_return(). This does include compilers and libcs, but there are also users among such luminaries as chromium, directfb, elfutils, virtualbox, and zfs. So yeah, looks like it is used quite a bit.

Re: How much is POSIX AIO used today?

Posted: Mon Dec 19, 2022 8:34 am
by nexos
nullplan wrote:So yeah, looks like it is used quite a bit.
A lot of those programs probably use AIO as a fallback in case something better (like io_uring) don't exist. Hence I'm sure the number of programs that are actually dependent on AIO is relatively small.