Real async file IO on Linux?
clebert.suconic at gmail.com
Fri Jul 29 10:16:47 PDT 2011
I had this conversation on this group when this was still a JSR:
My reading from back then was.. it didn't make sense for everybody so
I kept on working on my own thing.
It would be possible to have an implementation of the NIO using Linux
AIO (or maybe Posix AIO for other platforms).
Linux AIO has these following caveats though:
- The buffer has to be aligned to 512 (that means a Direct Buffer
(Buffer.allocateDirect (size % 512) ).
* However the better would really be to let the NIO implementation
to create the buffer for you.
- The write position has to be aligned to 512
- The file needs to be pre-allocated.
The pre-allocated requirement, it's actually because on most Operation
Systems you virtually change two locations to expand the file. The
meta-data for the file and the body of the file. So, the kernel can't
be real asynchronous if you don't pre-allocate.
I believe it would make a lot of sense to have this as a special implementation.
More information about the nio-discuss