3 ms·
A swap file on a RAM disk seems... not useful.
by gpvos 3y ago
A swap file on a RAM disk seems... not useful.
- M95D 3y agoDepends on the system. I still use a ramdisk on my DOS/Win31/Win98 machine. It has lots of memory and Win98 crashes with more than ~768 MB RAM. I use the ramdisk to occupy excess memory.
- actionfromafar 3y agoBack in the dark ages I put swap on most of the graphics memory of an AGP bus graphics card. The read spead was slow compared to system RAM but insanely fast compared to swapping to HDD. Then put the graphics card as the highest priority swap so it swapped there before going to HDD.
- M95D 3y agoHow did you do that?
- actionfromafar 3y agoI don't remember, specifically I don't remember if I had to compile a tiny device driver to expose a chunk of RAM as a block device. In that case, it might have been something like this sample: https://www.opensourceforu.com/2012/02/device-drivers-disk-on-ram-block-drivers/ https://www.opensourceforu.com/2012/02/device-drivers-disk-o... There might also have been some way to convince the kernel a piece of RAM was a block device. The "ramdisk.c" driver in Linux was simpler before. After that, it was a matter of creating an init script which formatted the block device as a swap device, then running swapon.
- Vogtinator 3y agoCan be, if the RAM disk is compressed.
- foresto 3y agoYou might find these interesting: https://en.wikipedia.org/wiki/Zswap https://en.wikipedia.org/wiki/Zswap https://en.wikipedia.org/wiki/Zram https://en.wikipedia.org/wiki/Zram
- grishka 3y agoIf your RAM disk has a fixed size but there's some free space on it, and the system is out of RAM, it can effectively reclaim that otherwise unused space on the RAM disk at the cost of having to copy the pages back and forth.
- 123pie123 3y agofrom my vague memory, windows had a default minimum swap size. by putting it on to a RAM drive if you had enough memory (+ and as someone else mentioned compressing it as well) made things run much faster
- sim- 3y agoAndroid does this with zram, and I think this is a big part of the reason why it tends to use more battery once you run low on RAM, since paging in and out requires (de)compression, which uses CPU.