Too many CPUs warning

This is for discussing general topics about how to use VirtualBox.
science_man
Posts: 22
Joined: 7. Nov 2014, 04:05

Too many CPUs warning

Post by science_man »

I am running host windows 8.1 with an i7 processor that has 4 physical cores, and 8 logical processors. For my guest operating system, I want it to have access to every single one of my logical processors. If I give it 4 CPUs under the System->Processor tab, and run some process that takes a lot of CPU for a while, it is only using 4 out of my eight logical processors (checked using the windows 8 task manager). If I give the guest 8 CPUs (physical CPUs) under the Processor tab, it will use all of my logical processors when given a complex and multithreaded task. However, giving the guest twice as many processors as the host causes an "Invalid Settings Detected" warning. I am able to run the guest just fine, as I guess these invalid settings really are just a warning, but this error bothers me. It seems like this is an error in VirtualBox, and it should allow me, without a warning, to create as many CPUs as I have logical processors, rather than the number of physical cores that are in my CPU. Thoughts? Is there a reason why this warning exists, but VirtualBox still passes through all my logical processors? Is this a bug? It bothers me quite a bit to have a little yellow exclamation mark.
BTW, I am using 4.3.12, rather than the latest version because of a different issue. However, my topic is still relevant in the latest version. I checked.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Too many CPUs warning

Post by Perryg »

Because giving all processors to the guest leaves none for the host. The issue is VirtualBox uses processors and not cores.

If you want to eliminate some of the warnings turn off hyper-threading in you bios, but remember to leave one processor for the host.
science_man
Posts: 22
Joined: 7. Nov 2014, 04:05

Re: Too many CPUs warning

Post by science_man »

Perryg wrote:Because giving all processors to the guest leaves none for the host. The issue is VirtualBox uses processors and not cores.

If you want to eliminate some of the warnings turn off hyper-threading in you bios, but remember to leave one processor for the host.
Won't turning off hyper-threading for my host slow my computer down? And even if I leave one processor for my host (choose 7 CPUs) I will still get a warning.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Too many CPUs warning

Post by Perryg »

It really doesn't work that way. Hyper-threading is not really used that often unless you have am app that actually uses it. Anyway you are still talking about cores and not physical processors. Your PC has 4 physical processors and by splitting each with clock ticks and pipes you see 8. If you want to see 8 then leave it alone but use 6 instead of 7 cores. Then run some tests and you will see that it works as it should.
science_man
Posts: 22
Joined: 7. Nov 2014, 04:05

Re: Too many CPUs warning

Post by science_man »

Perryg wrote:It really doesn't work that way. Hyper-threading is not really used that often unless you have am app that actually uses it. Anyway you are still talking about cores and not physical processors. Your PC has 4 physical processors and by splitting each with clock ticks and pipes you see 8. If you want to see 8 then leave it alone but use 6 instead of 7 cores. Then run some tests and you will see that it works as it should.
I make apps that use all the cores. I have created a program before that, when configured to use multithreading, and when virtualbox is given 8 cpus, uses all 8 processors. I want it to be able to use all 8 processors. I also don't know what you mean by "works as it should" does this mean that it will use 6 cores, just as I told it to? This makes sense, the problem is not that it doesn't work, but rather that it thinks it's using cores, but really it's using processors. This really does seem like a problem with VirtualBox.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Too many CPUs warning

Post by Perryg »

I am running host windows 8.1 with an i7 processor that has 4 physical cores, and 8 logical processors.
I think you have this backwards i7 has 4 processors and 8 cores. VBox uses processors and it can be tricked to think you have 8 when in fact they are just cores. If you write apps then you already know the difference in cores and physical processors and I can't add anything to the discussion other than what I have said.
science_man
Posts: 22
Joined: 7. Nov 2014, 04:05

Re: Too many CPUs warning

Post by science_man »

Perryg wrote:
I am running host windows 8.1 with an i7 processor that has 4 physical cores, and 8 logical processors.
I think you have this backwards i7 has 4 processors and 8 cores. VBox uses processors and it can be tricked to think you have 8 when in fact they are just cores. If you write apps then you already know the difference in cores and physical processors and I can't add anything to the discussion other than what I have said.
I don't think I have this backwards. Cores refers to the physical number of things in the CPU, and logical processors refers to the number of threads. Perhaps threads would be a more apt word than processors to have used.
Regardless, I'm not sure that you understand my problem. I want to have virtualbox use as many threads of my CPU as possible, including ones that my host (or the bios or whatever) emulates, but Virtualbox complains if I try to use any more threads than I have cores. Because it actually uses threads, which I have discovered through experimentation, I think this is a problem.
I do appreciate what you have said, by the way. It has gotten me to think more about this whole thing.

