如果它是活动窗口,任务会更快完成吗?

发布于 2024-07-27 12:50:38 字数 108 浏览 3 评论 0原文

我听说过一个神话:如果将作业保留为活动窗口,而不是在后台或最小化,那么它会更快地完成。

有没有道理呢? 当发生这种情况时,CPU 是否会优先处理任务?

谢谢,

I have heard a myth that a job will finish faster if it is kept as the active window, and not in the background or minimized.

Is there any truth to this? Does the CPU put precedence to tasks where this happens?

Thanks,

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

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

发布评论

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

评论(4

傾旎 2024-08-03 12:50:38

在 Windows 上,前台应用程序的优先级会得到提升。 这是为了帮助它保持对用户的响应能力,并确保当它在等待某些 I/O 事件后准备好运行时,它会先于大多数其他可能等待运行的应用程序运行。

对于前台应用来说,还有可能使用更长的量子数。

我不知道如果应用程序在前台而不是后台运行,它的完成速度会快多少 - 这涉及到很多因素(特别是 I/O)。 目的是使应用程序响应更快。

这在某种程度上都是可配置的(可能仅在服务器 SKU 上):

On Windows the foreground application gets a priority boost. This is to help it maintain responsiveness to the user and makes sure that when it's ready to run after waiting for some I/O event, it'll get to run next, ahead of most other applications that might be waiting to run.

There is also a potential for a longer quantum for foreground applications.

I don't know how much faster an application would complete if it's run in the foreground instead of the background - there are so many factors that would go into this (particularly I/O). The intent is to make the application more responsive.

This is all configurable to some extent (maybe only on server SKUs):

朱染 2024-08-03 12:50:38

这取决于您的设置。 在默认的 Windows 桌面 操作系统上,这是事实。 在 Windows 服务器 操作系统(如 Windows 2003)上,情况并非如此。

您可以通过进入“系统属性”并单击“性能”选项卡来更改设置。 确切的布局因 Windows 版本而异,但您应该看到(或者能够通过单击“高级”子选项卡或查找“调度程序”来查看)“工作站”和“服务器”配置之间的单选/组合选择,或者一个选项在程序或后台服务的优先级之间进行选择。 在这两种情况下,它们都是相同的东西(只是不同的语言 - 服务器/工作站语言来自 Windows 2000,而程序/服务是为更面向消费者的 XP 创建的) - 它们确定调度程序是否对线程的线程给予额外的重视。最顶层窗口,或者是否平等对待所有线程(基于线程优先级属性)。

It depends on your setup. On a default Windows desktop operating system, this is true. On a Windows server operating system (like Windows 2003) this is not true.

You can change the setting by going into System Properties and clicking on the Performance tab. The exact layout differs depending on Windows version, but you should see (or be able to see by clicking an Advanced sub tab or finding "Scheduler") either a radio/combo choice between "Workstation" and "Server" configuration, or a choice between prioritizing Programs or Background Services. In both cases these are the same thing (just different language - the Server/Workstation language is from Windows 2000, while Programs/Services was created for the more consumer oriented XP) - they determine if the scheduler gives extra importance to the thread of the top most window, or if all threads are treated equally (based on the thread prioritity property).

吃→可爱长大的 2024-08-03 12:50:38

Windows 允许您给予“前台”任务优先级优势,因此这可能不是神话。 您还可以以其他方式设置它,为“服务”任务提供优先级优势,因此这取决于安装。

请注意,这只会影响优先级......如果没有其他任务正在运行,则在任何情况下它的运行都不会明显不同。 仅当有另一个应用程序需要 CPU 时间时,您可能会注意到差异。

Windows allows you to give the "foreground" task a priority advantage, so it may be no myth. You can also set it the other way, to give "service" tasks the priority advantage instead, so it depends on the install.

Note that this only affects the priority... if there are no other tasks running, it won't run noticeably different in either case. It's only when there is another application that needs CPU time that you might notice the difference.

格子衫的從容 2024-08-03 12:50:38

这在 Windows 上是部分正确的。 Windows 会分配一个窗口位于顶部的 GUI 应用程序,其优先级稍高。 因此,如果有其他具有正常或较低优先级的任务,程序实际上可以运行得更快一点,但代价是其他程序运行得慢一点。

然而,有一个问题。 当您在 Visual Studio IDE 中开始编译时,IDE 将生成一个单独的编译进程,并且仅将其输出重定向到其自己的窗口。 由于编译过程现在没有自己的窗口,因此不会获得加速。

That's partially true on Windows. Windows would assign a GUI application that has its window on-top slightly higher priority. So if there're other tasks with normal or lower priority the program could really run a bit faster at the expense of other programs running a bit slower.

There's catch however. When you start compilation in Visual Studio IDE the IDE will spawn a separate process for the compilation and only redirect its output to its own window. Since the compilation process now has no own windows it will not gain acceleration.

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