CPU Usage

[#hwcpused]: Finding what is using the CPU

This section is mainly about determining what is using up CPU. Additional options may be in the section about finding out what is running.

[#irpthndl]: Overview: Interrupts

It may be interesting to see which devices are triggering the most interrupts, which typically means that the device believes it needs attention (and the device's driver may need to perform some task, such as receiving/processing some available data).

Note: This might also point in a direction that does not show the true cause. For example, if a file is being downloaded then there may be a fair amount of interrupts for the network interface, simply caused by the active network activity. However, that might not be related to a more major problem which is causing more substantial slowness. So, this information may be quite misleading and unhelpful. Or, it might point to the real actual cause. So, it might (or might not) be worthwhile to check out.

Details, on getting a report of interrupts, are available at: Checking report of hardware interrupts (in BSD).


A newer guide has been made at: Slowness on Unix-based Platforms. That guide is a bit more focused on providing some strategies for reducing the CPU usage (rather than just looking to see what is causing it).

[#irptrbsd]: Checking report of hardware interrupts (in (Open)BSD)

See: handling of interrupts

In OpenBSD, viewing the “ systat vmstat ” report (as described by “ using “ systat vmstat ” (and similar actions)) can help. Then, once this view has updated the screen with a report, under the word “Interrupts”, and then under “total”, will be a list of software “devices” which have triggered an interrupt. (Perhaps “clock” always shows 100 Interrupts?) The “clock” might not be tell-tale, as that may just mean that the CPU is handling a problem that is related to another device. However, if any other device shows many interrupts, it may be good to consider whether that device's activity makes sense. The devices will likely be named after their device driver (followed by an instance number). For example, disk activity might (on some systems) identify itself as being related to a device called “ahci1”. Checking the related manual page (online at OpenBSD Manual Pages form, or by switching to another window and running “ man ahci ”, or quitting systat and running that command) may reveal what the device driver is designed for. That may help identify what type of hardware is using up the system's processor.

Reviewing running programs

The top command may have a CPU column. This column might be affected by pressing the 1 key (the number one). Pressing ? may show some quick help, which may reveal some other interesting option(s). For example, in OpenBSD, pressing S may show, rather than leave hidden, programs that are identifies as being “system processes”. (That same keystroke may have a different effect on other systems.)


The ps command may show CPU usage. Note that the exact parameters to ps may vary between different implementations of that software. In OpenBSD, ps -u (or ps -auxww for even more information) may show a column called %CPU. (For more details on using ps, see the section about “currently-running software”, sub-section about “the ps command (from Unix)”.

The output of the ps command may, naturally, become piped input for the sort command.

There may be some other information in the section about reviewing what is running.

There may be some other methods that may be more platform-specific:


In OpenBSD: Running systat pigs (or systat and then pressing the 5 key) may show the programs using the most CPU. (To quit systat if it is in interactive mode, simply press q or Ctrl-C, just like many pager commands.)

This may be one of the nicest text-mode displays, rivaling or surpassing top. Unlike top, however, this may really only show the sorted list of programs that are actively using the CPU, so other programs aren't cluttering the list.

   1 users    Load 0.40 0.28 0.22                      Thu Feb 21 09:32:22 2013

     PID USER        NAME                 CPU     20\    40\    60\    80\  100\
                     <idle>             99.56 #################################

(Hmm... where is my other .44%?)

using “ systat vmstat ” (and similar actions) shows a bunch of additional information, including a similar text-mode bar graph (except that idle activity is represented as a space, instead of being blank). The various characters in that bar graph represent different categories of CPU usage (similar to how top shows different categories). Above that bar graph, the “Proc:” section provides more details.

This main disadvantage of systat, compared to top, may just be how widespread the software is. (top may be more readily available on some different machines.)

Microsoft Windows

First, a quick note: often people may be inclined to blame svchost.exe for using up quite a bit of CPU power. That is generally not a useful conclusion, even if software seems to report that svchost.exe is using up quite a bit of CPU usage. If this issue comes up, some tips are described in a section called “svchost.exe high CPU usage”.

[#cpusgwnc]: Using information from command line programs

Sadly, there doesn't seem to be a super-easy way to get an instant report about what is really causing the largest percentage of CPU. Such data may be gathered, but it may be a bit more work than using the graphical interface. However, it can be nice to gather information rather automatically, and there are some command-line options to be able to do that. Just don't expect the process to be quite as simple as using the graphical interface.

This may not be the easiest way to instantly get information quickly, but this does provide a method that is fairly automatable and can result in useful information may be logged. That information may then be processed at a later time.

Logging the data about CPU usage may take some number of seconds. In general, adding to the workload of an already-taxed machine may sound unideal. However, if the cause of CPU usage is unknown, then adding to the machine's burden may be worthwhile if that process results in gathering information so that the problem doesn't repeat itself.

WMIC /OUTPUT:cpuuse1.txt PATH Win32_PerfFormattedData_PerfProc_Process GET CreatingProcessID,Description,HandleCount,IDProcess,Name,PageFaultsPersec,PercentPrivilegedTime,PercentProcessorTime,PercentUserTime,ThreadCount
WMIC /OUTPUT:cpuuse2.txt path Win32_PerfFormattedData_PerfProc_Process GET /ALL
WMIC /OUTPUT:cpuuse3.txt PATH Process GET Caption,CommandLine,Description,KernelModeTime,Name,OtherOperationCount,OtherTransferCount,ParentProcessId,ProcessId,ReadOperationCount,ReadTransferCount,ThreadCount,UserModeTime,WriteOperationCount,WriteTransferCount
WMIC /OUTPUT:cpuuse4.txt PATH Win32_Process GET Caption,CommandLine,Description,KernelModeTime,Name,OtherOperationCount,OtherTransferCount,ParentProcessId,ProcessId,ReadOperationCount,ReadTransferCount,WriteOperationCount,WriteTransferCount
WMIC /OUTPUT:cpuuse5.txt Process Get Caption,CommandLine,Description,KernelModeTime,ThreadCount,UserModeTime

The above is just a series of examples. All of the property names listed in cpuuse3.txt are also in cpuuse4.txt or cpuuse5.txt (or both). One difference, though, is the name of the object that is being used for cpuuse4.txt. Further details about WMIC aliases may help to verify whether these commands are really fairly identical.

cpuuse1.txt helps to identify which process or processes may be at fault. cpuuse2.txt is essentially the same type of report as cpuuse1.txt, but with even more data.

In cpuuse1.txt, look under the columns that start with the word “Percent”. (Specifically, the values are called PercentPrivilegedTime and PercentProcessorTime and PercentUserTime. Note that the numbers may not add up to 100%, nor to 100% times the number of CPU cores in the system. The useful information may not be to see the precise percentage used. However, just look to see what is using 0% of the CPU (which is what most tasks will be doing), and what is using more than 0% of the CPU. That should help narrow things down substantially, since most processes are likely going to be using up 0% of the CPU. This, at very minimum, provides a useful indication of what may be the problem.

It is expected that WMI (WMIC and WmiPrvSE#1 and/or other numbers after the “WmiPrvSE#”) may be using some processor time when this report is being gathered. This could just be the process that gathers information from the report. This can be determined with certainty by investigating the PIDs and the related command lines.

When using Win32_PerfFormattedData_PerfProc_Process (which is what was used when creating cpuuse1.txt), the “IDProcess” column shows the PID for the process being reported on, and the “CreatingProcessID” column shows the PID of the parent process. (Naturally, this information is only made available if the column(s) are visible.) When using Win32_Process or Process (which is what was used for cpuuse3.txt and cpuuse4.txt), the “ProcessId” column shows the PID of a process being reported on, and the “ParentProcessId” column shows the PID of the parent process.

Although the command line of the program isn't revealed in cpuuse1.txt, the “Name” column may provide some insight and the command line can be obtained using the PID. The cpuuse3.txt and cpuuse4.txt files will show this information.

TechNet: Managing Windows with WMI: “Collecting High CPU Utilization Events” provides some VBScript to gather some of the same type of data. Identify which process is chewing up CPU on Windows (Splunk Community) shows PowerShell output from gps and from gwmi.

Microsoft KB Q953955

PerlMonks info may show another way to get this data.

Richard T. Gregory's Windows Gems: wmic - windows management interface notes this short little example:

wmic process | sort

For more command lines, see: Verifying that the CPU is being heavily used, getting info using Microsoft Windows text mode.

[#cpusgwng]: Using a graphical interface
Task Manager

See what processes are running using Windows Task Manager's “Processes” tab, or by downloading and using Process Explorer. (See: information on Process Explorer by SysInternals.) In either case, the directions are the same.

Locate a column called “CPU”. The column will probably be visible by default. If it is not, add the column by going to the View menu, and choosing “Select Columns...”. (In Process Explorer, this option is on a tab called “Process Performance”.)

Use a pointing device to “left click” on the header that says “CPU” to sort by that column. This will probably sort in ascending order, placing all of the most heavily used programs at the bottom of the list. Since this is probably not what is wanted, “left click” again on the word “CPU” to sort in descending order.

For information about seeing the command lines of the programs that use the most CPU, the PIDs are probably not needed but the process is extremely similar to the graphical methods of seeing what command line is running.

Resource Monitor
The Resource Monitor from Windows Vista has a column called “CPU” and another column called “Average CPU”.
[#cpusvchs]: svchost.exe high CPU usage and instability

In Microsoft Windows, svchost.exe does not generally originate problems. However, some software may use svchost.exe, and then there may be problems related to svchost.exe when svchost.exe responds to requests made by other software.

Experience has demonstrated, time and time again, that when there seems to be a problem related to svchost.exe, the core problem is some other software that generates the situation which causes a problem that svchost.exe gets blamed for. Once the other software behaves, svchost.exe starts behaving, and system performance/reliability is suitably working again: svchost.exe no longer exhibits the problems that it did before. Until that other issue gets resolved, though, the problem is often being reported as if svchost.exe is the culprit.

The best/correct solution to such a problem is to find out what is really causing the start of whatever issues are happening. Some details about handling this are available in a special section dedicated to troubleshooting svchost.exe.

Verifying that the CPU is being heavily used

This can probably just be done by seeing what is using the CPU. However, there may also be some other ways to just verify high CPU usage. These methods may be quicker, or simpler, than first identifying how much CPU is used by each program and then adding all those percentages.

[#cpusgvwn]: Microsoft Windows
[#cpusgvwt]: Text mode

Using the following examples, cpuuse2.txt and cpuuse3.txt will largely confirm there is a problem of high CPU usage.

WMIC /OUTPUT:cpuuse7.txt CPU GET DeviceID,LoadPercentage /FORMAT:Value
WMIC /OUTPUT:cpuuse6.txt PATH Win32_PerfFormattedData_PerfOS_Processor GET DPCsQueuedPersec,InterruptsPersec,Name,PercentC1Time,PercentC2Time,PercentC3Time,PercentDPCTime,PercentIdleTime,PercentInterruptTime,PercentPrivilegedTime,PercentProcessorTime,PercentUserTime

(An older example used “PATH Win32_Processor” intead of “CPU”, but now this shorter method has been found.)

The first command will output using a Value format. For more details on controlling the output format, see: WMI. For more details about using WMI to get information about CPU, see the section about CPU usage from Windows Command Line.

[#cpusgvwg]: Graphical

The status bar will show “CPU Usage”. Also, the “Performance” tab will show a “CPU Usage” bar graph on the left. Next to that is a “CPU Usage History” box for each detected CPU core. The CPU Usage History boxes will show a line graph.

Resource Monitor

Windows Vista introduced a program called “Resource Monitor”. Task Manager's Performance tab has a button that will launch the “Resource Monitor” program. It may run “"C:\Windows\System32\perfmon.exe" /res”. Also, the top row in the tree in the left frame of the “Reliability and Performance Monitor” program, the icon named “Reliability and Performance”, is selectable. If selected, it runs a copy of the Resource Monitor. To run this “Reliability and Performance Monitor” program, find the icon in (Control Panel's) Administrative Tools. That icon is designed to run everything shown after the word “start” in the following command line:

start %SystemRoot%\system32\perfmon.msc /s

To view the Performance Monitor in Windows Vista, run the “Reliability and Performance Monitor” program. When viewing the Properties, the “Data” tab will show the currently active counters (in the “Counters:” section). (It is believed that by default) the currently active counter list may consist of just one counter: “\Process(_Total)\% Processor Time”.

Process Explorer by Sysinternals

(See: information on Process Explorer.)

By default, the CPU usage is in the Task bar at the bottom (in the lower-left corner). This may be configurable by using View, “Select Columns...”, and checking out the “Status Bar” tab.

Discussion of load

The most famous indicator, although perhaps not the best, may be the “load”, which is reported by various programs including top, w, uptime, and possibly additional commands as well.

There may be some misinformation about this value. One theory is that a load of one means that a CPU is being used 100% of the time, and a higher load indicates that software is waiting to use the CPU. That theory, though, may not fully match reality.

OpenBSD Journal @ Undeadly.org article called “BSD load demystified” says, amongst other relevant comments, “load is the black magic that keeps the scheduling fair compared to the number of processes.” By “black magic”, what is meant is that the precise nature of how load is calculated may not be super easy to know or comprehend. In some cases it may be easy to comprehend, but the precise details may vary based on implementation. This does not necessarily correspond to system responsiveness. For instance, one of the comments in the “BSD load demystified” article discusses Linux: quoted in its entirety, the comment (posted by “Krunch”) stated, “For the record, on Linux the load average is based on the number of tasks (or threads, Linux has a 1-1 thread model) in D (uninterruptible sleep) or R (running or runnable) state. When you see a very large load average while the system is still responsive, it often means processes get stuck waiting for I/O because of broken driver.”

A newer guide has been made at: Slowness on Unix-based Platforms.

Verifying actual CPU usage in Unix

One option may be to determine what is using up the CPU. However, there may be a faster/simpler way to just determine whether or not the CPU usage is actually high.

Rather well-known is the top command, which likely/does (at least by default) sort processes by CPU usage. Less well-known is that pressing some keys may affect the display. Pressing 1 may cause the line for CPU usage to be displayed in a different fashion, possibly even by taking multiple lines and moving other text down. In a multi-core CPU, this may show information about each of the virtual/software CPUs.

Using vmstat

Have the vmstat report on CPU usage, using details which may be implementation specific (and so are discussed after this more generalized section).

After running the command, look under the column header called “cpu”. The sub-column called “id” shows idle time: anything less than 100 indicates CPU usage. Note that this isn't showing much detail about what is using the CPU. Based on what other columns are available, some details may be known like whether the process is considered to be a “user” process or a “system” process.

Checking CPU in vmstat in OpenBSD

The command “iostat -C -w 1” may show CPU usage, similar to vmstat. However, although it is included with OpenBSD, it may be less likely to be found on other platforms. (vmstat was found on a Debian system that did not have iostat.)

vmstat -w 1 -c 11 1

The command line parameters in the above example were partially taken by Bob Beck's advice from OpenBSD Journal @ Undeadly.org article called “BSD load demystified”, and partially taken from a desire to have the -c and -w parameters multiply to at least a multiple of 5 as noted by OpenBSD Manual Page for vmstat: “Examples” section.

(Note: In OpenBSD, the vmstat command is an actual command, in addition to being the name of one of the views for the systat.)

Using vmstat in Debian
vmstat 1 11

Debian's vmstat may provide more subcolumns underneath the “cpu” column (compared to vmstat's output from earlier versions and/or other platforms). (Additions were made with Linux version 2.5.41 and version 2.6.11). The man page describes the additional columns.

systat vmstat

using “ systat vmstat ” (and similar actions). Based on reading OpenBSD's web page for systat (where the manual says “Below the memory display”), it appears that having anything in the “w” column may be an indication that a program is being delayed.

See also: the section on verifying prior usage.

[#ctlcpuse]: Controlling CPU usage
Fixing issues with high CPU usage

The first step is generally to identify what software is using high CPU usage. If there are many programs, perhaps some of those programs could use other CPUs (possibly by being run on different computers). If one or two programs are using high CPU, try identifying whether they are functioning properly.

If a program is using up a lot of CPU, there may not be a simple universal approach. There may be multiple options/approaches that may sensibly help with (and possibly even completely resolve) a problem of a program's CPU usage being too high.

Here may be some approaches that may help:

Affecting already-running software

A challenge, of course, is that heavy CPU usage may be causing the system to be at least somewhat unresponsive, which makes interacting with the system (to make changes, to fix the problem). Good luck.

[#pidprio]: Adjusting priority

This may work with cooperative software. As another similar/related approach, there may be additional commands/approaches for setting CPU affinity, and those approaches may also help.


For already-running programs, the renice command may be used. (This is likely typically pronounced as re-nice, as this is similar to the separate command called nice that is used for starting software. These commands are pretty widely implemented.


Perhaps less commonly available, a command called chrt may change “real-time” scheduling attributes for a running process.


Perhaps less commonly available, a command called ionice may change how much priority a certain program may have to certain I/O resources (perhaps most notably, access to working with data on a disk). It is possible (this would be a type of detail that may be especially likely to vary between different operating systems) that a program's priority to such resources may often be affected by the program's overall priority, so while using ionice may have an effect, but there may be little difference to the effect of just having the program affected by the nice command (or the renice).

Microsoft Windows

MSDN: SetPriority method of the Win32_Process class lists several priority values.

32 is normal, according to MSDN: SetPriority method. Instead of specifying a number, one of the priority names may be used: Idle=64, BelowNormal=16384, Normal = 32, AboveNormal = 32768, HighPriority = 128, RealTime = 256. (Yes, it does seem odd that “BelowNormal” is 512 times larger than “Normal”. AboveNormal is also way high, and Idle is also seemingly out of place.

Trac Tor Project: “Windows Service Process Thread Priority Affinity and documentation for Jeff Gilchrist's SetPriority command also mentions a value called “Lowest”. Sysinternals Process Explorer (Process, Set Priority) mentions Background, which seems to have the same priority value as Idle (but also adjusts Thread I/O Prioroity).


In Windows Vista or higher, this can be done with WMI.

Using WMIC
WMIC PROCESS WHERE NAME="Filename.exe CALL SetPriority 32
WMIC PROCESS WHERE NAME="AProgram.exe CALL SetPriority idle

More details about using this WMIC software is described at the section for WMI.

Using VBScript

Sample VBScript.

Task Manager

Tested in Windows Vista: Go to the Processes tab. Access the context/shortcut/“right click” menu of a program (by right-clicking on a line related to the program). There is a “Set Priority” option.

Using downloaded software
http://www.ltr-data.se/opencode.html/ appears to have setprio.zip and source.7z ; the web page notes this works in Win95 but not Win3x. This is a command line option. (Warning: This software hasn't been tested by the author of this text, at the time of this writing. As a standard disclaimer, please determine any sort of security/stability impacts before using it.)
[#cpuafnty] Setting the Affinity of CPU Cores (“CPU Affinity”)

CPU Affinity may be set for running software, and/or newly started software. This really only affects systems that use multiple CPU cores (including multiple CPUs, as well as a dual-core or other multi-core system). For the purposes of this discussion, the term “CPU” shall really mean “CPU core”.

This may not have any real impact on a computer with just one CPU core. On a system with multiple CPUs and/or CPU cores (such as a system using one dual-core CPU), this can specify that a program should not use one or more of the CPU cores. So, on a computer with a single dual-core CPU, this can keep a program at 50% or less, which may be sufficient to allow the other CPU usage to be split among other software as normal. On a quad-core system, this could limit a piece of software to 25% or 50% or 75%, as specified.

The impact of using CPU affinity may be a bit limited, such as preventing a program from using half of the potentially available CPU power in a dual-core system, whereas other methods might provide more finely tuned control. However, on the plus side, this may be quick and effective.

As a generalization, setting CPU affinity may be a bit more immediatley impactful than changing the priority settings for a process, though less finely tuned. (It wouldn't be surprising if some software that can affect priority might also be able to set affinity.)

Wikipedia's article on “Processor affinity” notes, “Processor affinity can effectively reduce cache problems but it does not curb the persistent load-balancing problem.” So, this may not be the best way in all circumstances.

“Operating System”-wide approaches

The following may work for any program in the operating system. Note that more specific approaches may, in some cases, work better for specific software (as mentioned by the SQL example below.)


It seems there is no single universal way to do this. Perhaps run “apropos affinity”. Wikipedia's article on “Processor affinity” references a manual page for taskset for Linux, a cpuset for FreeBSD, a psrset utility for NetBSD, and dplace command for SGI systems.

Microsoft Windows

Wikipedia's article on “Affinity mask” notes that Microsoft Windows has “several system processes (especially on domain controllers) that are restricted to the first CPU / Core. So, excluding the first CPU might lead to better application performance.”

Windows Vista/newer
Using built-in software

This is a rather manual method, but benefits from being able to use software built into the operating system.

Run the Task Scheduler. In the “Processes” tab, sort by CPU if needed (twice, so that the processes using CPU the heaviest are listed at the top), and then right-click on the running software. The context/shortcut/“right click” menu should have an option called “Set Affinity...”

Windows Vista/older
[#cpublbre]: BRELS CPU Balancer

This GPL'ed software tries to re-balance what is being used on a CPU. The instructions note, “Warning: this utility is unnecessary under Windows 7, since the scheduler already balances the tasks optimally and using the utility may affect its behavior.” However, this may be useful for older operating systems. The instructions recommend creating a scheduled task.

May not work with certain “protected” tasks, such as anti-virus software.

BRELS CPU Balancer v0.01 is provided using a variety of compression formats, which seems unnecessary since the largest is a measily 4,141 bytes.

It seems that BRELS may be meant as an abbreviation for Breno de Lima Sarmento, hence the domain name.

Specific to applications

Application-specific options may be more finely specialized than options from the operating system, so these approaches may be more effective in providing superior performance. Using both application-specific approaches and more generalized approaches may not provide the best results. As an example of documentation of this, MSDN: SQL Server 2008 R2 documentation: “affinity mask” Option notes, “Do not configure CPU affinity in the Windows operating system and also configure the affinity mask in SQL Server. These settings are attempting to achieve the same result, and if the configurations are inconsistent, you may have unpredictable results.”


The following might be specific to Microsoft SQL Server.

MSDN: Best Practices for Running SQL Server on Computers That Have More Than 64 CPUs says “Do not use the affinity mask and affinity64 mask server configuration options to bind processors to specific threads. These options are limited to 64 CPUs. Use ALTER SERVER CONFIGURATION SET PROCESS AFFINITY (Transact-SQL) instead.” MSDN: SQL Server 2008 R2 documentation: “ALTER SERVER CONFIGURATION (Transact-SQL)” may have more information about how to implement that.

MSDN: SQL Server 2008 R2 documentation: “affinity mask” Option notes, “Affinity support for servers with 33 to 64 processors is only available on 64-bit operating systems.”

Of course, most beginners aren't starting out by working on systems with more than 32 CPUs...

MSDN: SQL Server 2008 R2 Documentation: “affinity mask” Option notes that, “When you are using SQL Server Express, changing the affinity mask option does require a restart.” This reboot requirement may not exist in other (less free) versions of the SQL software.

MSDN: SQL Server 2008 R2 Documentation: “affinity64 mask” Option says, “This feature will be removed in the next version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use ALTER SERVER CONFIGURATION SET PROCESS AFFINITY (Transact-SQL) instead.”

TechNet: Correct Affinity Mask and Affinity I/O Mask Overlap (SQL Server 2008) documentation indicates that the same CPU should not be specified (with a bit set to 1) by both the affinity mask and the affinity I/O mask. MSDN: SQL Server 2008 R2 documentation: “affinity mask” Option indicates that a mask uses binary.

More details may be found in documentation such as: MSDN: SQL Server 2008 R2 documentation: How to configure the affinity mask using SQL Server Management Studio, MSDN: SQL Server 2008 R2 documentation: “affinity I/O mask” option.

Setting other priority values

Note that these might be getting slightly off the primary topic of CPU usage, although these adjustments may also impact how much CPU time is being used.

Input/Output Priority for a Thread (in Microsoft Windows)

This is a value that Microsoft Windows Vista introduced to the Microsoft Windows operating systems. This may be adjusted by several tools:

For programmners, some information has been discussed by: StackOverflow: Increasing I/O priority.

Network traffic

e.g.: rate limiting, QoS

Possibly helpful: see what is using TCP, network sniffing, bandwidth testing

Suspending software

If one piece of software is causing troubles, and if that software doesn't need to be actively running, suspending the software (temporarily) might be a good idea.


Try pressing Ctrl-Z. If that worked to suspend the program, then see interacting with background tasks in Unix (using jobs and related commands).

Microsoft Windows

Process Hacker has an ability to perform “Suspend” and “Resume”. Just access the process's context/shortcut/“right click” menu (by highlighting the process and pressing Shift-F10, or right-clicking on it).

Sysinternals Process Explorer has a “Suspend” option on the Process menu. If a process is suspended, that menu option turns into a “Resume” option.f

Closing software

Of course, although closing software can reduce CPU usage, there may also be some other side effects caused by having the software be closed. For details, see the section on adjusting running software.

Adjust settings in a program
Some software may have some sort of built-in options to help determine how much it uses the CPU. If so, these settings are often designed by someone with specific knowledge of how the software operates, and so those settings may be the best way to influence how much CPU is getting used.
Starting a program with CPU usage limits

It is possible that multiple of the below techniques may be simultaneously used.

One method, of course, may be to start software and then, fairly quickly after the software is started, to modify the CPU usage of already-running software. However, there may be other options to specify the desired limits that should take effect as soon as the program starts. Those options may begin affecting a program earlier in the process of starting up, and may be easier to automate (than a method that requires automatically identifying a program that is already started).

Setting the priority class

The nice command is meant to start a program with a specific amount of priority.

Microsoft Windows
Starting a new program with a specified priority

The START command may have parameters to set which priority class a program is started in. For instance, there may be a parameter called /LOW (which Vista's Start/? says will “Start application in the IDLE priority class”). Another similar parameter may include /BELOWNORMAL.

Note to JP Software users: JP Software may come with its own Start command. (If the JP Software product doesn't compatably support the same parameters, use CMD.EXE as needed.)

Setting CPU “affinity”

More information about this may be in the section about CPU affinity.

Microsoft Windows
Windows Vista and newer

When using CMD.EXE command, an internal command called Start may have support for a /Affinity switch. (Although at least some earlier versions of Windows may have supported such a Start command, Windows XP documentation of the Start command doesn't mention any sort of support for the /Affinity switch.

In Windows 7, “ Start/? ” shows that the /Affinity switch may be affected by /NODE (which affects support for “Non-uniform Memory Access” (“NUMA”)). The following is a guide for more basic usage.

The syntax is to use something like the following:

Start /Affinity 2 "Notepad.exe" filename.txt

The above quotation marks are optional if the command doesn't include a space in the specified (relative) path.

So, the big question at this point is what number to specify. MSDN: SQL Server 2008 R2 documentation: “affinity mask” Option shows this is a bitmask, and shows some example binary values. So a number like 2 would represent a binary value of 10.

How-To Geek's “Start an Application Assigned to a Specific CPU in Windows Vista” guide indicates the affinity to specify “The affinity is essentially CPU core # + 1, so /affinity 5 would use CPU 4.” It seems likely this is wrong, and that a bitmask is used. (However, by coincidence, this advice would be right for the first two CPUs: CPU 0 would be specified with binary 1 which is what a command line parameter of 1 would use, and CPU 1 would be specified with a binary value of 10 which is what a command line parameteter of 2 would use.

Older versions of Microsoft Windows

Download SysInternal's PsExec command. As an example, use PsExec -a 1,4 to use the cores commonly called “CPU 1” and “CPU 4”.

Misc info

Below is some information about third party software that can help. First, here is some more information that may be useful.

CPU limiting in Microsoft Windows

TechNet: CPU rate limits in Windows Server 2008 R2 and Windows 7 seems to have a way to limit usage based on a user. (To use a more term more specific to what this approach actually does, the limit is based on a “SID”.) The method seems to involve changing registry settings. A comment on the page notes, “i have this code working successfully against server 2008 R2, but it seems to have no effect in Server 2012”

Third party software to limit CPU usage

Third party software may help a multitasking operating system to help force certain software to not use more CPU than necessary.

Note: This information is provided for reference. None of these pieces of software are necessarily intended to be a strongly recommended solution. (Research and test as appropriate before deploying on any important computer.)

CPU Usage Limiter for Linux
Microsoft Windows

Note: At the time of this writing, this software may not have been heavily used/tested by the author of this text. This is simply being provided for reference. (Investigate possible risk, including not only affecting security but also stability, before deploying to production systems.)


In November of 2014, a few of these were tried out. This review should be considered to be honest, but not based on extensive research or tests. This review may be affected by certain biases that favor less restrictive software licensing.

An anti-virus scan was capable of using notable CPU time, and so was started to try to verify the effect of various software-based possible solutions.

Battle Encdoder Shirase

Worked well, sometimes. Reported when it didn't. License offers some flexibility (like being able to improve upon the software) more than some other alternatives.

“Battle Encoder Shirase” was found to seem to be capable... mostly. One time, it seemed to have no effect when it should. To the program's credit, the GUI did show “Initial OpenThread failed”, which is mentioned in the documentation. This could easily have been a problem that BES simply didn't have the necessary permissions to alter the anti-virus software which was utilizing the CPU, and there's some reason to appreciate the idea of anti-virus software being rather resistant to having its behavior be modified by other programs. BES didn't seem to understand attempts to have the command line specify multiple targets, but this could be done in the GUI and BES uses a GPL licensing, indicating that there may be some flexibility permitting a programmer to make changes. (Changing functionality to support parsing a command line is likely to be a rather simple change to try implementing.)

Process Tamer

May have worked better than other tested items. Licensing may be acceptable to some, but more restrictive than what others find acceptable.

Then, “Process Tamer” seemed to be the most promising solution. It seemed to work. It also has a license that lets a person use the software without requiring payment, in at least some circumstances. The most dissatisfying thing about this software is that the developers do seek payment and expect users to either pay up or deal with some (short term) inconvenience, neither of which are necessarily pleasant solutions in some circumstances. However, if their solution does technically work better than others, then this idea may appear to be fairly good, despite such drawbacks.

One item to note is that “Process Tamer” was tested after “Thread Master”; it is not believed that the “Thread Master” testing had lingering effect, but that may be an incorrect belief.


Were also tested

It appears that “Process Lasso” may be another option that can produce results, but that solution looked less free and so it was explored even less than some of the other options. If someone finds that “Process Tamer” isn't desirable (perhaps because it isn't producing the desired results), and especially if spending the requested bit of money is a non-issue, then ”Process Lasso” might be an option worth considering.

“Thread Master” didn't seem to have any clearly noticeable effect; tinkering with the configuration by editing registry values might have produced some different results. It is also possible that this software is just designed for older operating systems; testing was done on Windows 7. (So the software may have been useful for the systems that the software was designed/intended for.)

“Intel Speedstep” seems to be an old solution that was only meant for some hardware. “SpeedswitchXP” is believed to be a slightly newer software that takes the same approach and works on a bit more hardware. Both of those solutions might be rather outdated, and more focused on handling CPUs that have speed configuration options (which may be popular on laptops, as people choose to slow down the CPU temporarily when doing so is likely to reduce consumption of limited available electrical power).

Some programs were not included in the test, likely just due to unfamiliarity with the program (not even realizing the program was an available option) in the test. Here is a list of such programs:

Process Governor
MIT licensed. Announcement about releasing wtrace 1.0 and procgov 2.0 indicates that Process Governor's ability to limit a program to a certain CPU affinity is a feature new to version 2.0 of the program. Although this approach may be limit the amount of impact to correspond to how many CPU cores are available to work with, this approach can be notably effective in providing system responsiveness. Furthermore, the program's ability to work from the command line, and affect existing applications, looks quite promising.
Windows System Resource Manager

Benefit: included in the operating system, so this is likely easy to acquire, and hopefully trustworthy (assuming you trust the company that created the operating system).

Drawback: Only included in some Microsoft Windows operating systems, and not others.

Sly Mat's answer to screampuff's question about limiting memory usage refers to Windows System Resource Manager, a feature that is installable in Windows Server 2008 R2. The same software is not an installable feature in Windows 7, 8, or 10. (The web page indicates this is for memory usage, but perhaps that also supports CPU usage?)

With that review over, following is some further information about solutions.

Battle Encoder Shirase

For Windows 2000 and XP (and possibly Windows ME)...

With a name reminiscent of the “Battle Programmer Shirase” anime (which itself has a name somehow reminiscent of the video game series “Battle Arena Toshinden”), Battle Encoder Shirase may be an option.

This software involves specifying filenames. (So there is no simple option to say that all software, currently running as well as software that starts running in the future, must be limited to using no more than 75% of the CPU.) However, for handling a specific known software program, using BES does seem to have the effect of having that software report less CPU usage.

The website has stated that version 1.6.2/1.7.0-alpha for Windows XP/2000 is available. The website also noted, “BES works on Vista/Win7/etc. too, but if necessary, run it in the XP compatible mode. Maybe you should run it with the admin privileges (right click > "Run as Administrator").” Also, gamers may wish to be aware that of a “[Control]” called “Sleep/Awake Cycle”, trying a value like 40 rather than the default of 100.

BES seemed to get some positive feedback in a review at SuperUser about CPU limiting.

It seems that version 1.7.0-alpha introduced a more feature-filled GUI, and released the same day as version 1.6.2, so it likely has the stability bug fixes that 1.6.2 has.

Note that the percentages refer to how much the application should be slowed down by. It does not refer to a desired amount of CPU usage (speed). So, higher numbers are slower.

Although a GUI is available, it stores configuration in text files that are easy to edit. A sample command line (from 1.7.0-alpha) is:

CMD /C Start /B C:\...\BES.EXE "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" 75 --watch-multi "C:\Program Files (x86)\ClamWin\bin\clamscan.exe" 76 --watch-multi "C:\Program Files (x86)\Microsoft Security Client\MsMpEng.exe" 77 --watch-multi --allow-multi -m

The above example was meant for a 64-bit Windows system using 32-bit Firefox, Clam Sentinel (which uses ClamWin), and Microsoft Security Essentials.

The above example is subject to change; it may not have been thoroughly tested at the time of this writing.

Actually, testing indicates that BES seems to only watch one program when something like the above is run. The following pollutes the task bar with multiple icons, but does seem to have the desired effect of watching multiple programs:

CMD /C Start /B C:\...\BES.EXE "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" 75 --watch-multi --allow-multi -m
CMD /C Start /B C:\...\BES.EXE "C:\Program Files (x86)\ClamWin\bin\clamscan.exe" 76 --watch-multi --watch-multi --allow-multi -m
CMD /C Start /B C:\...\BES.EXE "C:\Program Files (x86)\Microsoft Security Client\MsMpEng.exe" 77 --watch-multi --allow-multi -m

Combining that effectiveness in one icon seems doable with the GUI. At the time of this writing, no easy command line solution (to have it all working with just one icon) has been identified by the author of this text. Using a tool to manipulate tray icons may be preferable.

The program minimzes to the tray. Selecting minimize will make the running instance's icon disappear from the task bar.

If a program is identified, then when it is running, BES's “Target...” window will identify the program as a “Foe”. (This may be represented by a lavendar background. This is in the “IFF” (“Is Friend/Foe”?) column. The .ini file will list the program as an “Enemy”. Presumably these terms are keeping in spirit with the “Battle” theme that the program is named after.) Actually, foe status has no effect on program limiting, but just what order the program shows up in the list of running tasks. If a program is actually being controlled/limited, the name will have a red background behind the filename on BES's “Target...” screen. This doesn't mean that the program is being slowed down, but just that the program is being watched, and will be slowed down if needed.

The bes.ini file tends to show just filenames, not entire paths. However, the command line help does indicate that a full path may be specified. (This seems to leave some unclarity regarding whether the program actually uses full path names, or just relies on an executable's filename.)

BES seemed to get some positive feedback in a review at SuperUser about CPU limiting.

Process Tamer

Process Tamer is software designed to be sold, although there is a version that is freely available for individuals (and companies with less than five employees, based on the rules seen at the time of this writing). It does seem like quite a few people are happy with this software. The free version does requries a free license key, and perhaps (???) a site registration to download.

For those willing to go through those steps, the software may work well. LifeHacker review shows a number of people leaving positive comments.

Version 2 added a GUI for being able to define rules that apply limits to only specified software. To do this, open Process Tamer's Configuration GUI (by right-clicking on the icon in the “system tray”/“message notification area”, and then choosing “Cconfigure...”), and then choose the “Configuration” tab. The lower part of the window shows the list of configured rules, right below the “Applicaiton Name” and “Explicit Rule” fields. Right click on the area of those rules (which will initially just be a large blank (white) area), and then a rule can be added to add a rule like “Force Low”. The menu options for the priority levels are shown in an order that seems to follow no pattern: Ignore, Low, High, Normal, Below Normal, Above Normal, Realtime, or Kill (with all of those options preceeded by the word “Force”, except for Ignore). Checking out Windows Task Manager (in Windows 7), the options for setting priority show an order of Realtime, High, Above Normal, Normal, Below Normal, and Low.

Using one of those explicit rules might still result in a program showing a high CPU usage number (in Windows Task Manager or in the “Process Tamer” Configuration GUI's “Processes” tab), but that might end up being okay. If the end result is that the lower priority setting is causing the system to be more responsive overall, then the probably goal that is really desired is being achieved.

By default, Process Tamer will only report on changes to background applications. Foreground applications will not be reported unless the Configuration screen has the “Show Balloon Messages on Foreground Ops” screen checked. If someone wishes to have less messages, then the “Show System Tray Balloon Messages” section of the “Configuration” tab has checkboxes that can be used to turn off messages.

Thread Master

Thread Master

The web site says it is “for Windows 2000 and Windows Server 2003” although elsewhere documentation seems to lean more towards discussing Win2K. The web page describes the software as follows “ThreadMaster is a background service that improves the thread scheduling algorithms of the Microsoft Windows 2000 Operating Systems.”

For Win2k and Win 2003. Freeware. Source code available for 2000 Euros. (This despite the page saying “The core functionality is extremely simple,  any skilled programmer can do the same on a week-end and a couple of nights.”)

This software does not seem to be updated frequently. It has been at version Ver. 1.12 Build 182 for years. The lower-left corner says “Update: 2003-03-18” when it was checked on Christmas of 2011.

As pure speculation, based on the date, that probably means that this doesn't have any sort of specific support for 64-bit Microsoft Windows.

Process Lasso
Process Lasso (by Bitsum, a company self-identified as “Optimization Experts“) has been recognized as being for Win2K, XP and newer. There is a downloadable version which does behave differently than the pro version. Differences are mentioned by Bitsum discussion of freely obtainable software.
SpeedswitchXP and Intel Speedstep

A web page for a similar program called SpeedswitchXP mentions Intel's software: “On Windows 2000 and previous operating systems, it was possible to manually control the CPU frequencies with a SpeedStep applet provided by Intel, but this is not possible anymore under Windows XP.” “ SpeedswitchXP noted similarities with “the native Intel SpeedStep applet for Windows 9x/ME and Windows 2000”.

The topic of handling CPU idleness (such as intentionally causing a certain amount of idle time on the CPU) may be related to the approach of this software (which is to affect how fast a CPU runs.

Info for coders
Some available code

TechNet's syntax for a SetThreadAffinityMask function shows syntax, Wikipedia's article called “Affinity mask” shows (syntax for using) code, and BRELS CPU Balancer is open source.

Debugging the issue of high CPU usage

This may vary based on factors like what operating system is used, and perhaps that software is using high CPU usage. Here are some more specific details which may help in some specific scenarios:

Microsoft Windows

e.g. Microsoft KB 919791: How to use the Debug Diagnostics Tool to troubleshoot high CPU usage by a process in IIS (previously at http://support.microsoft.com/support/kb/articles/Q919/7/91.ASP ) involves Debug Diagnostic Tool (currently Download Details: Debug Diagnostic Tool v1.2, and previously version 1.1 at http://www.microsoft.com/downloadS/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&displaylang=en ). The process also involves gathering information, and debugging. (At least some steps of this process may be meant for software debuggers/developers.)

[#maxcpu]: Maximizing CPU usage

To try to increase priority for a single program, check out the section discussing how to lower CPU usage for a program. Many programs that provide a solution for lowering CPU usage may also have some options to help a program get more available CPU time (at the possible expense of CPU being less available for other programs.)

Sometimes people may want to max tax a CPU, using up as many CPU cycles as possible, hoping that maxing out the CPU may perform some task like causing noticeable problems with the CPU (which may be good to find out when testing hardware), or generating lots of internal heat (to try to verify that temperature sensors operate as desired). Any one of the following techniques may be sufficient: using the same technique multiple times (in a multitasking environment) and/or using multiple techniques may contribute to heavy CPU usage.

Performing specific CPU-heavy tasks

Heavy inquiries can put a load onto CPU usage.

WMI (in Windows)

In one test, running: “ wmic FSDIR get /ALL ” was rather sufficient to use up a fairly large amount of available processor time.

Distributed computing projects
e.g. Distributed.net, Free Mersenne Prime Search
Data compression

Compressing data can use high CPU usage. (See: TOOGAM's tutorial on data compression.) Using 7-Zip to compress modern versions of Microsoft Windows will take a bit of CPU time as all the files are located, and then heavily use the CPU once the actual compression algoritms start to get applied.


Some games may use heavy CPU usage. (However, some games may heavily use other processing resources, such as GPU and PPU power. Some games might feel bottlenecked at the GPU or PPU layers, or have some sort of other synchronization that causes the CPU to not be maxed out. Playing games may be one of the most fun, but often not the most effective, ways to try to heavily use a CPU.

System testers
Some software is designed to test hardware, and some software is even designed to test multiple types of hardware at once. This software may often include a method of having many CPU instructions being executed. Details about such software may be covered in the section about hardware testing.
Specialized applications
Microsoft Windows

See CPU Burnin for one option.

Shortly after the release of Windows 95, a program called Prime95 was made.

Software in the following section may provide this sort of service.
Stressful Application Test
Stressful Application Test
[#cpubrnin]: CPU Burnin
http://cpuburnin.com This might also be discussed at: hardware testing.
CPU Burn

CPU Burn - P6 version by Robert Redelmeier (redelm@ev1.net) referenced by http://www.cpuburnin.com/

This might also be discussed at: hardware testing.

Other number crunching
y-cruncher, for both Linux and Windows (2000 or XP or later). The web page has a FAQ section that says, “Is y-cruncher open-sourced?” The simple answer provided was “No.”
[#idlecpu]: Handling CPU idleness

When a CPU is idle, there are ways to respond. For a physical CPU, an advantage includes causing the CPU to use less power (even if it causes some slowdown). This may be particularly useful when power is more limited, such as when a CPU is running off of a battery (whether this is a laptop or whether the system is plugged into a battery-backup system (UPS) that is actually running off of battery power). Slowing down a processor may also increase its longevity. For virtual machines, detection of CPU idleness can cause the virtual machine to need less CPU cycles provided by the host machine.

CPU driver

QEmu documentation: Target OS specific information (section 3.13)'s subsection (3.13.2) on Windows: subsection ( on “CPU usage reducation” notes, “Windows 9x does not correctly use the CPU HLT instruction. The result is that it takes host CPU cycles even when idle. You can install the utility from http://www.user.cityline.ru/~maxamn/amnhltm.zip to solve this problem. Note that no such tool is needed for NT, 2000 or XP.”

Altering power settings
(Note: This section was based on some old notes. (It may not be very cleaned-up at the time of this writing.) However, this section is still being provided as a possibly useful resource, in case this possibly unpolished section is still of use to somebody anyway.
[#apmcpusp]: Using Advanced Power Management (“APM”) to adjust CPU speed

FreeBSD Handbook: Shortcomings of Advanced Power Management (APM) describes issues of the older APM standard. Namely, implementations were quite vendor-specific technologies, and with the technologies being handled by the BIOS rather than relying heavily on the software (such as the operating system), software fixes were not as easy or possible to implement and power-saving events (including those that may reduce speed or even functionality) could occur without the system's software being ready for such events occuring. (The term “software” is definitely meant to include any operating systems that the system may be running.)

(APM does also handle more than just CPU idleness, such as setting power-saving states (related to hibernate/suspend).

APM tutorial likely meant for use with OpenBSD. Basically it involves running apmd (which can be done with no command line parameters that are shown in the OpenBSD man page for apmd, although some may cause additional logging to occur), and then with that daemon running, either run “ apm ” by itself if there is a desire to get a report of the current status, or change how apm is running by using command line parameters such as “ apm -C ” to allow dynamic changes with “performance adjustment mode”, or “ apm -H ” for higher speed/performance (and power consumption), or “ apm -L ” for lower power consumption (and speed/performance).

Win98SE install options for APM and/or ACPI?

“Advanced Configuration and Power Interface” (“ACPI”)

Supporting ACPI may involve interpreting “ACPI machine language” code, more commonly abbreviated as “AML” code.

On OpenBSD/i386, APM has precedence over ACPI. (It would seem that at least some prominent OpenBSD developers do not care much for ACPI, based on Song called “Games” released along with OpenBSD 4.5. There is little information provided on why ACPI isn't liked (as this was the first song released where commentary wasn't written), but from the lyrics one may assume it has to do with “A.M.L. games”, and corporate control by Intel and Microsoft. AML refers to “ACPI Machien Language” (reference minimally discussing OpenBSD and AML).

Win98SE install options for APM and/or ACPI?

http://acpi.info/ , http://www.coreboot.org/SeaBIOS#Windows notes “many coreboot boards do not have a complete ACPI definition.” , http://www.coreboot.org/ACPI_in_coreboot

For further details on these power-related standards, see: electric power interfaces.

Controlling CPU speed
[#mkcpuslo]: Underclocking

To underclock, see handling CPU idleness and/or power-related info (like APM/ACPI/etc., which is discussed in the hardware-related section: sub-section about electrical power interfaces). If the goal is simply to cause slowdown, there may be various approaches including running software in an emulator/“virtual machine” (especially if this emulator supports a slowdown feature).

Slowdown software may be run. This might not actually cause the CPU to run slower (so it might not actually cause as much reduction in heat, since the CPU may actually be actively running code that is causing the apparent slowdown), but may make the CPU appear slower to software. Some old software that does this has been known to be limited in how much the system may slow down, although running the software multiple times (which uses up additional memory) might have an impact.

Other methods to slow down a system may include using debugging software and/or giving a multitasking computer some more work to do, including performance monitoring and logging.

[#mkcpuspd]: Overclocking

Some people may have reason to want a CPU to run slow. More common are people interested in making a CPU get calculations comipleted, and specifically people want that to be done faster.

Overclocking is a possibility, which may run some risk of the CPU being damaged (especially if overclocked too much and/or too frequently). Damage could also affect other equipment, especially the motherboard that the CPU is connected to. The damage might be caused by heat; even if heat isn't the actual cause of the damage, the likelihood of damage occurring might have some sort of corresponding/proportional/direct type of relationship to the amount of heat that exists.

(This website does not have extensive information about overclocking.)

[#cpuoldus: Verifying Prior CPU Usage

(See also: section on “Slowness on Unix-based Platforms”, sub-section on “Prior System Slowness”.


The atop command, like the htop command, has been available for multiple platforms but might commonly not be pre-installed. It can be used as an interactive command, but it is certainly also designed to be able to create log files and then review the details on those log files. On some operating systems, the standard installation process for the atop command may end up inserting a cron job that starts logging details. That may be something that is not implemented in the standard installation process for some other operating systems, even if the standard installation process for that operating system does do such things when installing some other programs. So, enabling that might or might not be something that needs to be done manually. The precise location where the logged data is also a detail that may vary a bit between different systems.)

(At the moment, this guide does not provide details on how to set up automatic logging.)

sar” (System Activity Reporter)

A command called “sar” may be built into some operationg systems. Measure system load using sar command states, in the only bold letters of the whole article, “OpenBSD does not support sar.” The program may be useful on other platforms, though, including SunOS, AIX, HP-UX, and some Linux-based systems.

This might be less portable than other options like using the atop command, but the benefit to this is that this might be commonly pre-installed and actively running on systems, so if you approach a system using certain operating systems then there may commonly be some pre-existing data that can be looked at.

Using a scheduler

Keep in mind that while using cron to implement logging details with either atop or sar may be commonplace, there's no reason why such scheduling software (either cron or at) couldn't be used to gather details from both of those programs, and/or other programs. (The main difference about those programs, atop and sar, is just that those programs may provide a rather standardized way to be looking at specific previously-recorded data from a specified time frame, whereas a custom data-recording solution might require more of a custom data-reviewing solution.

Note: for other details about CPUs, see Hardware section: sub-section about CPUs.