Hi, imagine that you have a process A running with priority AboveNormal that starts another process B without specify the priority. Is the priority of the process B inherited from the priority of the process A? So, what will be the priority on the process B? AboveNormal, Normal or another?
A:
From the documentation for CreateProcess:
dwCreationFlags [in]
The flags that control the priority class and the creation of the process. For a list of values, see Process Creation Flags.
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.
So, in your example, the new process would have normal priority.
Chris Smith
2009-03-06 16:55:43
A:
In Windows the priority class is inherited, in contrast to the other response. Don't believe me? Try yourself. I used to assume it surely wasn't inherited, but it is. I just tested again, to verify what I already knew.
Jeremy Collake
2010-09-26 15:50:04
A:
Please note the accepted answer is wrong, as priorities ARE INHERITED unless they are specified during CreateProcess. The MSDN docs quote says this at the end too. It just bothers me a wrong answer is picked ;)
Jeremy Collake
2010-09-28 08:20:34