Scheduling and Priorities

The Microkernel schedules ready threads for processor time based upon their dynamic priority, a number from 1 to 31 which represents the importance of the task. The highest priority thread always runs on the processor, even if this requires that a lower-priority thread be interrupted. In Windows NT, priorities are organized in a hierarchy. Each level of the priority hierarchy establishes a range within which the lower level priorities can vary:

Tip

You can change the base priority class of a process while it is running by using Task Manager and other tools. These changes are effective only as long as the process runs. When it is restarted, it reverts to its original base priority class. You can also adjust the amount by which the base priority foreground processes (those the user is interacting with) is boosted by using the Control Panel systems applet Performance tab. (Right-click My Computer, select Properties, then select the Performance tab.) For more information, see "Measuring and Tuning Priority" in Chapter 13, "Detecting Processor Bottlenecks."

Most applications started by users run at Normal priority. Table 5.1 lists the Windows NT thread priority classes and priorities. The higher the base number, the higher the priority.

Table 5.1 Thread Priorities in Windows NT

Base

Priority class

Thread priority

31

Real-time

Time critical

26

Real-time

Highest

25

Real-time

Above normal

24

Real-time

Normal

23

Real-time

Below normal

22

Real-time

Lowest

16

Real-time

Idle

15

Idle, Normal, or High

Time critical

15

High

Highest

14

High

Above normal

13

High

Normal

12

High

Below normal

11

High

Lowest

10

Normal

Highest

9

Normal

Above normal

8

Normal

Normal

7

Normal

Below normal

6

Normal

Lowest

6

Idle

Highest

5

Idle

Above Normal

4

Idle

Normal

3

Idle

Below normal

2

Idle

Lowest

1

Idle, Normal, or High

Idle


Several tools can help you monitor process and thread priority: two are Performance Monitor and Task Manager, which are built into Windows NT 4.0. See Part 3, "Optimizing Windows NT Workstation," for more information.