Starting Applications at Different Priorities
Under preemptive multitasking, Windows NT determines which application should get access to the processor for execution by using priority levels. Each application starts at a base priority level of eight. The system dynamically adjusts the priority level to give all applications access to the processor. The process or thread with the highest priority base at any one time has access to the processor. Some of the factors that cause Windows NT to adjust the priority of a thread or process include the following:
- Windows NT boosts the base priority of whichever process is running in the foreground. This ensures that the response time is maximized for the currently used application.
- Windows NT randomly boosts the priority for lower-priority threads. This has two major benefits. The first benefit is that low priority threads that would normally not be able to run can do so after their priority base is raised. The second benefit is that if a lower-priority process has access to a resource that is to be shared with a higher priority process, the lower priority process could end up monopolizing the resource. The boost in the lower priority thread’s base priority frees up the resource sooner.
- Any time that a thread has been in a voluntary wait state, Windows NT boosts its priority. The size of the boost depends on how long the resource has been in a wait state.
Figure 5.24 shows how Windows NT handles different priority levels.
Priority levels 0 to 15 are used by dynamic applications. Anything running at a dynamic level can be written to the Windows NT Pagefile. This includes user applications by default and operating system functions that are not imperative to the performance of the operating system. Priority levels 16 to 31 are reserved for real-time applications that cannot be written to the Windows NT Pagefile. This includes all Executive Services and the Windows NT Kernel.
Further Information