How does using VirtualBox impact physical RAM?

6,235

Solution 1

VirtualBox does not use the hard disk for virtual RAM. It uses the computer's physical RAM for virtual RAM. In the screenshot 4096 MB of the available 16384 Base Memory (the physical RAM) is allocated to the guest OS and the remainder of the physical RAM is available to be used by the host OS.

Allocating 4GB of RAM gives nice peppy performance on the guest OS. I need to allocate so much RAM to the guest OS, because it is a daily build of Ubuntu 17.04 (pre-alpha release) and the performance of this Ubuntu 17.04 build is sluggish compared to an officially launched Ubuntu release, even when 4GB RAM is allocated to it. Allocating 4GB RAM to an officially released Ubuntu version gives almost bare metal performance on my machine.

Any easier way to increase the available memory in VirtualBox than using the hard disk for virtual RAM is by using the video memory of your GPU if your computer has a graphics card. The video memory in a VirtualBox guest OS can be increased to up to 256MB RAM. To increase the video memory of Linux guest OS running in a Windows 7 host OS to 256 MB, run this command in the cmd window.

VBoxManage modifyvm "Linux" --vram 256  

where "Linux" should be replaced by the name of your Linux guest OS in VirtualBox.

Finally I get to the suggestion of adding using the hard disk for adding virtual RAM to the guest OS. The main purpose of adding more memory to the guest OS is to improve the performance of the guest OS. The best ways of doing that are to either add more RAM to the physical machine or to run the guest OS from an SSD. Running the guest OS from an SSD gives a large increase in performance, 2x or 3x faster than running the same guest OS from an HDD on my machine. Why I would test such a thing is that I was planning on removing an SSD from my computer, so I moved the guest OS from the SSD to the HDD, then I changed my mind and decided not to remove the SSD and moved the same guest OS back to the SSD from the HDD.

enter image description here

Solution 2

Your Windows machine is already using HDD space for "virtual RAM" it's called pagefile for Windows or swap space for Linux and in both cases is incredible slow because the speed difference between RAM (nanoseconds) and hard drives (milliseconds) is at least a factor of 10. Data will always be loaded from the disk to the RAM and swapped to it again before it's accessible.

You won't gain anything by using a VM as it would share the host memory. So if you have 4 GB RAM there is easily at least 1 GB reserved for your host OS. If you setup a VM you could assign a max. of 3 GB of RAM to it and possibly would change to not impact your host to~ much. If you really think that Linux would utilize your system much better and deliver better performance you should probably look into a dual boot configuration. In that case you could boot into Linux if you need to do development work and boot into Windows if you want to do "other" things (whatever they might be).

Furthermore Firefox is not a "high performance" application but merely a browser. If you look at the requirements for PHPStorm it doesn't seem to be a "high performance" application either. That doesn't mean that both can't use a lot of resources but usually the understanding of high performance would be slightly different.

Share:
6,235

Related videos on Youtube

TT120
Author by

TT120

Updated on September 18, 2022

Comments

  • TT120
    TT120 over 1 year

    I was wondering if I ran a Linux guest OS in VirtualBox on a Windows 7 host OS how would it affect RAM? I'm using high-performance applications like PhpStorm, and it's my understanding that virtual machines use hard disk for virtual RAM (I could be wrong; if so let me know). If that's the case can I simply allocate some hard drive space (which is obviously bigger than my RAM limit) as RAM and use it like virtual RAM?

  • Seth
    Seth over 7 years
    The second bit about the memory doesn't seem to make all that much sense as the graphics card memory won't be used for general storage of data (so without some special software or setup you won't replace RAM with graphics card memory.
  • Blaizz
    Blaizz over 7 years
    For example when running a graphical application like PhpStorm, the 256MB of allocated video memory takes some of the load off the allocated Base memory, enabling the guest OS to make additional use of the Base memory that is allocated to it.
  • TT120
    TT120 over 7 years
    ah I see thanks for the detailed explanation :) does it matter per linux distro? #mintfanboy
  • TT120
    TT120 over 7 years
    ah I see ok thanks :) and yeah by high performance I simply meant it uses a lot of memory, but high performance does sound like it uses more than that (my bad)
  • Seth
    Seth over 7 years
    Different distributions are usually meant to do different things but could possibly configured to almost act the same. If you want a full desktop with all the bling increasing the VM graphics memory could help a little but the performance impact for most cases shouldn't be as noticeable. Another thing is hardware acceleration (e.g. video decoding) etc. offered by your video card that might not be available within a VM.
  • Blaizz
    Blaizz over 7 years
    @TT120 In general (grouped by type of Linux distribution) Linux servers and various Linux system rescue distributions require small amounts of RAM, Linux desktop distributions require medium amounts of RAM, and Qubes OS requires a large amount of RAM. Qubes OS takes an approach called security by compartmentalization, which allows you to compartmentalize the various parts of your digital life into securely isolated compartmentalized VMs called qubes, all of which run alongside each other in Qubes OS.