What is the 'realtime' process priority setting for?

后端 未结 7 1793
挽巷
挽巷 2020-12-08 06:20

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

相关标签:
7条回答
  • 2020-12-08 06:36

    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:

    • http://web.archive.org/web/20140909124652/http://download.microsoft.com/download/5/b/3/5b38800c-ba6e-4023-9078-6e9ce2383e65/C06X1116607.pdf

    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.

    0 讨论(0)
  • 2020-12-08 06:36

    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.

    0 讨论(0)
  • 2020-12-08 06:37

    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.

    0 讨论(0)
  • 2020-12-08 06:43

    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.

    0 讨论(0)
  • 2020-12-08 06:43

    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 :)

    0 讨论(0)
  • 2020-12-08 06:47

    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.

    0 讨论(0)
提交回复
热议问题