Hyperthreading Calculating Load [duplicate]
I have a dual core core i5 with hyperthreading. Since hyperthreading allows for unused cpu time to be used by other processes, why would this make it seem like 4 logical processors (2 per actual core). How is this different than out of order execution?
Lets say core0/core1 are one core and core2/core3 are another. If core0 and core2 are at 100% is my cpu at 100% load or only 50%? If all of them are at 100%, what does that entail? Also, how come processes tend to execute on core0 and core2 rather than core1 and core3?
HT is like out-of-order execution, except that it can schedule a completely different thread instead of just reordering instructions. Sometimes the CPU sits idle because it's already reordered all of the instructions that it can, and it's still waiting on data or something else. HT allows another thread to be ready to run while the first is waiting.
There are still only two physical cores in your system. If core0 and core2 are at 100%, then your processor is at 100%. If the logical cores (core0, core1, core2, and core3) are all at 100%, then your CPU is actually running at about 115% of it's total without hyper-threading.
The reason you see the alternating core use is because core0 and core1 share the same physical core, and core2 and core3 share the same physical core. If the OS scheduled core0 and core1 instead of core0 and core2, then half the processor would sit idle most of the time.
Since hyperthreading allows for unused cpu time to be used by other processes, why would this make it seem like 4 logical processors (2 per actual core). How is this different than out of order execution?
This isn't wholly correct. Hyper-threading simply adds an additional execution unit per core (in hardware), but shares the rest of the core, which is why in certain cases hyperthreading can actually reduce performance. Furthermore, hyperthreading does not explicitly "allow unused CPU time to be used by other processes". That is handled by your operating system's process scheduler.
Hyperthreading does, however, expose another "core" to the operating system, allowing it to schedule more programs to run simultaneously. Except in the cases where this would exhaust the shared hardware in a Hyperthreaded core (e.g. if two threads are running on separate execution units in a Hyperthreaded core which heavily use the cache, which is shared by both threads in a HT-core). For technical details about hyperthreading, see the Intel Core Processor Datasheet, Volume 1.
Lets say core0/core1 are one core and core2/core3 are another. If core0 and core2 are at 100% is my cpu at 100% load or only 50%? Also, how come processes tend to execute on core0 and core2 rather than core1 and core3?
It depends which parts of your processor are being stressed (performance gains by HT is very application-specific, again see above). Technically you might only be using 50% of the execution units in Core 0, but the rest of the hardware in the core might be loaded at 100% (e.g. if the program makes heavy use of cache).
For details, see the question How does Windows processor affinity work with hyperthreaded CPUs?.