Boost logo

Boost :

Subject: Re: [boost] [asio] file i/o under linux
From: Gruenke, Matt (mgruenke_at_[hidden])
Date: 2011-03-16 12:13:08

I'm definitely planning to take a look.

I started experimenting with Posix Async I/O and found aio_suspend() use a design that scales poorly and have high overhead, under Linux. Furthermore, it doesn't seem to interoperate natively with other forms of I/O multiplexing (perhaps as reflected in your dedicated io_service limitation). On Linux, it has several significant limitations: it doesn't work on certain filesystem types, writing can still sometimes block, and it forces O_DIRECT - which disables caching and imposes alignment limitations. Even without the implementation issues, I would not recommend using this interface.

I did not experiment with the signals approach, but I'm also concerned about the overhead and scalability of that model. Furthermore, it didn't seem to fit ASIO's architecture as cleanly.

I also did not experiment with native Linux API, though I believe it shares the limitations of the Posix AIO implementation. One benefit of the native Linux interface is that I believe you can get a file descriptor that you can use with epoll() to drive it with a normal io_service.


-----Original Message-----
From: boost-bounces_at_[hidden] on behalf of Kamil Nowosad
Sent: Tue 3/15/2011 2:43 PM
To: boost_at_[hidden]
Subject: [boost] [asio] file i/o under linux

I have been working recently on support for asynchronous file i/o in
asio library in linux. Perhaps some of my code will interest you.

The interface allows for doing read, write and fsync/fdatasync
operations. The implementation uses either POSIX AIO or linux-native
libaio (this may be currently switched by #define ASIO_USE_LIBAIO).

I have based the initial work on patch brought by Felipe Magno de
Almeida in 2005 (
/93068.php). As you may realize by studying my modifications of
task_io_service, the file i/o operations are unable to coexist with
operations of other kind within single io_service. I did not have time
to test it thoroughly, but basic tests pass.

The patch is created against 1_45_0 version, however everything works
well when applied to 1_46_1. The tarball contains also a simple example
file and a script that compiles it.

I will be pleased to receive any feedback.

Best regards,
Kamil Nowosad

Boost list run by bdawes at, gregod at, cpdaniel at, john at