KeSetBasePriorityThread - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// ntddk.h

LONG KeSetBasePriorityThread(
  [in, out] PKTHREAD Thread,
  [in]      LONG     Increment
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-ntddk-kesetbaseprioritythread)

Description

The KeSetBasePriorityThread routine sets the run-time priority, relative to the current process, for a given thread.

Parameters

Thread [in, out]

Pointer to a dispatcher object of type KTHREAD.

Increment [in]

Specifies the value to be added to the base priority of the process for the Thread. This value can be positive or negative.

The effective range depends on the process's priority class:

If the absolute value of Increment is greater than or equal to (HIGH_PRIORITY + 1) / 2, priority saturation occurs, meaning subsequent changes to the parent process base priority will not affect this thread's base priority.

Return value

KeSetBasePriorityThread returns the previous base priority increment of the given thread. The previous base priority increment is defined as the difference between the specified thread's old base priority and the base priority of the thread's process.

Special return values:

Remarks

The new base priority is computed by adding the given Increment, which can be a negative value, to the base priority of the specified thread's process. The resultant value is stored as the base priority of the specified thread.

Drivers that set up device-dedicated threads with variable priority attributes can call this routine to set such a thread's priority relative to the system process in which the thread is created.

The new base priority is restricted to the priority class of the given thread's process. Therefore, the base priority is not allowed to cross over from a variable priority class to a real-time priority class or vice versa.

KeSetBasePriorityThread is a relatively expensive operation that should be used sparingly. Avoid frequent calls to this function, as repeated priority changes (such as once per minute) can significantly impact system performance and prevent the scheduler from operating efficiently. Use this function only when persistent priority changes are required, not for temporary adjustments or periodic updates.

See also

KeGetCurrentThread

KeQueryPriorityThread

KeSetPriorityThread