15

enter image description here

As the image shows number of processors are 4.

But intel i5-4210U has only 2 cores as shown below. (Intel's own specs.)

enter image description here

So, if i5-4210U has only 2 cores than what is "4" indicating in the 1st pic?

lscpu gives this result:

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    2
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 69
Stepping:              1
CPU MHz:               989.531
BogoMIPS:              4788.74
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0-3
foxtrot9
  • 557
  • 10
    Because it has Hyperthreading, which means that the CPU presents four cores to the OS, instead of only the two physical ones, in order to improve performance. ("# of threads" from the spec sheet is what the CPU info in Ubuntu is showing you) – Jonas Czech Aug 03 '16 at 11:16
  • 3
    The other way of finding this out is to do lscpu and look at CPU(s), Thread(s) per core and Core(s) per socket and Socket(s). – edwinksl Aug 03 '16 at 11:18
  • @edwinksl , added result of lscpu. – foxtrot9 Aug 03 '16 at 11:23
  • 2
    So you have 4 "CPUs" aka logical cores, 2 threads per physical core (this is the hyperthreading part), 2 physical cores per socket and 1 socket. 4 = 221. – edwinksl Aug 03 '16 at 11:27
  • you didn't hear hyperthreading which exists since pentium 4? – phuclv Aug 04 '16 at 07:54
  • @LưuVĩnhPhúc , I heard the name 'hyperthreading' but I never searched for it before. – foxtrot9 Aug 06 '16 at 17:05

3 Answers3

32

Your CPU has only 2 cores, but supports 4 concurrent threads.

This is achieved by Intel's Hyper-Threading technology that allows to run two separate threads in parallel at the same time on one single core.

So 2 cores x 2 threads per core means 4 threads per CPU.

Byte Commander
  • 107,489
  • 1
    I know little bit about threads so I am curious how this can be achieved at hardware level? I mean 2 threads per CPU? – foxtrot9 Aug 03 '16 at 11:19
  • 7
    I can't really start explaining the whole concept behind hyper threading here, this would blow up the answer. Instead I would like to suggest you to read the corresponding wikipedia article or feed your favourite search engine with "hyperthreading". – Byte Commander Aug 03 '16 at 11:28
  • 6
    In short, we can say that a hyperthreading-capable core has some elements (architectural state i.e. the registers etc) duplicated while others (execution engine, cache) are shared. – Byte Commander Aug 03 '16 at 11:32
  • 5
    @foxtrot9 basically, a single thread of execution usually doesn't use anywhere near 100% of a CPU core — the CPU spends time waiting for data to load from memory, and any given instruction doesn't use all of the little circuits (execution units) in the core that do various things. HT lets two threads of execution share the core, so one can run while the other is waiting, or they both can run if they use disjoint sets of execution units. But because the two threads have to share resources, sometimes one stops the other from running, so it's not as fast as 2 whole cores. – hobbs Aug 03 '16 at 15:55
  • @hobbs Detailed but simple explanation, great! Thanks for this informative comment :) – Byte Commander Aug 03 '16 at 16:15
3

As you can see in the image you provided from Intel, the number of Threads is 4.

So I would say that Ubuntu is showing the number of Threads and not of the Cores

Nico T
  • 141
0

In i5-4210 processor of Intel there are 2 physical cores which are further split into 2 logical cores; these logical cores are achieved by Intel's hyper threading technology. Thus making it a total of 4 cores as shown in the pic. This info is also given in the other pic.

Moksh
  • 41
  • I don't know why people are downvoting your answer, what you've said is true. – James Hyde Aug 04 '16 at 09:56
  • People are dumb then, I don't mind. – Moksh Aug 04 '16 at 09:58
  • Just to back up this answer, Wikipedia says: "For each processor core that is physically present, the operating system addresses two virtual (logical) cores." – James Hyde Aug 04 '16 at 10:00
  • Thnx @lightswitchr – Moksh Aug 04 '16 at 10:01
  • 1
    I think people are downvoting because you said that there are two physical cores and two logical cores. That's not true, each physical core is split into two logical cores, so there are four logical cores (two running on each physical core). –  Aug 04 '16 at 12:13
  • It may be the reason, sorry for my mistake guys. – Moksh Aug 04 '16 at 12:26
  • @Moksh Your assertion is only partially correct. The number of physical cores in Intel i5 processors can vary and may be either 2 or 4. For example, my i5-6600K, a desktop CPU, has 4 physical and 4 threads (no hyper threading). The i5-4210 is part of Intel's "Mobile Processor" line where (apparently) the number of physical cores is 2. – irrational John Aug 06 '16 at 18:43
  • @irrational you're right but I gave the answer as per i5-4210 as the person who asked the question had that version of processor. Thanks though. – Moksh Aug 06 '16 at 18:48
  • @irrational as per my knowledge both support hyperthreading. – Moksh Aug 06 '16 at 18:49
  • @Moksh You may have intended your answer to refer only to the i5-4210, but you begin by stating "In i5 processor of Intel there are 2 physical cores". This statement, as written, is not correct. Just sayin' ... And, no, the i5's with 4 physical cores do not support hyper-threading. – irrational John Aug 06 '16 at 18:50