简体   繁体   English

前台线程与背景线程

[英]foreground threads vs background threads

MSDN states that: MSDN声明:

Background threads are identical to foreground threads with one exception: a background thread does not keep the managed execution environment running 后台线程与前台线程相同,但有一个例外:后台线程不会使托管执行环境保持运行

  1. Is there any dereference in the Thread Quantum that given by OS to the thread if it were a background thread rather than the foreground threads? 如果线程量子是后台线程而不是前台线程,那么线程量子中是否有任何解除引用? Check this . 检查一下

  2. When setting a background thread priority to a higher value like Highest , will it get more quantum than a foreground one with lower priority? 将后台线程优先级设置为像Highest这样的较高值时,它会获得比具有较低优先级的前景线程更多的量子吗?

Thanks in advance. 提前致谢。

Managed foreground/background threads, the Windows thread quantum and thread priority are orthogonal concepts. 托管的前台/后台线程,Windows线程量子和线程优先级是正交概念。

  • Being a foreground thread means that the process cannot be stopped until it (and all other foreground threads) are stopped. 作为前台线程意味着在它(以及所有其他前台线程)停止之前不能停止进程。
  • The quantum is the length of time a thread gets to run before the system will consider scheduling another thread on that processor. 量程是线程在系统考虑在该处理器上调度另一个线程之前运行的时间长度。
  • The thread priority determines the pecking order within all ready to run, waiting threads. 线程优先级确定所有准备运行的等待线程中的查找顺序。

Of these three items, only foreground/background pertains to managed code. 在这三个项目中,只有前台/后台与托管代码相关。

Now to your questions. 现在回答你的问题。

  1. The foreground process is a Windows concept. 前台进程是Windows概念。 It is unrelated to foreground/background threads in .net. 它与.net中的前台/后台线程无关。
  2. Thread priority does not affect the quantum. 线程优先级不会影响量子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM