views:

1005

answers:

2

I have a command-line executable which I need to run from Java on Windows XP. It uses files as input and output. But I want to avoid the overhead of file IO, so I thought of an in-memory RAM file system.

NetBSD has mount_mfs.

Could you recommend the most convenient way of doing this?

+3  A: 

Commons VFS provides handy interfaces to virtual filesystems, inclunding in-memory file system.

Valentin Rocher
Thanks, I noted Commons VFS, but does it let me create a new IMFS readable by both Java and an external executable?
Joshua Fox
+6  A: 

You should also consider whether you really need this (premature optimization, yadda, yadda). On all modern operating systems, filesystem I/O is cached anyway, so frequently-used files are essentially as fast as a RAM disk.

Related question (with many good answers): http://stackoverflow.com/questions/354254/ramdrive-for-compiling-is-there-such-a-thing

sleske
Good modern file systems with delayed allocation might never hit the disk when you create a short-lifed file.
Joachim Sauer
+1: Can you prove that I/O is the bottleneck? Until you can prove it, don't worry about it.
S.Lott
Thanks for that SO link. One thing I learned from there is the right Google search term for the IMFS, namely "RAMDrive" or "RAM Disk".You are probably right about premature optimization, but this info is good to have.
Joshua Fox