Dynamically allocation of VCPUs

This is for discussing general topics about how to use VirtualBox.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Dynamically allocation of VCPUs

Post by noteirak »

There is two level of control for this :
The OS will distribute threads on cores (vCPU) so if you stop a process, then start another one after the CPU add, you'll be able to have a thred on it yes.
The application code is the one which decide how many threads they are, their priority, etc. If the application is not coded to use all the available CPUs and adapt at runtime, then you'll be limited to that.

So dynamic allocation of CPUs might not be worth it, unless the application checks at runtime the available CPUs, or if you run several process of it.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Dynamically allocation of VCPUs

Post by mpack »

VirtualBox has no concept of jobs. It simulates the hardware that the guest OS runs on. The guest OS cares about such things as tasks and jobs. From VirtualBox's point of view the entire guest OS is one black box job.
M.Fazel
Posts: 16
Joined: 30. May 2013, 08:34

Re: Dynamically allocation of VCPUs

Post by M.Fazel »

noteirak wrote:There is two level of control for this :
The OS will distribute threads on cores (vCPU) so if you stop a process, then start another one after the CPU add, you'll be able to have a thred on it yes.
The application code is the one which decide how many threads they are, their priority, etc. If the application is not coded to use all the available CPUs and adapt at runtime, then you'll be limited to that.

So dynamic allocation of CPUs might not be worth it, unless the application checks at runtime the available CPUs, or if you run several process of it.

Thanks it was very helpful.
M.Fazel
Posts: 16
Joined: 30. May 2013, 08:34

Re: Dynamically allocation of VCPUs

Post by M.Fazel »

noteirak wrote:There is two level of control for this :
The OS will distribute threads on cores (vCPU) so if you stop a process, then start another one after the CPU add, you'll be able to have a thred on it yes.
The application code is the one which decide how many threads they are, their priority, etc. If the application is not coded to use all the available CPUs and adapt at runtime, then you'll be limited to that.

So dynamic allocation of CPUs might not be worth it, unless the application checks at runtime the available CPUs, or if you run several process of it.
would you mind tell me that how does virtual machine allocate VCPUs based on PCPUs? I mean how many VCPUs are dedicated to each PCPUs?

Regards.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Dynamically allocation of VCPUs

Post by noteirak »

There is no such thing as vCPU based on pCPU. The Virtual Machine creates one dedicated thread per vCPU configured, the host OS does the rest (pCPU scheduling, etc).
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
M.Fazel
Posts: 16
Joined: 30. May 2013, 08:34

Re: Dynamically allocation of VCPUs

Post by M.Fazel »

noteirak wrote:There is no such thing as vCPU based on pCPU. The Virtual Machine creates one dedicated thread per vCPU configured, the host OS does the rest (pCPU scheduling, etc).
I see, So the host is responsible for that.

Thanks for your useful information and share it with me.
Post Reply