What is the 'realtime' process priority setting for?
Asked Answered
S

8

89

From what I've read in the past, you're encouraged not to change the priority of your Windows applications programmatically, and if you do, you should never change them to 'Realtime'.

What does the 'Realtime' process priority setting do, compared to 'High', and 'Above Normal'?The process priority list, ranging from Low to Realtime.

Sera answered 2/11, 2009 at 21:59 Comment(0)
S
88

A realtime priority thread can never be pre-empted by timer interrupts and runs at a higher priority than any other thread in the system. As such a CPU bound realtime priority thread can totally ruin a machine.

Creating realtime priority threads requires a privilege (SeIncreaseBasePriorityPrivilege) so it can only be done by administrative users.

For Vista and beyond, one option for applications that do require that they run at realtime priorities is to use the Multimedia Class Scheduler Service (MMCSS) and let it manage your threads priority. The MMCSS will prevent your application from using too much CPU time so you don't have to worry about tanking the machine.

Scurrility answered 3/11, 2009 at 3:7 Comment(5)
Could it be dangerous to the system to put a single random process (such as a video game) on realtime priority? Would high priority be recommended/would there be a noticeable performance drop for that application?Hanky
@Hanky I wouldn't say it's dangerous, just that it slows down the entire system if it is a large program. Try setting Minecraft's priority to Realtime. Trust me, it's fun. Your mouse slows down, the keys take 5 seconds to respond, and explorer.exe becomes unresponsive!Bowknot
@Hanky I personally have run skyrim on high and realtime priority for months at a time, and it's made the game run far far smoother, with only the occasional audio artefact (for whatever reason). I've never suffered any problems from doing this... I assume that the system would at least overheat if something was going horribly wrong, but of course, I don't really know what COULD go wrong. Perhaps having multiple cores counters any starvation of resources to IO devices etc..Phlegmatic
There is a difference between a real-time priority thread and the real-time base priority class. The latter applies to the entire process and without additional setting of individual thread priorities, won't cause any threads to be real-time.Eddy
Realtime is an oxymoron in a time-share system. No user thread need to be realtime. Wait, what do you think you are ? you are more important than the thread that runs the hard-drive that does the IO you need for your program to work ? Good luck with having a stable system. I find it funny people think that the Minecraft thread is more important than the mouse, soundcard or harddrive thread.Plonk
M
29

Simply, the "Real Time" priority class is higher than "High" priority class. I don't think there's much more to it than that. Oh yeah - you have to have the SeIncreaseBasePriorityPrivilege to put a thread into the Real Time class.

Windows will sometimes boost the priority of a thread for various reasons, but it won't boost the priority of a thread into another priority class. It also won't boost the priority of threads in the real-time priority class. So a High priority thread won't get any automatic temporary boost into the Real Time priority class.

Russinovich's "Inside Windows" chapter on how Windows handles priorities is a great resource for learning how this works:

Note that there's absolutely no problem with a thread having a Real-time priority on a normal Windows system - they aren't necessarily for special processes running on dedicatd machines. I imagine that multimedia drivers and/or processes might need threads with a real-time priority. However, such a thread should not require much CPU - it should be blocking most of the time in order for normal system events to get processing.

Medicament answered 2/11, 2009 at 22:1 Comment(4)
Yes, realtime threads are appropriate if you have a thread that doesn't have much to do but needs to experience good response times.Retha
Iknow I know it's an old post but I found that book chapter really nice... got me going! google.ca/…Delative
I found a link to the book chapter thanks to Archive.org's Wayback Machine: web.archive.org/web/20140909124652/http://… (btw, I highly recommend making a custom search engine in Chrome like this: i.imgur.com/0kNVAi0.png). Then you just type wayback<tab> and paste the same url you're on. You may have to remove the http:// prefix.Relativity
Realtime is an oxymoron in a time-share system. No user thread need to be realtime. Wait, what do you think you are ? you are more important than the thread that runs the hard-drive that does the IO you need for your program to work ? Good luck with having a stable system.Plonk
Y
16

