Why is the CPU loaded at 100 percent all the time? Eliminate high CPU usage

  • Translation

The metric that we call “processor load” is actually not understood entirely correctly by many people. What is “CPU load”? Is it how busy our processor is? No, that's not true. Yes, yes, I’m talking about the same classic CPU load that is shown by all performance analysis utilities - from the Windows task manager to the top command in Linux.

What does “the processor is now 90% loaded” mean? You might be thinking it looks something like this:

But in reality it looks like this:

"Idle" means that the processor is capable of executing some instructions, but is not doing so because it is waiting for something - such as I/O from RAM. The percentage of real and idle work in the figure above is what I see day after day in real applications running on real servers. There is a significant chance that your program spends its time in much the same way, and you don’t know about it.

What does this mean for you? Understanding how much time the processor actually performs certain operations, and how much time it just waits for data, sometimes makes it possible to change your code, reducing the exchange of data with RAM. This is especially true in the current realities of cloud platforms, where automatic scaling policies are sometimes directly tied to CPU load, which means that every extra cycle of “idle” work costs us very real money.

What is CPU load actually?

That metric that we call “CPU load” actually means something like “non-idle time”: that is, this is the amount of time that the processor spent in all threads except the special “Idle” thread. The kernel of your operating system (whatever it is) measures this amount of time when context switching between threads of execution. If the command execution thread switches to a non-idle thread that has been running for 100 milliseconds, then the operating system kernel counts this time as the time spent by the CPU on performing real work in this thread.

This metric first appeared in this form simultaneously with the advent of time-sharing operating systems. The programmer's manual for the computer in the Apollo lunar module (an advanced time-sharing system at that time) called its idle thread with the special name "DUMMY JOB" and the engineers compared the number of commands executed by this thread with the number of commands executed by worker threads - this gave them an understanding of CPU load.

So what's wrong with this approach?

Today, processors have become much faster than RAM, and waiting for data has begun to take up the lion's share of what we used to call “CPU time.” When you see a high percentage of CPU usage in the output of the top command, you may think that the bottleneck is the processor (the hardware on the motherboard under the heatsink and cooler), when in fact it will be a completely different device - the banks of RAM.

The situation even gets worse over time. For a long time, processor manufacturers were able to increase the speed of their cores faster than memory manufacturers increased memory access speeds and reduced latency. Somewhere in 2005, processors with a frequency of 3 Hz appeared on the market and manufacturers concentrated on increasing the number of cores, hypertrading, multi-socket configurations - and all this set even greater demands on data exchange speed! Processor manufacturers tried to somehow solve the problem by increasing the size of processor caches, faster buses, etc. This, of course, helped a little, but did not radically change the situation. We are already waiting for memory most of the time to “load the processor” and the situation is only getting worse.

How to understand what the processor is actually doing

Using hardware performance counters. On Linux they can be read using perf and other similar tools. Here, for example, is a measurement of the performance of the entire system for 10 seconds:

# perf stat -a -- sleep 10 Performance counter stats for "system wide": 641398.723351 task-clock (msec) # 64,116 CPUs utilized (100.00%) 379,651 context-switches # 0.592 K/sec (100.00%) 51,546 cpu-migrations # 0.080 K/sec (100.00%) 13,423,039 page-faults # 0.021 M/sec 1,433,972,173,374 cycles # 2.236 GHz (75.02%) stalled-cycles-frontend stalled-cycles-backend 1,118,336,816,068 instructions # 0.78 insns per cycle (75.01%) 249,644,142,804 branches # 389,218 M/sec (75.01%) 7,791,449,769 branch-misses # 3.12% of all branches (75.01%) 10.003 794539 seconds time elapsed
The key metric here is " number of instructions per clock cycle" (insns per cycle: IPC), which shows how many instructions the processor executed on average for each clock cycle. Simplified: the larger this number, the better. In the example above, this number is 0.78, which, at first glance, does not seem so bad result (78% of the time useful work was performed?) But no, on this processor the maximum possible IPC value could be 4.0 (this is due to the way modern processors receive and execute instructions. That is, our IPC value (equal to 0.78) is only). 19.5% of the maximum possible instruction execution speed. And in Intel processors starting with Skylake, the maximum IPC value is already 5.0.

In the clouds

When you work in a virtual environment, you may not have access to real performance counters (this depends on the hypervisor used and its settings). Here's an article on how it works in Amazon EC2.

Data interpretation and response

If you have IPC< 1.0 , then I congratulate you, your application is idle waiting for data from RAM. Your strategy for optimizing performance in this case will not be to reduce the number of instructions in the code, but to reduce the number of accesses to RAM and more active use of caches, especially on NUMA systems. From a hardware point of view (if you can influence it), it would be wise to choose processors with larger cache sizes, faster memory and bus.

