Programming Priorities

So how is a process assigned a priority class? Well, when you call CreateProcess, you can pass the desired priority class in the fdwCreate parameter. Table 7-5 shows the priority class identifiers.

Table 7-5. Process Priority Classes

Priority Class

Symbolic Identifiers

Real-time

REALTIME_PRIORITY_CLASS

High

HIGH_PRIORITY_CLASS

Above normal

ABOVE_NORMAL_PRIORITY_CLASS

Normal

NORMAL_PRIORITY_CLASS

Below normal

BELOW_NORMAL_PRIORITY_CLASS

Idle

IDLE_PRIORITY_CLASS

It might seem odd that the process that creates a child process chooses the priority class at which the child process runs. Let’s consider Windows Explorer as an example. When you use Windows Explorer to run an application, the new process runs at normal priority. Windows Explorer ...

Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.