52

My processor is an Intel Core i3-380m. As you can see, it's 2 cores and 4 threads.

Although, both Ubuntu 11.04 and Windows 7 seem to think it's a quad-core CPU:

enter image description here

enter image description here

Why is this? Is it because there are 2 threads per core, dividing the CPU in 4 processing units?

5 Answers 5

43

As mentioned you have a dual-core system, with 2 threads per core.

This is marketed by Intel as hyperthreading and has been done in various ways over the years by various different manufacturers.

To explain it in its simplest form each CPU core consists of a "core" and various architecture around that core that keeps state and process information for each thread. A single threaded core has the architecture to keep 1 thread worth of state information held at a time, a hyperthreaded core keeps two distinct sets of state information, allowing two separate processes to run at once as long as they require different parts of the core (which is reasonably likely to happen as the core consists of multiple units of multiple different types of processing unit).

To simplify how the CPU is seen to the system each hyperthread is seen as a separate CPU, so a dual core, 2 thread per-core processor appears as a quad core processor.

It is also possible for the operating system to use Core-parking (a feature in newer Intel processors) allows the operating system to suspend one half of a hyperthreaded core so that when the extra processing ability of hyperthreading is not needed then the single thread performance is increased as the core is no longer sharing it's cache across 2 threads and can now fully devote the on-core cache to a single thread.

3
  • Thanks for the explanation. So, can we say here that a thread is to a core what a core is to a processor?
    – seriousdev
    Aug 30, 2011 at 16:37
  • 2
    In a way, yes. The OS sees the processor, knows how many cores are on that processor and in turn how many threads each core supports, from that the CPU usage you are seeing is now "per-thread" rather than "per core". It's not quite that simple (as each thread does actually appear to a non-hyperthreading aware OS as a fully fledged CPU core) but that is the general idea of it.
    – Mokubai
    Aug 30, 2011 at 16:46
  • @Mokubai core-parking link does not work.
    – Biswapriyo
    Apr 1, 2018 at 19:58
48

The reason is hyperthreading, which your processor supports. Hyperthreading isnt the equivalent of an extra processor, but can really boost performance on multithreaded applications. For each processor core that is physically present, the operating system addresses two virtual processors, and shares the workload between them when possible.

7
  • 7
    Is this known as physical vs logical cores?
    – xdumaine
    Aug 30, 2011 at 16:39
  • 11
    Yes, a physical core is - well... physical. You can touch it. Hyperthreaded cores arent real, hence logical. You can break physical cores into logical cores through virtualiztion, also.
    – Keltari
    Aug 30, 2011 at 17:39
  • 3
    @Keltari actually, there is a physical part to it... Hyperthreading is a hardware component in a CPU core (and can only be disabled on a hardware level). See this Intel whitepaper for details. Basically, it shares a core's resources between two physical execution units. Technically, both cores seen by the OS in a hyperthreaded core are "logical", there isn't both a physical and logical one. Aug 30, 2011 at 19:53
  • 1
    true, hyperthreading is a physical part of the processor, but not a physical core.
    – Keltari
    Aug 30, 2011 at 19:55
  • 1
    The best way to think of HT is a "core-and-a-half" it shares many more resources with its brother than the seperate cores do. However it is capable of executing a thread "on its own" and the OS treats it as a thread execution unit (which you associated with a core).
    – crasic
    Aug 31, 2011 at 0:22
12

Things are a lot more complex than they were in the days of one cpu instruction per one clock cycle.

There's now a pipeline for each instruction that consists of a number of steps. I've heard as many as 41, though that was a while ago and I have no idea what current cpu pipelines look like. I do know that if the pipeline is long enough, you can start a new instruction down the pipeline before the last instruction has finished, sometimes in the same clock cycle, so that your single core is effectively doing two things at once.

There's a trick here, though. You can't just use this to speed up the rate at which your processor chews through instructions from a specific program. There's a correctness issue involved: the next instruction might depend on the as-yet-undetermined result of the prior instruction. To take advantage of the long pipeline safely, the chip will present two separate processor cores to the operating system scheduler, and alternate instructions sent to each core so that two instructions to the same "core" are never in the pipeline at the same time. This way it we can be sure that any instructions executed simultaneously will not interfere with each other. This is called hyperthreading.

It's worth noting here that while hyperthreading can significantly increase the amount of work you get out of your cpu, it's nowhere near as good as having that many physical cores. Depending on your work-load, it might means as little at 15% improvement or as much as 40% improvement. In some circumstances, you may even want to disable the feature so that the remaining cores have full exclusive access to the L1/L2 cache for that core (this is sometimes done with dedicated database servers).

When your chip advertises itself as having 2 cores with 4 threads, that means it's a dual core processor that supports hyperthreading.

2

Take a look at this intel page- it has lots of animations showing how hyperthreading speeds up your tasks.

The Utilization of Processor Resources is the best animation, look at it and them click the "advance" button.

1

Why is this? Is it because there are 2 threads per core, dividing the CPU in 4 processing units?

Putting this simply, the answer is yes. Each core of your cpu can support two independent threads, so 4 in total. But it doesn't mean it has the same performance as a quad-core single-threaded cpu. practically the performance of a dual-core double-threaded cpu is lower than that of a quad-core single-threaded cpu. Like the AMD Phenom X4.

2
  • Do you know why?
    – seriousdev
    Aug 30, 2011 at 21:09
  • 1
    The reason is that in a double-threaded core the hardware resources (like reorder buffer) is shared between two threads, while in a single-threaded cpu all resources are dedicated to one core. It's worth mentioning that having a mulch-threaded core increases your hardware utilization and throughput, but it's bad for latency. There are many trade-offs involved. So the word "performance" is really vague here. For ordinary people it means the latency of a single thread.
    – aminfar
    Aug 30, 2011 at 22:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .