Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows Server 2012 / Process Priority Management in Windows

June 21, 2016 Windows Server 2012

Process Priority Management in Windows

Let’s talk about the priority of Windows processes. In most cases, there is no need to think about the custom process priority settings, but sometimes a qualified system administrator can help a system to better allocate the processor time between running tasks. When is it needed? For example on the application server, you can give more CPU time for application and SQL server, as the most resource-critical processes.

Generally, you can view and change the priority of the process using Task Manager (someprocess.exe -> Set Priority)

Windows NT/2000/7/2008

Task Manager - set process priority

In Windows Server 2012, these settings are located on Details tab.

Windows Server 2012 - six process priority

As you can see from these snapshots, only 6 priority types (as it will be explained later, these are the priority classes) are available. Is it enough? Microsoft thinks, it is. But let’s remember the epic saying by Bill Gates, who told that “640 KB of RAM will be enough for everybody”. But time has shown that it is far from the case.  : )

Now let’s see, what it actually looks like.

In fact, there are 32 priority levels in Windows, from 0 to 31.

They are grouped as follows:

  1. 31 — 16 are real time levels
  2. 15 — 1 are dynamic levels
  3. 0 is a system level reserved for the zero-page thread

When a process is created, it is assigned one of the six priority classes:

  1. Real time class (value 24),
  2. High class (value 13),
  3. Above normal class (value 10),
  4. Normal class (value 8),
  5. Below normal class (value 6),
  6. or Idle class (value 4).

As it has been mentioned above, you can view the process priority using Task Manager.

Note. Above normal and Below normal priorities first appeared in Windows 2000.

The priority of each thread (basic thread priority) is composed of the priority of its process and the relative priority of the thread itself. There are seven types of relative priorities of the threads:

  • Normal: the same as the process has
  • Above normal: +1 to the priority of the process
  • Below normal: -1 from the priority of the process
  • Highest: +2;
  • Lowest: -2;
  • Time critical: sets the current priority of a thread as 31 for the Real time class, and 15 for the rest classes
  • Idle: sets the current priority of a thread as 16 for the Real time class, and 1 for the rest classes

The following table shows process priorities, relative and current priorities of a thread.

Thread Priority Process Class Process Class
Idle class Below normal class Normal class Above normal class High class Real time class
1 Idle Idle Idle Idle Idle
2 Lowest
3 Below …
4 Idle class Normal Lowest
5 Above … Below …
6 Below normal class Highest Normal Lowest
7 Above … Below …
8 Normal class Highest Normal Lowest
9 Above … Below …
10 Above normal class Highest Normal
11 Above … Lowest
12 Highest Below …
13 High class Normal
14 Above …
15 Highest
15 Time critical Time critical Time critical Time critical Time critical
16 Idle
17
18
19
20
21
22 Lowest
23 Below …
24 Real time class Normal
25 Above …
26 Highest
27
28
29
30
31 Time critical

How to start a process with a non-standard priority or change it?

Method 1. Start a task/process and change its priority using Task Manager

Method disadvantages:

  • Only 6 types of priorities are available
  • The priorities are changes with your mouse and you cannot make it automatic.

Method 2. You can use START command with the corresponding keys

The available keys responsible for priorities are as follows (I deliberately omit the keys of the START command, which are not related to the process of setting priorities being described):

C:\>start /?
Starts a separate window to run a specified program or command.
START [“title”] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B]
[command/program] [parameters]
LOW       Start application in the IDLE priority class.
NORMAL     Start application in the NORMAL priority class.
HIGH       Start application in the HIGH priority class.
REALTIME   Start application in the REALTIME priority class.
ABOVENORMAL Start application in the ABOVENORMAL priority class.
BELOWNORMAL Start application in the BELOWNORMAL priority class.

As we can see, the START command allows to run a process with the same 6 priorities available in the Task Manager

Method disadvantage:

  • Only 6 types of priorities are available

