4 ms·
What's the issue with RAM disk to address your concern about "no disk"?
by yeukhon 12y ago
What's the issue with RAM disk to address your concern about "no disk"?
- sp332 12y agoIt's a lot of unnecessary copying. The data is already in RAM, but you "save" it to a different RAM location, in the RAM disk. Or if you do all your work directly on the file in the RAM disk, you have to deal with filesystem overhead constantly.
- colanderman 12y agoOr if you do all your work directly on the file in the RAM disk, you have to deal with filesystem overhead constantly. Not so. Take a look at the Linux kernel implementation of memory-mapped ramdisk files. There is no "filesystem overhead". Zero. The kernel pretty much sets up the page mapping and then is hands-off. Even if your memory mapping is backed by a file on a block device, the only overhead is occasional paging to disk. This happens on the order of SECONDS… not "constantly"!
- sp332 12y agoThat's assuming you already have a file and know how big it should be. Or does it take the whole space for one file, and every program on the computer shares the space?
- colanderman 12y agoFiles can be both sparsely and dynamically allocated.
- AnthonyMouse 12y agoYou save things to persistent storage because you want the copy. In the large majority of cases the format on the filesystem is different from the format in memory because the file format is meant to be more readable by humans or by machines with a different endianness or pointer size etc., whereas data in memory is binary and platform-specific to optimize for fast access by the local machine. The benefit of that distinction doesn't go away just because you make the persistent storage faster.