什么是“实时”?进程优先级设置为?

发布于 2024-08-09 22:49:14 字数 179 浏览 4 评论 0原文

根据我过去读到的内容,我们建议您不要以编程方式更改 Windows 应用程序的优先级,如果您这样做,则永远不应该将它们更改为“实时”。

与“高”和“高于正常”相比,“实时”进程优先级设置有什么作用?进程优先级列表,范围从低到实时。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

疯到世界奔溃 2024-08-16 22:49:15

简单地说,“实时”优先级高于“高”优先级。我认为没有比这更多的事情了。哦,是的 - 您必须拥有 SeIncreaseBasePriorityPrivilege 才能将线程放入 Real Time 类中。

Windows有时会出于各种原因提高线程的优先级,但它不会将线程的优先级提高到另一个优先级类别。它也不会提高实时优先级中线程的优先级。因此,高优先级线程不会自动临时提升到实时优先级类别。

Russinovich 的“Inside Windows”一章介绍了 Windows 如何处理优先级,是了解其工作原理的绝佳资源:

请注意,在普通 Windows 系统上具有实时优先级的线程绝对没有问题 - 它们不一定适用于在专用机器上运行的特殊进程。我想多媒体驱动程序和/或进程可能需要具有实时优先级的线程。然而,这样的线程不应该需要太多的CPU——它应该在大部分时间处于阻塞状态,以便正常的系统事件得到处理。

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.

浪推晚风 2024-08-16 22:49:15

这将是最高的可用优先级设置,通常仅在专用于运行该特定程序的机器上使用。它实际上足够高,可能会导致键盘和鼠标线程匮乏,以致它们变得无响应。

所以基本上,如果你必须问,就不要使用它:)

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

恰似旧人归 2024-08-16 22:49:15

实时是进程可用的最高优先级。因此,它与“高”的不同之处在于它多了一级,与“高于正常”的不同之处在于它多了两级。

同样,实时也是一个线程优先级。

进程优先级提高或降低进程中所有有效线程的优先级,因此被视为“基本优先级”。

因此,进程具有:

  1. 基本进程优先级
  2. 各个线程优先级,基本优先级类的偏移量。

由于实时应该保留给绝对必须抢占其他正在运行的进程的应用程序,因此有一个特殊的安全特权来防止随意使用它。这是由安全策略定义的。

在 NT6+ (Vista+) 中,使用 Vista 多媒体类调度程序是在非实时操作系统中实现实时操作的正确方法。它在大多数情况下都可以工作,但并不完美,因为操作系统不是为实时操作而设计的。

微软认为这个优先事项非常危险,这是正确的。除非在非常特殊的情况下,否则任何应用程序都不应使用它,即使如此,也应尝试将其使用限制为临时需要。

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.

ζ澈沫 2024-08-16 22:49:15

一旦 Windows 得知某个程序使用高于正常优先级的优先级,它似乎会限制该进程的优先级。

将优先级从 IDLE 设置为 REALTIME 不会改变 CPU 使用率。

我在我的多处理器 AMD CPU 上发现,如果我删除其中一个 CPU(例如最后一个 CPU),CPU 使用率将达到最大值,并且最后一个 CPU 保持空闲状态。我的 Quad AMD 上的处理器速度提高到 75%。

使用任务管理器->选择进程->右键单击进程->选择->设置关联性
单击除最后一个处理器之外的所有处理器。如果处理视频增加,则剩余处理器和帧计数的 CPU 使用率将增加到最大值。

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.

你另情深 2024-08-16 22:49:15

与实时之前的所有其他答案一样,该程序具有最高优先级。在处理该程序之前不会处理任何内容。
在我的奔腾 4 机器上,我将《我的世界》设置为实时,因为它大大提高了游戏性能,并且系统看起来完全稳定。所以实时性并不像看起来那么糟糕,只要你有一个多核,设置一个程序与一个或多个特定核心的亲和力(只是不是全部,只是为了让其他所有东西都能够运行,以防实时设置程序挂起)并将优先级设置为实时。

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.

深海里的那抹蓝 2024-08-16 22:49:15

它基本上在其他方面都更高/更大。键盘的优先级不如实时进程。这意味着该过程将比键盘更快地被考虑,如果它不能处理,那么你的键盘就会变慢。

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.

横笛休吹塞上声 2024-08-16 22:49:15

实时进程优先级主要用于使特定进程运行得更快,而牺牲其他所有进程。我个人将我的 Discord 机器人的进程优先级设置为实时,因为该机器人是轻量级的,并且我需要保持它快速响应,但随机更改进程优先级将是一个坏主意,除非您知道自己在做什么,例如,如果您将 Google Chrome 的优先级设置为低,则不会导致任何问题,但如果您将注册表的优先级设置为低,则可能会导致足够多的问题。只是不要将繁重的程序设置为实时,除非运行该程序的设备完全专用于该程序。

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.

捶死心动 2024-08-16 22:49:14

实时优先级线程永远不会被计时器中断抢占,并且以比系统中任何其他线程更高的优先级运行。因此,受 CPU 限制的实时优先级线程可能会彻底毁掉一台机器。

创建实时优先级线程需要权限 (SeIncreaseBasePriorityPrivilege)所以它只能由管理用户完成。

对于 Vista 及更高版本,对于需要以实时优先级运行的应用程序,一种选择是使用 多媒体类调度程序服务 (MMCSS) 并让它管理您的线程优先级。 MMCSS 将防止您的应用程序使用过多的 CPU 时间,因此您不必担心机器性能下降。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文