1

Question:

I'd like to ask what may cause that there are two different informations about the number of processors. See the reports below.

System dialog:

If open the System settings/Details tab (same as Logout-wheel and About this computer) I get reported the following thing:

Processor: Intel® Xeon(R) CPU E5-2680 v3 @ 2.50GHz × 16


CLI: cpuinfo (1)

Nevertheless, using a command line command, i get the follwing:

$ cat /proc/cpuinfo | grep processor | wc -l
24

I tend to believe the command line report - but what may cause them to be different?

FIY: The system monitor also shows stats for 24 cores


CLI: cpuinfo (2)

As suggested by in the comments, I also ran the following command line

$ cat /proc/cpuinfo |grep 'core id'|sort|uniq|wc -l
12

So now I even have a third result! This one makes sense as it could be that 12 cores with 2 processors are in the machine - but how is it possible that the system dialog counts 16?

dmeu
  • 819
  • sounds like something related to pysical and virtual cores? – Mr.Gosh May 28 '15 at 11:35
  • For each processor listed in /proc/cpuinfo you can see to which physical core it belongs by looking at the core id field. You should therefore be able to get a count of the number of physical cores by running cat /proc/cpuinfo |grep 'core id'|sort|uniq|wc -l – lgpasquale May 28 '15 at 11:54
  • @Mr.Gosh how would I know about that? Is it possible that my computer really has 16 cpus with 2 cores and 4 are offline somehow? Thus, 12*2 are available, but really the system somehow detects 16? – dmeu May 28 '15 at 13:33
  • The specifications for your processor are 12 cores, 2 threads per core, or 24 threads (CPUs). – Doug Smythies May 28 '15 at 14:17
  • Thanks for your input. I put the output in the main question @lgpasquale – dmeu May 28 '15 at 14:17
  • @DougSmythies, I am not quite sure how to answer - so the cpuinfo says that there are 12 cpus with 2 cores each = 24 processors, right? And the system info dialog says that there are 16 x [cpu model] – dmeu May 28 '15 at 14:19
  • I always trust the most primitive level of information over higher level stuff. In this case /proc/cpuinfo over anything else. Does this work: taskset -c 23 cat /dev/zero > /dev/null , meaning can you force the use of cpu number 23? – Doug Smythies May 28 '15 at 14:29
  • what does lscpu give? – Doug Smythies May 28 '15 at 14:41
  • @DougSmythies

    lscpu: CPU(s): 24 On-line CPU(s) list: 0-23 Thread(s) per core: 2 Core(s) per socket: 12 Socket(s): 1

    Also , I am currently running tasks that seems to be using 24 cpus. So all is well with that. But I still do not get why the System tells me 16.. ah well

    – dmeu May 29 '15 at 07:54

1 Answers1

2

I think CPU cores are best-explained in relation to Symmetric MultiProcessing (SMP).

enter image description here

Intel Core 2 Duo Diagram to show the physical layout. enter image description here


The system's CPU info is stored in the /proc directory. It can be neatly presented by the lscpu software, as below. I'm giving a three examples for contrast: a desktop with 2 CPU cores, a server with 48, and a Raspberry Pi with 4.

Desktop Computer
user@hostname:~$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 60
Stepping:              3
CPU MHz:               800.000
BogoMIPS:              5586.94
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              2048K
NUMA node0 CPU(s):     0,1

Server
user@hostname% lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                48
On-line CPU(s) list:   0-47
Thread(s) per core:    2
Core(s) per socket:    12
Socket(s):             2
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 62
Stepping:              4
CPU MHz:               1799.724
BogoMIPS:              3600.09
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              30720K
NUMA node0 CPU(s):     0-47

Raspberry Pi
jeff@clear-pi:~ $ lscpu
Architecture:          armv7l
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             1
Model name:            ARMv7 Processor rev 5 (v7l)
CPU max MHz:           900.0000
CPU min MHz:           600.0000

The server total is 48, but there are 3 numbers that must be multiplied to get there: 2*12*2=48. CPU manufacturer arrangement differences are apparent when comparing this way.

Desktop
[Thread(s) per core: 1] * [Core(s) per socket: 1] * [Socket(s): 1] = 2

Server
[Thread(s) per core: 2] * [Core(s) per socket: 12] * [Socket(s): 2] = 48

Raspberry Pi
[Thread(s) per core: 1] * [Core(s) per socket: 4] * [Socket(s): 1] = 4  

lshw has more system info, but not quite as helpful here.

Desktop Computer
user@hostname:~$ sudo lshw
     *-cpu
          description: CPU
          product: Intel(R) Celeron(R) CPU G1840 @ 2.80GHz
          vendor: Intel Corp.
          physical id: 9
          bus info: cpu@0
          version: Intel(R) Celeron(R) CPU G1840 @ 2.80GHz
          slot: SOCKET 0
          size: 2800MHz
          capacity: 3800MHz
          width: 64 bits
          clock: 100MHz

Server
user@hostname% sudo lshw
     *-cpu:0
          description: CPU
          product: Intel(R) Xeon(R) CPU E5-2651 v2 @ 1.80GHz
          vendor: Intel Corp.
          physical id: 4
          bus info: cpu@0
          version: Intel(R) Xeon(R) CPU E5-2651 v2 @ 1.80GHz
          slot: SOCKET 0
          size: 1800MHz
          capacity: 4GHz
          width: 64 bits
          clock: 100MHz

Raspberry Pi
user@hostname:~ $ sudo lshw
*-cpu:0
          description: CPU
          product: cpu
          physical id: 0
          bus info: cpu@0
          size: 900MHz
          capacity: 900MHz
          capabilities: cpufreq

Lastly, this method has worked for me across several different Linux/UNIX operating systems where lscpu was not available. It's a variation of something suggested in the question and comments, but I prefer the short-hand command and simple output.

user@hostname:~ $ grep -c ^processor /proc/cpuinfo
4

Reference: How to find the number of CPU cores including virtual?

Reference: https://stackoverflow.com/questions/6481005/how-to-obtain-the-number-of-cpus-cores-in-linux-from-the-command-line

Reference: https://stackoverflow.com/questions/19225859/difference-between-core-and-processor

musicman1979
  • 1,147
  • 1
  • 9
  • 26