Making sense of cpu info [closed]

2019-07-19 20:56发布

问题:

I generally know that the more the number of processors the more processes (watching a movie, playing some game, running firefox with youtube playing a Simpson's episode, all simultaneously) you can have simultaneously going without your computer slowing down. But I want to know how to make sense of the linux commands cpuinfo and lscpu.

lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    2
Core(s) per socket:    4
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 42
Stepping:              7
CPU MHz:               1600.000
BogoMIPS:              6800.18
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              8192K
NUMA node0 CPU(s):     0-7

and cpuinfo:

=====  Processor composition  =====
Processor name    : Quad-Core AMD Opteron(tm) Processor 2354  
Packages(sockets) : 2
Cores             : 8
Processors(CPUs)  : 8
Cores per package : 4
Threads per core  : 1

=====  Processor identification  =====
Processor   Thread Id.  Core Id.    Package Id.
0           0           0           0   
1           0           1           0   
2           0           2           0   
3           0           3           0   
4           0           0           1   
5           0           1           1   
6           0           2           1   
7           0           3           1   
=====  Placement on packages  =====
Package Id. Core Id.    Processors
0           0,1,2,3     0,1,2,3
1           0,1,2,3     4,5,6,7

What exactly are they telling me. A dual core to me means two core per processor. I can see 8 CPU(s) listed. But what is the difference between thread and cores. I can see 2 Thread(s) per core. And what is a socket? I could not google a place where things are explained but there are plenty of places which tell you to use cpuinfo/lscpu.

回答1:

What you call "core" is technically a "physical core", aka socket aka package.

A physical core is "virtually splitted" into logical cores (listed simply as "core(s)" by cpuinfo/lscpu.

So your system has 2 physical cores, each one divided into 4 logical cores. This sums up into 8 logical cores.

A similar question on tomshw: http://www.tomshardware.co.uk/answers/id-1850932/difference-physical-core-logical-core.html

Hyperthreading: http://en.m.wikipedia.org/wiki/Hyper-threading



回答2:

A socket is on the motherboard, where you plug the processor inside and have a fan cooling it.

cpuinfo on your machine says that you have a motherboard with 2 sockets and 2 processors, which are each a Quad-Core AMD Opteron(tm) Processor 2354. So together you have 8 cores (2x quad (4) core) and also 8 threads available.

you ran lscpu on a different machine which has only one processor on the motherboard. This one is an intel quad core with Hyper-Threading.



回答3:

A socket is a physical plug on your motherboard. A core is a physical part of a computer, while a thread is a specific path of execution on a core. This answer explains threads really well.

lscpu - http://manpages.courier-mta.org/htmlman1/lscpu.1.html

cpuinfo - http://www.richweb.com/cpu_info

EDIT: whoops, got network sockets mixed in there for some reason. Just kidding.