Please correct me if I am wrong. I assume VirtualBox, like any other application, is swapped to disk if it uses too much memory. Is there any way to force the system to always keep all the VirtualBox processes in memory?
2 Answers
Is there any way to force the system to always keep all the VirtualBox processes in memory?
There's mlock(2) which "locks part or all of the calling process's virtual address space into RAM, preventing that memory from being paged to the swap area". In case you manage it to be called from VirtualBox, it would do, yep.
- 9,730
- 3
- 28
- 53
Give your host machine sufficient RAM for both the host OS and the virtual machine and set your swappiness value low to zero.
Inside the guest VM, turn off the swapfile. That might not seem so obvious, but it's the guest OS and it's applications that are making VirtualBox use RAM and it's the guest OS that will also page to disk (or virtual disk - which is rather slow).
The key is to have sufficient RAM for both the host and the guest vm.
- 14,848