The information in this article applies to:
SUMMARYA process' priority determines how its execution is scheduled by the Win32 kernel. Processes with a higher priority execute more quickly than processes with a lower priority. This article describes how to modify the Process priority of a shelled application. MORE INFORMATION
Win32 supports the following four priority classes:
Normal priority class is the default, indicating a process with no special scheduling needs. High priority indicates a process that performs time-critical tasks requiring immediate execution for it to run correctly. The threads of a high-priority class process preempt the threads of normal or idle priority class processes. An example is the Windows Task List, which must respond quickly when called by the user, regardless of the load on the operating system. Use extreme care when using the high-priority class, because a high- priority class CPU-bound application can use almost all available cycles. The Realtime priority indicates a process that has the highest possible priority. The threads of a real-time priority class process preempt the threads of all other processes, including operating system processes performing important tasks. For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush or cause the mouse to be unresponsive. This priority should almost never be used. The process' priority is set by assigning one of the parameters of the CreateProcess API call. The following example demonstrates running the Windows NOTEPAD application under Windows NT using an idle priority. The process priority is controlled by the 'dwCreationFlags' variable passed to CreateProcess(). DEFINEs for the four supported priority classes are listed at the top of the sample program. Once Notepad.exe is running, to examine the priority, start the Windows NT Task Manager, select the Processes tab, right-click Notepad.exe and select 'Set Priority' from the pop-up menu. The fully qualified pathname to Notepad.exe may need modification in the assignment statement of variable 'File2Run'. Sample Code
REFERENCES"Advanced Windows", Jeffrey Richter, Microsoft Press, pages 92-103, Third Edition 1997, ISBN: 1-57231-548-2 Additional query words: kbVFp600 kbAPI
Keywords : |
Last Reviewed: August 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |