+5 votes
74 views
High Linux CPU Consumption | Solution

in Linux/Unix by (552k points)
reopened | 74 views

1 Answer

+3 votes
Best answer

1 Solve High Linux CPU Consumption from Processes
2 Fix Linux High CPU Consumption killing processes
3 Solve Linux High CPU Consumption Updating the system
4 Fix Linux High CPU Consumption by Reinstalling App
5 Fix Linux High CPU Consumption Using Older Version
6 Solve High Linux CPU Consumption with Applications
7 Solve Linux High CPU Consumption by setting System Power
8 Fix Linux High CPU Consumption Using Lightweight Desktop
9 Solve Linux High CPU Consumption by closing apps
9 Solve Linux High CPU Consumption by modifying the kernel

The CPU or processor is the heart of everything we work on in any operating system and its use can allow work processes to be fast or we can notice slowness in them, affecting our productivity, the processor has numerous features that are linked to its options of performance, its design, technology, number of internal cores, speed, play an essential role so that all operations are as fast as possible, but when we are working on our Linux distributions, in this case Ubuntu, which by default do not require a Quite demanding CPU, we can notice a high consumption of this causing a slowdown of the tasks, in Ubuntu we can check all the characteristics of the CPU with the command:

 lscpu 
CPU details
This gives us details like:

 

  • CPU architecture (32 or 64 bits)
  • Size of your routing
  • Number of internal CPUs
  • Maker
  • complete model
  • Virtualization Features
  • NUMA
  • cache available
  • Vulnerabilities and more details

 

 

 

image

 

 

 

TechnoWikis has a series of solutions to correct high CPU consumption in Linux and thus optimize daily tasks..

 

 

To stay up to date, remember to subscribe to our YouTube channel!   SUBSCRIBE

 


1 Solve High Linux CPU Consumption from Processes


Without a doubt that processes are one of the most common causes to create a CPU hit, the top command allows us to see the Linux processes using a real-time dynamic view of the entire execution of the system to detect where this causes the error, with top we will have access to the summary information of the system as well as to the list of processes or threads managed by the Kernel of the system.

 

We open the terminal and execute "top" to list processes with their CPU consumption:

 

image

 

 

CPU Columns
When executing we will have columns with details such as:

 

  • PID: is the unique identification of the task process
  • USER: indicates the user associated with that process
  • PR: is the priority of the process, in this case the lower the number, the higher its priority
  • NI: is the current value of the task, a nice value refers to a higher priority and a positive value shows us a lower priority
  • VIRT: is the total virtual memory used by the process
  • RES: is the amount of physical RAM used by the process in kilobytes
  • SHR: indicates the size of shared memory (kb) by the process or task
  • %CPU: is the point that interests us and indicates the total CPU usage for that process
  • %MEM: is the memory usage of that process

 

 

There it will be possible to identify some process with high CPU consumption and consider stopping it.

 


2 Fix Linux High CPU Consumption killing processes


If a process persists in consuming CPU we can "kill" it to release the CPU, for this we first open the terminal and execute "top" to list current processes.

 

Step 1

There we will take into account the PID of the process that affects the CPU:

 

image

 

Step 2

Now we kill the process with the syntax:
 sudo kill PID 
image

 

 

This will close the application or process with said PID..

 


3 Solve Linux High CPU Consumption Updating the system

 

Many times high CPU consumption is due to outdated operating systems which has a direct implication on CPU performance.

 

Step 1

To update the system, we open the terminal and update it with the command:
 sudo apt update 
image 5

 

Step 2

We apply the updates with the command:
 sudo apt upgrade 
image

 

Step 3

We confirm the process by entering the letter S:

 

image

 

 

Step 4

We wait for this update process to finish:

 

image

 

 


4 Fix Linux High CPU Consumption by Reinstalling App


Another common cause of high CPU consumption in Linux is associated with application errors that with their internal processes use maximum CPU resources, in this case it is advisable to reinstall the application.

 

Step 1

To do this, we uninstall it by executing:
 sudo apt remove app 
image

 

Step 2

Confirm the process:

 

image

 

Step 3

We execute the following command to completely delete all associated packages:
 sudo apt autoremove 
image

 

Step 4

Confirm the process:

 

image

 

step 5

We update the system:
 sudo apt update 
image

 

Step 6

