At some point when looking through Task Manager you may notice the ‘priority’ setting in Task Manager and decide that you want your favorite game (example: Minecraft) to run faster. You right click the process in Task Manager and set the priority to ‘realtime’, the highest setting.
However, upon clicking that option, a scary looking dialogue option pops up informing you that this is probably a bad move.
Changing the priority in this instance causes our laptop mouse to lag across the screen and explorer.exe to stop responding. Fun! Why is this the case? What’s going on here?
Realtime priority is the absolute highest priority you can set a program. This tells Windows you want to dedicate as much CPU time as possible to that process, so basic process like mouse input and Windows UI start competing for CPU cycles.
OPTIONAL: Process Table Explanation and Further Information
The “Base priority” column in Task Manager is showing you the process class (called “process priority class” in some docs). Note that Task Manager (at least in Windows 10) labels the “Idle” priority class as “Low” (probably to avoid confusion with the idle process, etc.).
The process class is used only to initialize the priority of threads created within the process. Every thread is created with the “normal” thread priority. If the process is of the “normal” process class, then that means the thread has a base priority of 8.
Programs can change the priorities of their own threads within their process class. In a “normal” process, setting a thread to THREAD_PRIORITY_HIGHEST sets that thread’s base priority to 10. If you change the priority class of a process (say with Task Manager) then every thread’s base priority changes according to the table.
There are a lot of “name anomalies” in this table. “Highest” is not the highest thread priority, “lowest” is not the lowest, “idle” does not mean you are not or will not be doing anything, and “realtime” does not guarantee scheduling behavior suitable for real-time work (it’s just more predictable than the non-realtime classes, partly because it’s above them all, and partly because automatic priority adjustment is turned off in the “realtime” class).
For processes, one is supposed to use the process classes to indicate how important – or not – it is for each process to get CPU time, relative to a “normal” process. And within each process, the developer is supposed to set the thread priorities similarly, relative to a “normal” thread within the process. In practice, very few developers ever bother. (And they should. For example, a compute-bound task like video rendering should be set to a lower-than-normal priority, to avoid interfering with interactive use of the system.)
And the “idle” process class, and the “idle” thread priority within a process, does not mean nothing will be done by that process or that thread. It just means the thread or the process is willing to live with CPU cycles that nobody else wants.
You’ll notice that there is no “0” on the table. Ordinary applications cannot request running at priority 0 through the normal APIs. Only kernel mode threads can run at priority zero. As you’ve found, that is reserved for the zero page thread – or threads; there may be more than one on a NUMA machine.
This doesn’t lead to locking the system entirely because most programs don’t actually use 100% of the CPU regardless of their priority. Most threads do wait for things sometimes, and that could include waiting for a read/write to complete, or some other thread to indicate that they don’t have to wait any more. Additionally, “real-time priority” as a term actually consists of a range of priorities, as indicated by the table above. It’s possible for one “real-time” process to have higher priorities than those of another “real-time” process.
Most of the time, there’s no real reason to change process priority, although a few times it has been personally helpful in situations where two programs are working on a CPU intensive task, and they are slowing each other down. It’s possible to set the program’s process priority to “Above normal” pretty safely, allowing the CPU to dedicate more time to it.
Here’s a tricky one. How do you run a program or exe ONLY when your Windows laptop is plugged in? Additionally, you’d want it to automatically exit when your laptop was unplugged and you were using battery power. I recently stumbled across this problem when I wanted to run Rainmeter on my laptop when it’s plugged in.