If you have IPC > 1.0, then your application suffers not so much from waiting for data, but from an excessive number of executing instructions. Look for more efficient algorithms, don't do unnecessary work, cache the results of repeated operations. Using the Flame Graphs construction and analysis tools can be a great way to gain insight. From a hardware perspective, you can use faster processors and increase the number of cores.

As you can see, I drew the line at an IPC value of 1.0. Where did I get this number from? I calculated it for my platform, and if you don’t trust my estimate, you can calculate it for yours. To do this, write two applications: one should load the processor 100% with a thread of executing instructions (without actively accessing large blocks of RAM), and the second should, on the contrary, actively manipulate data in RAM, avoiding heavy calculations. Measure the IPC for each of them and take the average. This will be the approximate turning point for your architecture.

What Performance Monitoring Tools Should Really Show

I believe every performance monitoring tool should show the IPC value next to the CPU load. This is done, for example, in the tiptop tool for Linux:

Tiptop - Tasks: 96 total, 3 displayed screen 0: default PID [ %CPU] %SYS P Mcycle Minstr IPC %MISS %BMIS %BUS COMMAND 3897 35.3 28.5 4 274.06 178.23 0.65 0.06 0.00 0.0 java 1319+ 5.5 2.6 6 87.32 125.55 1.44 0.34 0.26 0.0 nm-applet 900 0.9 0.0 6 25.91 55.55 2.14 0.12 0.21 0.0 dbus-daemo

Other reasons for the incorrect interpretation of the term “CPU load”

The processor may perform its work more slowly not only because of the loss of time waiting for data from RAM. Other factors may include:
  • CPU temperature fluctuations
  • Variation of processor frequency with Turboboost technology
  • Variation of processor frequency by the OS kernel
  • The problem of average calculations: 80% of the average load on a measurement period per minute may not be a disaster, but it can also hide jumps up to 100%
  • Spinlocks: The CPU is busy executing instructions and has a high IPC, but in reality the application is spinlocked and not doing any real work

Conclusions

CPU utilization has become a significantly misunderstood metric these days: it includes the amount of time it waits for data from RAM, which can take even longer than actual commands to execute. You can determine the actual CPU load using additional metrics such as instructions per clock (IPC). Values ​​less than 1.0 indicate that you are limited by the speed of data exchange with memory, and larger values ​​indicate that the processor is heavily loaded with a stream of instructions. Performance tools should be improved to display IPC (or something similar) directly next to CPU load, giving the user a full understanding of the situation. With all this data, developers can take some steps to optimize their code in exactly the areas where it will bring the most benefit.

A variety of troubles can occur during computer operation, but not all users know how to fix them. One of the most common problems is 100% CPU utilization, when the computer is literally loaded to capacity and stops functioning normally.

What's the problem?

Many people are looking for how to reduce CPU load when their computer starts to slow down very much, as a result of which it is impossible to open applications or use at least those that were launched previously. But at the same time, first you need to figure out what caused such a serious load and how to deal with it.

First of all, you should find out how powerful your processor is. If you bought a relatively cheap computer quite a long time ago, then it may be that it simply cannot handle some resource-intensive applications, and you shouldn’t even think long about why the CPU load is 100 percent. What to do in such a situation? All that remains is to upgrade your PC if you really need some resource-intensive applications or modern games.

But such situations are often isolated, and the main reason most often lies elsewhere.

What else could it be?

If you don't know what to do if the CPU is 100% loaded, try the following:

  1. Open Task Manager.
  2. Click the Processes tab.
  3. Filter all processes by the “CPU” parameter.
  4. See which ones are consuming the most power from your processor and, if possible, disable them.

Most often, the reason for such a heavy load is all sorts of browsers like Google Chrome, in which each individual tab is given its own process, and therefore creates a serious load on the computer. So, if you are looking for how to reduce CPU usage for running some games or programs, just close everything else before activating them.

In extremely rare cases, it happens that this or that program launches the svchost file, which often consumes the entire remainder of the processor and RAM that was available at the moment. When it appears, immediately disable this process and continue to use your PC normally.

After using the system for a long time, it begins to slow down, and various kinds of problems arise that users are not always able to solve. One of the main reasons for a slow PC is the CPU utilization at 100 percent. And it’s not always clear why this problem arises.

There are two reasons - hardware room And software. The second, of course, appears much more often, so we’ll start with it. There could be viruses, unknown processes, anything. In this article I will try to help you understand the CPU load at 100%.

If there is a suspicion that the processor is loaded at 100 percent

Go to Device Manager (keyboard shortcut Esc+Shift+Ctrl) and go to the tab "Performance". In the CPU section there is a graph that will let you know how much the processor is loaded, as well as a line "Usage". If the load is still 100 percent, then it is worth taking action.

Software type problem

