Understanding %CPU while running top command

I am trying to understand what %CPU means when I run top.

I am seeing %CPU for my application at "400" or "500" most of the time.

Does anyone know what this means?

19080 david 20 0 27.9g 24g 12m S 400 19.7 382:31.81 paper_client

lscpu gives me this output:

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                32
On-line CPU(s) list:   0-31
Thread(s) per core:    2
Core(s) per socket:    8
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 45
Stepping:              7
CPU MHz:               2599.928
BogoMIPS:              5199.94
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              20480K
NUMA node0 CPU(s):     0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30
NUMA node1 CPU(s):     1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31
Asked By: david

||

It means you have a lot of cores. One core at max is 100%. So the highest it can be is number_of_cores × 100%.

You may want to look at why your app it as 400%.

Answered By: ctrl-alt-delor

%CPU — CPU Usage : The percentage of your CPU that is being used by the process. By default, top displays this as a percentage
of a single CPU.
On multi-core systems, you can have percentages
that are greater than 100%. For example, if 3 cores are at 60% use,
top will show a CPU use of 180%. See here for more information.
You can toggle this behavior by hitting Shifti while top is running to show the overall percentage of available
CPUs in use.

Source for above quote.

You can use htop instead.


To answer your question about how many cores and virtual cores you have:

According to your lscpu output:

  • You have 32 cores (CPU(s)) in total.
  • You have 2 physical sockets (Socket(s)), each contains 1 physical processor.
  • Each processor of yours has 8 physical cores (Core(s) per socket) inside, which means you have 8 * 2 = 16 real cores.
  • Each real core can have 2 threads (Thread(s) per core), which means you have real cores * threads = 16 * 2 = 32 cores in total.

So you have 32 virtual cores from 16 real cores.

Also see this, this and this link.

Answered By: polym
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.