windows - 进程优先级是否继承?

标签 windows inheritance process windows-task-scheduler

假设您有一个以 AboveNormal 优先级运行的 Windows 进程 A 启动另一个进程 B 而未指定优先级。进程B的优先级是否继承了进程A的优先级?那么,进程 B 的优先级是什么? AboveNormal、Normal 还是其他?

最佳答案

如果未指定,在某些情况下,优先级继承的。

当调用进程处于IDLE_PRIORITY_CLASSBELOW_NORMAL_PRIORITY 类时发生。否则,它将获得 NORMAL_PRIORITY_CLASS,除非在 CreateProcess 调用期间指定。

MSDN 在 CreateProcess 的 dwCreationFlags 上说:

This parameter also controls the new process's priority class, which is used to determine the scheduling priorities of the process's threads. For a list of values, see GetPriorityClass. If none of the priority class flags is specified, the priority class defaults to NORMAL_PRIORITY_CLASS unless the priority class of the creating process is IDLE_PRIORITY_CLASS or BELOW_NORMAL_PRIORITY_CLASS. In this case, the child process receives the default priority class of the calling process.

因此答案是 NORMAL 优先级。基本上任何超出正常水平的东西都不会传递给 child 。

关于windows - 进程优先级是否继承?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/619543/

相关文章:

Java继承层次动物类

c# - 如何调用声明为抽象重写的基方法

windows - 如何使用任何 cygwin 实用程序在 Windows 中查看带有参数的进程

multithreading - Erlang 和进程

c++ - 多重继承中的内存布局

java - 我想以管理员身份运行 PowerShell 并通过 Java 在管理员电源 shell 中执行命令

windows - 登录 windows azure sql 数据库时出错

windows - git-bash $PATH 无法用空格解析 windows 目录

Python - Windows - 当 "unrelated"父进程死亡/崩溃时退出子进程

windows - 使用 powershell 添加/删除主机文件条目会损坏文件