All about processors in linux !!

difference between Physical CPU ,CPU cores , logical CPU’s
info about available processors , free sockets etc on a “Red Hat OS”

Note: convention used

commands are shown starting with “#”in bold  description/results of a command are shown as “##” in italics

something like this

#command    ##description/result  of a command


terms
  1. physical processor : this is the processor that is physically seen on the mother board.
  2. cores : each physical processor may have number cores built into it (These are number of physical cores available )
  3. logical cores  : These are the number of processors seen by the OS/Kernel each core can work as more than 1 logical processor if hyper threading is enabled  , and each logical core can handle an instruction independently.
The following command will show how many active physical processors a system has. Example: If this number is 2, one could potentially open up the system chassis and remove 2 physical processors with one’s hands.
____________________________________
#cat /proc/cpuinfo | grep -i ‘physical id’ | sort -u | wc -l
2
_____________________________________
2 physical cores
##sort -u(unique sort)  , wc -l returns the processor count
On a system with multi-core processors, the following command will report the number of CPU cores per physical processor (though in rare cases it might not). Example: If this number is 4 and physical CPUs is 2, then each of the 2 physical processors has 4 CPU cores, leading to a total of 8 cores.
____________________________
#cat /proc/cpuinfo | grep -i cpu.cores  | sort -u

cpu cores       : 6

_____________________________

each physical processor has 6 cores.
considering the above example ( 2 physical processors have a total of 12 cores )
The below command will show the total number of logical processor seen by the linux kernel , This number is most important as this shows the actual number of cores seen by the OS , this is further the number of cpu’s that can work independently on any given instruction . if the number cpu cores and number of logical cores are same then there is no hyper threading enabled
___________________________________
#cat /proc/cpuinfo | grep -i processor | wc -l
24
___________________________________
24 logical cores
( as per above example 12 core processor is seen in OS as 24 cpu’s meaning each core is seen as 2 logical processors no of threads is 2 ).
2> How to determine number of CPU sockets
____________________________
#dmidecode -t4 | grep Socket.Designation: | wc -l
2
___________________________
(OR)
___________________________
# lstopo –whole-system  –only socket  | wc -l
2
___________________________
( OR )
one simple command reveals most of the information you are looking for
# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                24                                                      ##  logical cores
On-line CPU(s) list:   0-23
Thread(s) per core:    2                                                ## Threads
Core(s) per socket:    6                                                ## CORES
Socket(s):             2                                                     ## Sockets
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 44
Stepping:              2
CPU MHz:               1600.000
BogoMIPS:              6133.27
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              12288K
NUMA node0 CPU(s):     1,3,5,7,9,11,13,15,17,19,21,23
NUMA node1 CPU(s):     0,2,4,6,8,10,12,14,16,18,20,22

 

Leave a Reply

Your email address will not be published. Required fields are marked *