Re: Asynchronous I/O (AIO) on Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To my knowledge, they don't have yet asynchronous I/O. They do have non-blocking I/O (the equivalent of select/poll), mapped files and vectored I/O (equivalent of readv/writev).

As I said, select/poll it is not what I need (unless I missed something...) and vectored I/O is for something else. Mapped I/O may sound attractive, but : (a) works only for files (or pieces of files) that are smaller than 2GB, and (b) to be efficient, for the CPU-intensive part, data should be all in memory (think about doing couples of FFTs on different directions).

Asynchronous I/O can be implemented with two threads:
- I/O thread     - waits for I/O requests

- working thread - sends I/O request (returns immediately)

- I/O thread - sends I/O request to kernel, kernel to DMA, then wait for completion (no CPU involved here - basically it waits on the read/write functions)

- working thread - performs some CPU intensive jobs

- working thread - needs data: wait until I/O thread finished the I/O request

Nicely will be to have it in a library and not to use "real" threads but perform it at the kernel level. Starting with glib "don't know what version" there is an aio.h header which defines all asynchronous operations. I haven't found yet any documentation about it and I don't know how this is implemented or if the implementation is part of the standard RedHat distribution. Jonathan pointed out that it may be only on the Enterprise edition.

I'm interested if someone can share any experience he/she had with aio on Linux.


Cheers, -iulian

Chris Wilson wrote:
An easy way to do this would be with Java's NIO:
http://java.sun.com/j2se/1.4.2/docs/guide/nio/

Then it would work on Windows or Linux
-- Chris

On Wed, 2003-10-08 at 13:56, Iulian Musat wrote:

Thanks.

I think select/poll is more appropriate when you deal with more than one file descriptor at a time (ex. a server watching couples of sockets).

My problem is very simple:
- read data from a file
- process data (CPU intensive)
- write data.

The processing part and the IO takes comparable times. All I'm trying to do is to use two buffers, and while one is loaded/saved to disk, the other get processed (in theory the CPU should be free, since the disk transfer is done using DMA).

Nothing new here, I just wanted to have a cleaner code - using only the POSIX standard if possible and not messing with any multithreading library just for this (at least not calling it directly from my code).

-iulian

Jonathan Bartlett wrote:

Or just use select/poll

As far as I'm aware, kernel-level AIO is only in Enterprise Red hat.
There may be some libraries that simulate it with threads, however.

Jon

On Wed, 8 Oct 2003, Iulian Musat wrote:



Hello everybody !

I have a project where I/O operations are going to take a significant
amount of time, and I think that I could use asynchronous I/O to gain
some CPU cycles while a read/write operation is on progress.

It will be grate if anyone can point me to some documentation about AIO
on Linux? Does anyone know if this is working with the default kernel
that comes with Redhat 8+ ?

Cheers,
-Iulian


-- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list








--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux