Cores and threads in VM

0

i know the basic principles of VM, but i'm wondering if there is any issue allocating all cores to a VM. In my case, i have a Macbook Pro with an Ivy Bridge i5, so 2 cores and 4 threads. Using Parallels, i can allocate up to 4 "cores" (presumably that sw calls cores even the logic one)to a VM. Right now i'm using Windows 10 under a VM with 2 cores and 4gb of RAM with 512mb of VRAM, and that's ok, but i'm wondering if i could allocate all 4 cores to that VM while using OSX at the same time. Are they going to scale proportionately or i'm going to experience some hickups on my machine? 3MB of L3 are not that much, but in theory, if i'm still able to do other stuff in some heavy load scenarios, i think this machine could handle that quite well.

Using 2 cores only, leaves the other 2 dedicated to OSX only, but i was wondering if i could get better performance on the VM and OSX as well allocating all 4 cores to the VM. In that scenario, they will "self optimizing" themselves depending on the load? 4gb seems to be enough, even because my machine has 8, CPU in the other hand, it's quite good and shouldn't have any issue i think, even with all its resources shared. Thanks.

Ironsight

Posted 2016-12-29T13:12:42.470

Reputation: 9

Yes you could and it would depend on the load on either system component. It might run fine or fail horribly depending on it. – Seth – 2016-12-29T13:19:21.970

No; Your VM software won't let you allocate your VM 4 cores. Why are you worried about the Level 3 Cache? – Ramhound – 2016-12-29T13:51:53.573

@Ramhound actually, Parallels ask gives me the opportunity to allocate from 1 to 4 cores. I could select 4 if i want to, but i'm worried about performance since i don't know if the cores i allocate are VM only or they could be used by the system as well – Ironsight – 2016-12-29T14:44:04.713

Well, Parallels doesn't not use your 4 cores, if you only assign 1 to the vm, at the end of the day your using a type-2 hypervisor – Ramhound – 2016-12-29T14:53:13.917

Ok, better to be specific. I have 2 cores and 4 threads. Parallels calls them "cores" anyway and i can assign 4, so all of them, to the VM. My question is: are those cores 100% dedicated to the VM or they share their resources with the system? – Ironsight – 2016-12-29T15:08:17.930

Answers

0

I'm not familiar with Parallels, but this applies to pretty much any hypervisor: when a VM's vCPUs are idle, it is free for the host machine or even other VMs to use. Allocating all cores/threads to a particular VM doesn't prevent the host from using the CPU, but merely allows the VM to use that much of the host's physical resources.

This is in fact one of the big arguments for cloud computing and virtualization in the datacenter. Given that most servers are almost never fully utilized, virtualization can be used to combine multiple physical servers into one big server with several virtual servers, greatly reducing cost and power consumption.

As for memory, the RAM is reserved for the VM when it is turned on. Absent a feature called memory ballooning which allows unused memory in the VM to be returned to the host, this memory cannot be used outside that VM.

bwDraco

Posted 2016-12-29T13:12:42.470

Reputation: 41 701

Thanks! So basically, i can allocate all 4 cores and the VM is going to use as much as it needs without affecting the main machine since they are dynamically shared right? I mean, if the VM needs all the power from all 4 cores, it's going to use an X amount of all 4 providing at the same time enough juice for the main machine, am i right? – Ironsight – 2016-12-29T20:34:04.987

It'll just use all the cores. If the host machine needs CPU time as well, it'll get shared with the VM, just as in any other case of multitasking. – bwDraco – 2016-12-29T20:38:33.500