When you open the task manager, you need to find the process that is using the processor. This can be done by any program installed on a PC, or by a virus. Perhaps you didn’t find anything worthwhile in the “Processes” tab, then go to the tab "Details", it shows all the running processes and try to find the one that is using the CPU the most. If you don't know what to complete, I recommend contacting an experienced specialist.


Of course, using the task manager it is not always possible to find the required process, then a third-party utility comes to the rescue Process Explorer. Run it and sort the processor by load (CPU) and see what it gives us.

Download Process Explorer: https://technet.microsoft.com/ru-ru/bb896653.aspx


Sometimes, the real culprit of the load may appear, and then you can close it without problems, but there is another situation when it is the system process that is loading the CPU. Often this can be a process of system interrupts and getting rid of this is not always easy. Of course, sometimes a simple reboot helps.

System interruptions can occur for several reasons: viruses, problems with the hard drive and drivers, problems with printers, scanners and any other devices connected to the computer.

Drivers

You can check whether the reason is really in the drivers as follows: boot into safe mode and check the CPU load, if not 100%, then the drivers are definitely playing pranks. You can try to remove the video card driver and check the load; if that fails, then you will have to remove everything altogether. Although this is a rather risky process, which ultimately still involves reinstalling the system.

Problem due to viruses

Viruses are capable of many things, and CPU usage is no exception. They can even hide under the guise of system processors, so the average user will not even understand. Try using several utilities to check your PC for viruses, I will give several links to such programs and how to use them.

Hard drive problem

In general, this doesn’t happen often, but I’ll also describe this point to be on the safe side. Hard drives have two operating modes - DMA And PIO. The first involves working directly with RAM, while the second is outdated and uses the processor during operation. Naturally, if your hard drive is running in PIO mode, then you need to switch. This article describes how to do this.

Peripheral problem

The easiest way to check if peripherals are the culprit of CPU usage is to disable everything in order. Also, go to the device manager and check if drivers are installed on all devices. If a yellow triangle or a red icon is lit there, then due to the lack of drivers, such a problem may have occurred.

You can get to the device manager like this: press the keys Win+R and enter the command there devmgmt.msc .

If you see a lack of drivers on some devices, update them directly from the device manager, or use third-party utilities.

Hardware problems with CPU utilization at 100%

Dealing with hardware problems is a little more difficult than software problems, especially for an inexperienced user. But we will try.

A common cause of load is overheat. What do you think causes it? Most likely due to a poor cooling system or dust.

First, let's check with AIDA64 or any other similar processor utility. In AIDA64, open the tab "Computer" and go to the section "Sensors".



The optimal temperature for your processor can be determined on the manufacturer's official website. On average, of course, up to 40 degrees is normal. From 50 degrees and above already puts one under suspicion, and above 70 degrees indicates some problems. Of course, for some processors even 70 degrees is the optimal temperature.

In this case, it would be wise to check the CPU cooling system first. Open the computer or laptop case and, preferably, clean all components. For cleaning, use a brush and vacuum cleaner. Cleaning often is not necessary, but at least 2 times a year is necessary. We make sure to change the thermal paste on the processor about once every 3 years.


Of course, the described methods do not fully solve the problem with the processor. Hardware problems can even include damage to the processor, which is rare, but the only recommendation in this case is to replace it. This can be problematic on a laptop, since they often cannot be replaced. In general, explore and if you have questions, ask them in the comments.

Quite often, situations occur when users, noticing that their computers are slowing down, to put it mildly, open the task manager and see an interesting picture there. The processor is 100% loaded, although no “heavy” applications are running. It is not known why the processor is fully loaded and causes the PC to slow down and freeze.

In this article we will give some practical advice on how to solve this problem.

Reasons why the processor may be 100% loaded

Now we will list the most likely reasons for the processor being almost completely loaded when there are no running programs or games at first glance.

  1. The work of background system processes to install and download operating system updates, as well as its maintenance;
  2. Viral activity;
  3. Physical obsolescence of the processor.

Now about each in more detail.

Running background system processes

The Windows 7 operating system, like any other, is updated periodically. This process in most cases occurs hidden from the user and the service is responsible for it.

svchost loads the processor

It is also possible that the OS will be periodically checked for threats using built-in security tools.

In fact, it doesn't matter which system service is loading the processor. Something else is important. That it usually lasts no more than a couple of hours. Therefore, the first thing to do when detecting increased activity and processor load is to simply leave the computer for a few hours to give it the opportunity to do all its “maintenance business.”

Viral activity and viruses - miners

The second very common reason why a computer without visible programs loads its processor 100% is unclear - it is malware. For example, the so-called virus miner is now very popular. It gets onto your computer most often when downloading and installing something from the Internet. And the essence of its work is simple - when it hits your computer, special algorithms are launched to mine bitcoins on your computer and send the results via the Internet to a specific address. In this way, attackers make money on your computer, thereby leaving you with a slow computer, since its processor is 100% loaded. At the same time, they are disguised as the names of system processes!

