Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


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

Asynchronous File I/O on Linux



Does anyone know of a standard asynchronous file I/O system for Linux?

I just wrote one because I needed to try something, but I was wondering if
there is a more mainstream project going on. From what I've been able to
find, you can't do much better than what I did with the POSIX API and that
was open a file multiple times, use posix threads, mutexes, and events to
queue up I/O requests to the threads.

Specifically, does anyone know of a call that will take an existing file
handle and FULLY duplicate it so that each will have their own notion of
file position? (dup() and dup2() do not do this.) This could improve my
performance.

My test case is as such:

int fin = open(...)
read(block, size);
seek(offset, whence)
read(block2, size);
seek(offset, whence)
read(block3, size);
seek(offset, whence);
read(block4, size);
close(fin)

Vs

Asyc = asyncOpen(...)
readblock(block,size,offset,whence);
readblock(block2,size,offset,whence);
readblock(block3,size,offset,whence);
readblock(block4,size,offset,whence);
asyncWait();
asyncClose()

When all is said and done, the async is about 3%~4% slower in this case.
While it will probably be a huge gain for an app that can actually use
async, I was kind of hoping that by putting all the requests out at once,
the file system, block drivers, and disk drive would do a better job at
parallelizing the disk reads and getting the blocks faster with fewer disk
platter rotations. But, alas, performance seems no better than sequential
reads and I can attribute the slowness to the added overhead.


Anyone have any ideas?







BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org