Re: Please help me setup ramdisk

Posted by TrevorH on 2012/1/17 22:36:22
It already is.

Linux will cache the most recently used files in RAM for later use. It'll adjust what is in the cache so that it contains the most recently used programs and files. If you subtract a portion of that RAM and force it to contain what you think it should then you are overriding the operating system and taking space away from it that it would use for the most useful purpose at the time.

If you're really intent on doing this then you could use /dev/shm - make a directory there and copy the files there that you want then point your application at that directory - e.g. /dev/shm/worlds. This uses tmpfs and that uses RAM and is backed by swapspace so if the system needs the RAM for more important purposes it'll swap tmpfs out. I have no idea how you reliably copy those files back to persistent storage to preserve the contents when the files have been changed.

This Post was from: https://www.centos.org/newbb/viewtopic.php?forum=55&topic_id=35335&post_id=152329