next up previous
Next: Block Management (BM) Layer Up: Asynchronous I/O Primitives (AIO) Previous: Asynchronous I/O Primitives (AIO)

AIO Layer Implementations.

There are several implementation strategies for STXXL AIO layer. Some asynchronous I/O related APIs (and underlying libraries implementing them) already exist. The most well known framework is POSIX AIO, which has implementation on almost every UNIX/POSIX system. Its disadvantage is that it has only limited support for I/O completion event mechanism 2. The Linux AIO kernel side implementation 3of POSIX AIO does not have this deficit, but is not portable since it works only under Linux.

Our AIO layer implementation follows a different approach. It does not rely on any asynchronous I/O API. Instead we use synchronous I/O calls running asynchronously in separate threads. For each file there is one read and one write request queue. The main thread posts requests (invoking file::aread and file::awrite methods) in the file queues. The thread, associated with the file, executes the requests in FIFO order. This approach is very flexible and it does not suffer from limitations of native asynchronous API.

Our implementation of the AIO layer is based on POSIX threads and supports several Unix file access methods: the syscall method uses read and write system calls, the mmap method uses memory mapping (mmap and munmap calls), the sim_disk method simulates I/O timings of a hard disk provided a big memory disk. To avoid superfluous copying of data between user and kernel buffer memory, the syscall method has an option to use unbuffered file system access. Alternatively, the file access methods can be used for raw disk I/O bypassing the file system.

The implementation does not need to be ported to other UNIX compatible systems, since POSIX threads is the standard threading API on all POSIX operating systems.


next up previous
Next: Block Management (BM) Layer Up: Asynchronous I/O Primitives (AIO) Previous: Asynchronous I/O Primitives (AIO)
Roman Dementiev 2005-08-09