Direct I/O

T

Tony Hannan

Hello all,

Do the direct buffers in the java.nio package have the same effect as
using the open function with the O_DIRECT flag in Linux?

I am the TA for a database implementations class and we want to access
disk directly and do our own buffering. We are treating a single OS file
like a disk partition.

Thanks,
Tony
 
J

John C. Bollinger

Tony said:
Hello all,

Do the direct buffers in the java.nio package have the same effect as
using the open function with the O_DIRECT flag in Linux?

I can't tell for sure from the docs, which means that you cannot rely on
it being so. The two sound similar, but it is not clear whether an NIO
direct buffer bypasses only Java-side caching or both Java and native
caching.
I am the TA for a database implementations class and we want to access
disk directly and do our own buffering. We are treating a single OS file
like a disk partition.

I know of nothing more likely to get what you ask in Java than a direct
ByteBuffer, as you suggested. If you are not already aware of it, then
you should also look at method FileChannel.force() as a complement /
failsafe.

Sorry I can't be more definite.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top