user3187878
user3187878

Reputation:

Is it possible to dynamically allocate processor and ram to a virtual machine on Windows (Virtual Box)?

Is it possible to dynamically allocate processor and ram to a Ubuntu virtual machine? E.G. Processes are running on the host system causing the processor to go up and down in usage from let's say around 30%-70% and these processes also occupy a fluctuating amount of ram of between 3GB-7GB out of 8GB ie leaving 1G of ram at peak usage. What I want to happen is that the virtual machine will then smartly use all the remaining free cpu time and ram available but not slow down the host system. If more ram is needed by the system, more will be given to it and taken away from the vm and when more cpu time is needed for the host system this is also taken away from the vm. This allows for the host system to always run as smoothly as it should. It would also be good if the minimum amount of ram and cpu time that can be allocated to the vm can be set to prevent the vm from crashing.

This is what I have attempted:

I am currently using virtual box,

I have set the vm to use as many virtual cpus as there are physical cores. I have set execution cap to 100% I have then set the amount of ram to be allocated to the vm to be the maximum possible. I then attempted to set the priority level of the vm process to be below normal, but I got permission denied for some reason, making this method impossible. The vm also crashes when I run a ram stress test on it because it is confused as to how much ram it can use (I'm guessing) This attempt also misses out on the minimal ram and processor time goal.

Therefore my attempt failed to achieve any of my goals. Is there a way to achieve my goals? I do not mind if I have to use different software rather than virtual box. I also don't mind any sort of start-up script that I can run, which will launch the vm appropriately.

Thanks,

Upvotes: 3

Views: 7859

Answers (1)

crashtua
crashtua

Reputation: 491

afaik, virtualbox does not have this kind of features. Hyper-V can dynamically give/take back memory to/from vm("dynamic memory" feature). VMware Workstation can reserve some configurable size of memory, and dynamically split it between vms(example - vmware can reserve 8 gigs from total 16, we have 2 vms, configured to use 7 gigs memory, if first vm will need only one gig, secon can take other 7 gig from total 8 reserved).
But vmware can not give memory back to host machine. Unfortunately can't say much about CPU.

Upvotes: 2

Related Questions