Alex Rivera | Logout

Linux Disk File AIO

Asked 2011-12-15T00:30:29.007
10

According to this tutorial asynchronous disk file io can easily be achieved using AIO on linux, at least from a programming/api point-of-view. But before and after this tutorial I had read a lot of posts and articles that this either can not be done or you should use libevent with a patch and many other issues. Another thing was the loop that I should have waited for a signal, but based on this tutorial I can use a callback mechanism, which obviously makes AIO much easier to use.

Now, I am not a linux programmer even by a long shot I just wanted to find a straightforward way to support asynchronous disk file io on linux, learn it and add it to a async disk io library that I need for a personal project. Currently I'm using overlapped io on windows and io worker threads on non-windows platforms. Since the mutithreaded solution can be tricky, I wanted to replace it on linux with AIO.

SO, what is wrong with AIO as described in this tutorial? Is it performance? Is there a restriction on operations that can be done using AIO?

p.s. I don't care if the code will not be portable to other POSIX-compliant platforms, as long as it works on major linux distributions. And all I care about is regular disk file io.

Thanks.

Edit
Report

1 Answer

3

The Linux implementation of POSIX AIO spawns a thread for every write you do. This is usually not good, and you're better off using your own worker threads to do the writes, so that you can control how many threads are in play. In other words, stick with what you have, AIO isn't going to buy you anything.

answered 2011-12-15T02:01:30.227

Your Answer