Therefore, if, after several hours of inactivity, your computer has not reduced the processor load, we advise you, and it is better to use several different updated antiviruses.

Obsolescence of the computer and processor in particular

There is also a situation in which the computer is simply outdated and its processor simply cannot cope with the background system tasks of maintaining and protecting the operating system. But this is only possible on really old processors 10 or more years old with 1 core.

Conclusion

As you can see, there are not many possible options. And the method to fix the problem with CPU usage at 100 percent is as follows:

  1. We check the processor to make sure it is not too old;
  2. We leave the computer turned on and connected to the Internet for several hours;
  3. We check it for viruses;
  4. You can also open the task manager, sort processes by CPU load and read about the process that uses the most CPU on the Internet;
  5. As a last resort, if all else fails, reinstall Windows and immediately .

CPU load is one of the most common and difficult problems. 100% of the processor's work is taken by unknown services and processes. This makes using the computer extremely difficult. Why is this happening? Let's try to figure it out...


Owners of personal computers, after some time after continuous use of the device, observe deterioration in performance, delayed response and other problems. The most common reasons that can lead to such problems include the complete load of the processor by unknown running processes. The easiest way in this case is to restart the computer. In some cases, this action may be effective. You can also recommend reinstalling the system, but this is a last resort method that belongs to standard recommendations.

Common Causes of Increased CPU Load

There are a lot of users who are truly concerned about this issue. They are all looking for a way to solve this problem without using radical measures. First of all, it is necessary to understand the reason that could lead to this problem. You can turn to specialized forums for help. Issues related to this computer behavior are often discussed there. There are several most common cases:

— disturbances in the functioning of the system;
— processor overheating;
- insufficient cooling.

How to identify the problem?

To determine the cause of the processor loading at 100%, you need to perform some diagnostic procedures. Once the cause has been determined, a number of steps will need to be taken to eliminate it. The following will describe in detail what needs to be done in each specific case.

How to determine the program that loads the processor?

First of all, if your computer suddenly begins to respond poorly to commands and slow down, you need to open the task manager. To perform this action, you can use the key combinations Ctrl+Alt+Del or Ctrl+Shift+Esc. You can also call the context menu in the taskbar and find the corresponding item. In the window that opens, you must select a detailed view. Tabs will appear, from which you need to select “Processes”. In this tab you need to see when the processor load is 100%.

The tab will display a complete list of all processes running in the system at a given time. They are all sorted alphabetically by default. To identify the process that might be causing the problem, you need to select the CPU Usage column. Sometimes it happens that a fairly massive program that requires significant resources is not unloaded correctly after closing. As a result, even after closing it, many processes may remain in operation, and the load on the processor will remain accordingly. To solve the problem, just click on the “End task” button.

In this case, rebooting the system may also work, as was recommended at the beginning of the article. During the reboot, all tasks are removed. In addition, this frees up additional resources that you may not notice on your own. The list of processes may contain unknowns that did not exist before. Such processes can also affect system loading. This behavior is typical of viruses. For this reason, it is good to know the names and characteristics of all the processes that run in the system. This way you can periodically check the list of running processes for suspicious activity.

System malfunctions

The previously described method does not allow us to accurately determine the reason why the processor is loaded at 100%. What to do in this case? In the task manager you can often see a situation where the entire load falls on the “System inactivity” item. In this case, you will not be able to cancel the task. It is recommended to run the utility, which is distributed free of charge by Microsoft. The Process Explorer utility allows you to get advanced information shown in the Task Manager. In this case, 100% CPU load may occur due to system interrupts. In the program they are designated as Interrupts. It is difficult to say what the reason for this behavior is unless we take decisive action.

What can load the processor?

Incorrectly described drivers often lead to this problem. To identify this problem, you need to boot the system in safe mode. If after this the processor does not experience the same load, then most likely the problem lies with the drivers. In this case, you need to look for new versions that are provided directly by the manufacturer of the laptop or computer. Viruses in the system can also cause similar problems.

In this case, you need to scan your computer using antivirus software. Also, CPU usage at 100% can occur as a result of problems with connected devices. What to do in this case? You can give one simple piece of advice: just disconnect everything from the computer, leave only the minimum set consisting of a monitor, mouse and keyboard. Take a look at Device Manager and check it for any problems. If these recommendations do not help solve the problem, you will have to reinstall the operating system. It is good if there are rollback points to restore to the moment when the system functioned normally.

Overheating and dust accumulation

Sometimes you can determine the reason why the processor is 100% loaded by the loud operation of the cooler and elevated processor temperature. These signs, as a rule, indicate that it is time to clean your laptop or computer from accumulated dust.