This article relies largely or entirely on a single source. (November 2022) |
Windows NT processor scheduling refers to the process by which Windows NT determines which job (task) should be run on the computer processor at which time. Without scheduling, the processor would give attention to jobs based on when they arrived in the queue, which is usually not optimal. As part of the scheduling, the processor gives a priority level to different processes running on the machine. When two processes are requesting service at the same time, the processor performs the jobs for the one with the higher priority.
There are six named priority levels:
- Realtime
- High
- Above Normal
- Normal
- Below Normal
- Low
These levels have associated numbers with them. Applications start at a base priority level of eight. The system dynamically adjusts the priority level to give all applications access to the processor. Priority levels 0 - 15 are used by dynamic applications. Priority levels 16- 31 are reserved for real-time applications.
Random boosting
editRandom boosting is a strategy used by the scheduler in Microsoft Windows to avoid deadlock due to priority inversion. Ready threads holding locks are randomly boosted in priority and allowed to run long enough to exit the critical section. If the thread doesn't get enough time to release the lock, it will get another chance.[1][2]
This strategy is no longer used in the latest versions of Windows and has been replaced by a strategy called AutoBoost.[3]
Affinity
editIn a multiprocessing environment with more than one logical processor (i.e. multiple cores or hyperthreading), more than one task can be running at the same time. However, a process or a thread can be set to run on only a subset of the available logical processors. The Windows Task Manager utility offers a user interface for this at the process level.[4]
References
edit- ↑ Priority Inversion (Windows), Microsoft, retrieved December 12, 2012,
The scheduler solves this problem by randomly boosting the priority of the ready threads (in this case, the low priority lock-holders). The low priority threads run long enough to exit the critical section, and the high-priority thread can enter the critical section. If the low-priority thread does not get enough CPU time to exit the critical section the first time, it will get another chance during the next round of scheduling.
- ↑ Cohen, Aaron; Woodring, Mike (1998), Win32 Multithreaded Programming, O'Reilly & Associates, p. 30,
Windows NT solves the priority inversion problem by randomly boosting the dynamic priorities of threads that are ready to run.
- ↑ "Priority Inversion (Windows)". Retrieved 12 October 2024.
The thread scheduler addresses this issue through a feature called AutoBoost. AutoBoost automatically tracks resource reservations and adjusts thread priorities by applying priority floors that a thread must never fall below. For example, if a low–priority thread acquires a critical section and a higher–priority thread is blocked waiting for the critical section, the priority of the owner is raised to the maximum priority of the waiter until it releases the resource.
- ↑ Russinovich, Mark E.; Solomon, David A. (2005). Microsoft Windows internals : Microsoft Windows Server 2003, Windows XP, and Windows 2000 (4th ed.). Redmond, WA: Microsoft Press. ISBN 0735619174. OCLC 57449950.