Edit: to clear up more of the cores/processors, I am very sure that the i7 processor has 4 cores, which are hyperthreaded to 8 threads.
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: Too many CPUs warning

Post by mpack »

science_man wrote:I want to have virtualbox use as many threads of my CPU as possible
Not really possible, since VirtualBox doesn't actually use any your cores (much), your guest OS and guest apps do. All VirtualBox does is supervise access. Sure, you can allocate more cores to the VM, but that doesn't force the VM to use them.

If you have a quad core host CPU I would not allocate more than 2 cores to the guest. The number of threads is not relevant in this discussion.
science_man
Posts: 22
Joined: 7. Nov 2014, 04:05

Re: Too many CPUs warning

Post by science_man »

mpack wrote: Not really possible, since VirtualBox doesn't actually use any your cores (much), your guest OS and guest apps do. All VirtualBox does is supervise access. Sure, you can allocate more cores to the VM, but that doesn't force the VM to use them.

If you have a quad core host CPU I would not allocate more than 2 cores to the guest. The number of threads is not relevant in this discussion.
I misspoke. I meant that I want my guest to use as many threads as possible. And the number of threads is very relevant, because those are what VirtualBox is allocating to the guest. I want VirtualBox to allocate as many threads as possible to my guest. I could allocate all but one thread, leaving me with some processing power for my host, but that is not relevant to this discussion, because the problem is that anything over half my threads results in a warning.

Edit: Just to be even more clear with what I'm talking about, when VirtualBox says it's allocating cores to the guest, it's really allocating threads. This is proved with a quick 'allocate 4 cores, run a CPU intensive and multithreaded process, check the windows 8 task manager. Allocate 8 cores, run a CPU intensive and multithreaded process, check the windows 8 task manager.'
Last edited by science_man on 7. Nov 2014, 12:49, edited 1 time in total.
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: Too many CPUs warning

Post by mpack »

As I said, hyperthreading is irrelevant. The VT-x feature involved assigns cores, not threads.
science_man
Posts: 22
Joined: 7. Nov 2014, 04:05

Re: Too many CPUs warning

Post by science_man »

mpack wrote:As I said, hyperthreading is irrelevant. The VT-x feature involved assigns cores, not threads.
You are incorrect.
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: Too many CPUs warning

Post by mpack »

Tell me, why do you think that multi-core CPUs exist?

Hyperthreading is cheaper to do (much less silicon), and if it's just as good as physical cores, why would you ever do anything else?
science_man
Posts: 22
Joined: 7. Nov 2014, 04:05

Re: Too many CPUs warning

Post by science_man »

mpack wrote:Tell me, why do you think that multi-core CPUs exist?

Hyperthreading is cheaper to do (much less silicon), and if it's just as good as physical cores, why would you ever do anything else?
Um I don't know. I don't think I ever tried to imply that hyperthreading wasn't as good as physical cores, just that virtualbox doesn't like it when I tell it to let my guest use more threads than I have cores.
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: Too many CPUs warning

Post by mpack »

science_man wrote:I don't think I ever tried to imply that hyperthreading wasn't as good as physical cores
Well you should have, since that is the fact.

And incidentally, I'm not wrong when I said that VT-x can only assign cores, not threads.

A true multi-core CPU is essentially several independant CPUs on a single silicon chip. It is my understanding that each of those CPUs has to support VT-x separately, i.e. VT must be enabled separately on each core. OTOH you can't do that to a thread - a thread is just a scheduling optimization, not an additional core.
science_man
Posts: 22
Joined: 7. Nov 2014, 04:05

Re: Too many CPUs warning

Post by science_man »

Perhaps this will clear things up:
I have 4 physical cores in my CPU
They are hyperthreaded to 8 threads total, eight processes can be run at once.
Windows 8 refers to these as "logical processors"

Here is a screenshot of when I run my guest telling VirtualBox to allocate 8 cores. VirtualBox does not like doing this, and gives me a warning.
(This is dumb, but this forum won't let me post urls)
i DOT imgur DOT com/1sQI1rQ.png

Here is a screenshot of when I run my guest telling VirtualBox to allocate 4 cores. VirtualBox does this without complaint, but only uses half my available CPU.
i DOT imgur DOT com/KCVB315.png
Locked