We install the application again:
 sudo apt install app 
image

 

 

Step 7

We confirm the operation. There we can after a while see the behavior of the CPU.

 

 

image

 


5 Fix Linux High CPU Consumption Using Older Version

 

Continuing with the applications, many times the new versions may have services that consume extra CPU resources, affecting their use and generating high consumption, in this case it will be possible to return to a previous version if possible..

 

Step 1

To do this, we open the terminal and validate the versions of the app:
 sudo apt policy app 
image

 

Step 2

If there is a previous version, we execute the following:
 sudo apt install app=version 

6 Solve High Linux CPU Consumption with Applications

 

We well know that one of the advantages of Linux is that being open source we have thousands of applications to be used, a good option is to use alternative applications to those we use in our day to day.

 

Step 1

In this case, for example, instead of Firefox we install Google Chrome:

 

image

 

Step 2

Then we run the .deb file:

 

image

 

 

Note
in case of error we execute "sudo apt -f install".

 


7 Solve Linux High CPU Consumption by setting System Power

 

 

Step 1

Power in Linux can help optimize overall system usage but at the same time have an impact on the CPU due to background tasks running, to check this open Settings:

 

image

 

Step 2

In the pop-up window we go to the "Energy" section and validate that "Balanced" is active:

 

image

 

This method seeks standard performance and power usage.

 


8 Fix Linux High CPU Consumption Using Lightweight Desktop

 

By default we have a GNOME desktop environment which has multiple functions that due to its dynamism can affect the performance of the CPU, to solve this we can install a lightweight desktop like LXQt, this is a Qt desktop environment that has:

 

  • Advanced file manager
  • modular components
  • window manager
  • Multiple configuration options

 

Step 1

We open the terminal and install the LXQt environment:
 sudo apt install lxqt 
image

 

Step 2

We confirm the process and wait for it to finish:

 

image

 

Step 3

After this we close the session:

 

image

 

 

Step 4

We will see the following message:

 

 

image

 

 

step 5

We access the login screen, select the user and at the bottom we select the new environment:

 

image

 

 

Step 6

Sign in to the new desktop environment:

 

image

 

 


9 Solve Linux High CPU Consumption by closing apps

 

 

With this method we seek to disable or close applications not linked to programs as such but to processes, we open the terminal and execute:

 input 
image

 

xinput is a utility with which the available input devices are listed, it allows you to consult information about a device as well as change the configuration of the available input device, there it is possible to disable input apps that affect the CPU (if applicable) with the syntax :

 xinput --disable DEVICE_ID 

9 Solve Linux High CPU Consumption by modifying the kernel

 

This is a more careful step since some misconfiguration can damage access to the system and it is considered the last step when nothing has worked, update the kernel to Liquorix, this is a replacement for the native distribution kernel and has several configuration and kernel options for desktop workloads and traditional tasks, some of its features are:

 

  • Interaction with Zen
  • PDS Process Scheduler
  • High resolution task scheduling
  • TCP BBR2 congestion control
  • Hierarchical RCU based on preferred tree
  • minimal debugging

 

Step 1

We open the terminal and add the repository:
 sudo add-apt-repository ppa:damentz/liquorix 
image

 

Step 2

Press Enter to add it:

 

image

 

Step 3

We update the system and incidentally the repository that has just been added:
 sudo apt update 
image

 

Step 4

We install the kernel with the command:
 sudo apt-get install linux-image-liquorix-amd64 linux-headers-liquorix-amd64 
image

 

step 5

Confirm the process by entering the letter S and wait for it to finish:

 

image

 

Step 6

After this we restart the system to apply the changes:

 

image

 

Step 7

We will see the next message. We restart the system and wait for the changes to be applied with the new kernel and thus validate during common use if the CPU has a high consumption or is already stable.

 

image

 

Each of these options is functional to allow the CPU in Linux to work based on its internal characteristics and thus our work and processes are not affected by external factors.

 


by (3.5m points)
edited

Related questions

+5 votes
1 answer
+3 votes
1 answer
+5 votes
1 answer
+3 votes
1 answer
asked Jan 12, 2023 in Windows11 by backtothefuture (552k points) | 91 views
+3 votes
2 answers
asked Feb 14, 2020 in Windows 10 by backtothefuture (552k points) | 1.2k views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users