Method 3. Using wmic.exe utility

As shown above, Task Manager and START command are quite awkward in assigning priorities. Let’s see how to do it more flexibly. We’ll use wmic.exe.

The command prompt:

wmic process where name="AppName" CALL setpriority ProcessIDLevel

Example:

wmic process where name="calc.exe" CALL setpriority 32768

or

wmic process where name="calc.exe" CALL setpriority "above normal"

Priorities (preset):

  • idle: 64
  • below normal: 16384
  • normal: 32
  • above normal: 32768
  • high priority: 128
  • real time: 256
Note. What is to be done if there are several processes with the same name? The priority of a process can be changed using both its name or the PID (Process ID).

Here is a short example of running wmic.exe to get the necessary information.

Use this command:

wmic process list brief

Note. I won’t give the example of running this command as the list of processes is too long. Do it yourself if you want to.

You’ll get the list of processes run on your local computer. Now run this command:

wmic process list brief | find "cmd.exe"

Here is the result:

wmic process list brief | find "cmd.exe"

I have deliberately started several copies of cmd.exe, to make it more demonstrative.

Now the list of processes is limited to those having “cmd.exe” in their name. Pay attention to the PID of the process(es).

Now let’s try to select the necessary processes using WMI. To do it, just enter:

wmic process where description='cmd.exe' list brief

Here is the result:

wmic process where description='cmd.exe' list brief

Compare the results. Remember the PID of CMD.EXE.

The command string to start wmic.exe

wmic process where processid='XXXX' CALL setpriority ProcessIDLevel

Now we can change the priority of a specific process (e. g., PID=8476):

wmic process where processid='8476' CALL setpriority 32768

or

wmic process where processid='8476' CALL setpriority "above normal"

What next? Think, try, select and manage your priorities to improve the performance of services and processes, together with the end user experience.

2 comments
0
Facebook Twitter Google + Pinterest
previous post
How to Install TFTP Server on Windows Server 2012 R2
next post
FTP over SSL (FTPS) on Windows Server 2012 R2

Related Reading

How to Filter Event Logs by Username in...

November 17, 2016

KB3161949 Breaks SMB over NETBIOS Access Outside the...

September 30, 2016

AutoRedial for VPN Connections in Windows 8/10/2012

May 5, 2016

2 comments

Manu July 21, 2017 - 9:47 am

Hi, thanks for this article….
but is there a solution for cmd.exe is always executed in a special priority ? for example when I execute cmd.exe I want it be in HIGH prioriy…
thanks

Reply
admin August 30, 2017 - 5:16 am

Hi
I think you can create a desktop shortcut with such a command:
cmd.exe /c start "CMD" /High "C:\Windows\System32\cmd.exe"

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • How to Run Program without Admin Privileges and Bypass UAC Prompt?

    March 24, 2023
  • Configure Network Settings on Windows with PowerShell: IP Address, DNS, Default Gateway, Static Routes

    March 24, 2023
  • Exchange Offline Address Book Not Updating in Outlook

    March 21, 2023
  • Attaching Host USB Devices to WSL or Hyper-V VM

    March 20, 2023
  • Sending an E-mail to a Microsoft Teams Channel

    March 17, 2023
  • How to Restore Deleted Users in Azure AD (Microsoft 365)?

    March 16, 2023
  • Fix: Remote Desktop Services Is Currently Busy

    March 15, 2023
  • Send-MailMessage: Sending E-mails with PowerShell

    March 14, 2023
  • Clear Cache and Temp Files in User Profiles on Windows (RDS) with PowerShell and GPO

    March 13, 2023
  • Prevent Users from Creating New Groups in Microsoft 365 (Teams/Outlook)

    March 6, 2023

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • How to Filter Event Logs by Username in Windows 2008 and higher
  • AutoRedial for VPN Connections in Windows 8/10/2012
  • KB3161949 Breaks SMB over NETBIOS Access Outside the Local Subnet
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top