CPU utilization is a key metric to determine how much CPU uses for a process. Today we will review why the CPU utilization for a process is over 100%. This can help us understand how CPU works on Linux.
Understanding top command in Linux
In any operating system, the CPU is responsible for running the instructions that make up a computer program. When you run a program on your computer, the CPU is what actually executes the code.
Top is a very popular and handy command line tool that provides an overview of the currently running processes in a Linux system. It can be used to find out what is causing high CPU usage and take appropriate measures to fix the issue.
Check CPU usage Utilization on Linux with top command
Top is a basic Linux command to display Linux process info. It covers the system load average, CPU utilization, process status etc.
In the following example, the utilization for process YYYY is 150%.
top – 05:43:20 up 10 days, 20:45, 1 user, load average: 0.29, 0.29, 0.29
Tasks: 755 total, 1 running, 754 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.4 us, 0.4 sy, 0.0 ni, 98.8 id, 0.4 wa, 0.0 hi, 0.0 si, 0.0 st
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5424 root rt 0 1590640 176520 106044 S 150 0.5 395:13.89 YYYY
8081 oracle -2 0 1556468 20096 17032 S 1.7 0.1 255:57.88 asm_vktm_+asm1
57124 oracle -2 0 4920124 19764 16640 S 1.7 0.1 157:05.44 ora_vktm_test21
Why CPU Utilization is over 100% for a Process in top command?
The values of CPU usage over 100% for “YYYY” process is not a problem and it is a absolutely expected behavior on multi-core CPU system based on the man page. It means that the process consumes more than 1 CPU (core). As per the man page:
In a true SMP environment, if a process is multi-threaded and top is not operating in Threads mode, amounts greater than 100% may be reported.
- CPU-1 <<<——+—-YYYY is using 100% of CPU-1.
- CPU-2 <<<——+—-Another YYYY thread is using 50% of CPU-2.
Note: In the above condition, the top command will show you 100% + 50% = 150% CPU usage for process “YYYY”.