11

The output of lscpu of my pc looks like --

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:               1200.093
BogoMIPS:              3392.08
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0-3

Does it means I have 4 cpus and 2 cores?

Kusalananda
  • 333,661
alhelal
  • 1,301
  • 3
    One chip (socket) with two cores that shows up as a total of four CPUs to the system due to hyper-threading. – Kusalananda May 10 '17 at 09:02
  • 2
    @Kusalananda, The CPU(s) in the lscpu gives the number of logical central processing units (number of cores ) in one physical CPU. Isn't it ? – ss_iwe May 10 '17 at 09:06
  • @saisasanka Yes. Related question: https://unix.stackexchange.com/questions/88283/so-what-are-logical-cpu-cores-as-opposed-to-physical-cpu-cores – dr_ May 10 '17 at 09:09
  • 1
    @saisasanka In this case, there are 4 CPUs and 2 cores in 1 socket. The socket is physical, as are the cores on it. Each core shows as 2 CPUs ("Threads per core"). – Kusalananda May 10 '17 at 09:11
  • CPU(s) = Core(s) per socket * Thread(s) per core – Amit24x7 Jul 03 '17 at 06:57
  • I like @Kusalananda's explanation, though I would rather use "processor" as a synonym for "chip", as socket is by definition the hole in the motherboard where the processor goes. – Waldir Leoncio Mar 27 '20 at 08:44

2 Answers2

11

From man lscpu:

CPU
The logical CPU number of a CPU as used by the Linux kernel.

CORE
The logical core number. A core can contain several CPUs.

SOCKET
The logical socket number. A socket can contain several cores.

So yes, you have 4 CPUs, contained in physical 2 cores, contained in one physical socket.

You can get the same information from cat /proc/cpuinfo.

Related question: So what are logical cpu cores (as opposed to physical cpu cores)?

dr_
  • 29,602
5

To avoid confusion between logical and physical processors,

Intel refers to a physical processor as a socket.


Hyperthreading technology allows a single processor core to execute two independent threads simultaneously.

While hyperthreading does not double the performance of a system, it can increase performance by better utilizing idle resources leading to greater throughput for certain important workload types. An application running on one logical processor of a busy core can expect slightly more than half of the throughput that it obtains while running alone on a non-hyperthreaded processor.

Summary

  • Your system has one physical CPU (Let's name it as X)
  • Hyperthreading makes CPU X to behave like two CPUs (CPU - X1 and CPU - X2) but physically not.
  • Each X1 and X2 can execute two thread at a time, simultaneously

To summarize, you have one physical processor which can execute 4 threads simultaneously.

  • "An application running on one logical processor of a busy core can expect slightly more than half of the throughput that it obtains while running alone on a non-hyperthreaded processor". Does this mean that hyperthreading makes a core run at lightly over half its capacity? – Waldir Leoncio Mar 27 '20 at 08:38