NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Process.PriorityClass

Gets or sets the overall priority category for the associated process.

[Visual Basic]
Public Property PriorityClass As ProcessPriorityClass
[C#]
public ProcessPriorityClass PriorityClass {get; set;}
[C++]
public: __property ProcessPriorityClass get_PriorityClass();
public: __property void set_PriorityClass(ProcessPriorityClass);
[JScript]
public function get PriorityClass() : ProcessPriorityClass;
public function set PriorityClass(ProcessPriorityClass);

Property Value

The priority category for the associated process, from which the process's BasePriority is calculated.

Exceptions

Exception Type Condition
Win32Exception Process priority information could not be set or retrieved from the associated process resource.

-or-

The process ID or process handle is 0. (The process has not been started.)

SystemException You are attempting to access the Modules on a remote computer. The property is only available for processes running on the local computer.

-or-

The process Id was not available.

Remarks

A process priority class encompasses a range of thread priority levels. Threads with different priorities running in the process run relative to the process's PriorityClass. Win32 uses four priority classes with seven base priority levels per class. These process priority classes are captured in the enumeration, ProcessPriorityClass, which lets you set the process priority to Idle, Normal, High, AboveNormal, BelowNormal, or RealTime. Based on time elapsed or other boosts, the base priority level can be changed by the operating system when a process needs to be put ahead of others for access to the processor. In addition, you can set PriorityBoostEnabled to temporarily boost the priority level of threads that have been taken out of wait state. The priority is reset when the process returns to the wait state.

The BasePriority property lets you view the starting priority assigned to a process. However, because it is read-only, you cannot use BasePriority to set a process's priority. To change the priority, use PriorityClass. PriorityClass returns or sets the overall priority category for the process. Threads with different priority levels running in the process run relative to the PriorityClass.

PriorityClass cannot be viewed using the Performance Monitor. The following table shows the relationship between BasePriority values and PriorityClass values.

BasePriority PriorityClass
4 Idle
8 Normal
13 High
24 RealTime

See Also

Process Class | Process Members | System.Diagnostics Namespace | BasePriority | PriorityBoostEnabled