It would be the highest available priority setting, and would usually only be used on box that was dedicated to running that specific program. It's actually high enough that it could cause starvation of the keyboard and mouse threads to the extent that they become unresponsive.

So basicly, if you have to ask, don't use it :)

Yongyoni answered 2/11, 2009 at 22:3 Comment(2)
Agreed. It's important to know what it means (utmost priority is given to that thread, above all else), but if you ever find yourself asking if you should use it, you definitely should not.Biplane
how are you going to learn to use it if you don't ask how to use it? I guess you can use it and see what happens then you'll learn but I feel your discouraging learningGrave
E
3

Real-time is the highest priority class available to a process. Therefore, it is different from 'High' in that it's one step greater, and 'Above Normal' in that it's two steps greater.

Similarly, real-time is also a thread priority level.

The process priority class raises or lowers all effective thread priorities in the process and is therefore considered the 'base priority'.

So, a process has a:

  1. Base process priority class.
  2. Individual thread priorities, offsets of the base priority class.

Since real-time is supposed to be reserved for applications that absolutely must pre-empt other running processes, there is a special security privilege to protect against haphazard use of it. This is defined by the security policy.

In NT6+ (Vista+), use of the Vista Multimedia Class Scheduler is the proper way to achieve real-time operations in what is not a real-time OS. It works, for the most part, though is not perfect since the OS isn't designed for real-time operations.

Microsoft considers this priority very dangerous, rightly so. No application should use it except in very specialized circumstances, and even then try to limit its use to temporary needs.

Eddy answered 23/4, 2011 at 18:42 Comment(0)
N
1

Once Windows learns a program uses higher than normal priority it seems like it limits the priority on the process.

Setting the priority from IDLE to REALTIME does NOT change the CPU usage.

I found on My multi-processor AMD CPU that if I drop one of the CPUs ot like the LAST one the CPU usage will MAX OUT and the last CPU remains idle. The processor speed increases to 75% on my Quad AMD.

Use Task Manager->select process->Right Click on the process->Select->Set Affinity Click all but the last processor. The CPU usage will increase to the MAX on the remaining processors and Frame counts if processing video will increase.

Newmann answered 21/10, 2012 at 5:3 Comment(2)
You're right that changing the process priority class does not affect CPU utilization, so long as there is not contention for the CPU. BUT, you're wrong in thinking that Windows caps max process priorities based on CPU utilization. Instead, a security privilege protects against setting 'real time' to prevent haphazard use.Eddy
(reading years later) - The problem here is that threads can't be divided. So, you may have 8 cores, but only 2 CPU bound (100% active) threads. Thus you say "Why aren't my other 6 cores used?". Or, in your case, "Why isn't my last core used?". The remaining cores will appear to do nothing. And that is how you want it. If the thread were swapped around from core to core it would decrease performance. App developer has to multi-thread and not everything can be multi-threaded.Eddy
A
1

Like all other answers before real time gives that program the utmost priority class. Nothing is processed until that program has been processed.
On my pentium 4 machine I set minecraft to real time a lot since it increases the game performance a lot, and the system seems completely stable. so realtime isn't as bad as it seems, just if you have a multi-core set a program's affinity to a specific core or cores (just not all of them, just to let everything else be able to run in case the real time set programs gets hung up) and set the priority to real time.

Alarm answered 28/12, 2016 at 18:33 Comment(0)
K
0

It basically is higher/greater in everything else. A keyboard is less of a priority than the real time process. This means the process will be taken into account faster then keyboard and if it can't handle that, then your keyboard is slowed.

Kobe answered 23/5, 2015 at 4:47 Comment(0)
G
0

Realtime process priority is used mainly to make a specific process run faster at the expense of literally everything else. I personally have my Discord bot's process priority set to realtime, since the bot is lightweight, and I need to keep it responding quickly, but it would be a bad idea to randomly change process priorities unless you know what you're doing, for example, if you were to set Google Chrome's priority to low, it wouldn't cause any problems, but if you were to set registry's priority to low, it would likely cause more than enough problems. Just don't set a heavy program to realtime unless the device it's being run on is completely dedicated to that program.

Gono answered 25/1, 2023 at 10:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.