How much is POSIX AIO used today?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
OSwhatever
Member
Member
Posts: 595
Joined: Mon Jul 05, 2010 4:15 pm

How much is POSIX AIO used today?

Post 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?
User avatar
qookie
Member
Member
Posts: 72
Joined: Sun Apr 30, 2017 12:16 pm
Libera.chat IRC: qookie
Location: Poland

Re: How much is POSIX AIO used today?

Post 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.
Working on managarm.
nullplan
Member
Member
Posts: 1767
Joined: Wed Aug 30, 2017 8:24 am

Re: How much is POSIX AIO used today?

Post 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.
Carpe diem!
nexos
Member
Member
Posts: 1078
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: How much is POSIX AIO used today?

Post 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.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Post Reply