Adjust_Thread_Exec_Priority


include vmm.inc

mov     eax, PriorityBoost
mov     edi, ThreadHandle
VMMcall Adjust_Thread_Exec_Priority

Raises or lowers the execution priority of the specified thread. The service adds the specified boost to the thread's current execution priority. Uses Flags.

PriorityBoost

A signed integer value representing the positive or negative priority boost for the thread. This parameter must be a value such that when added to the current execution priority, the result is within the range Reserved_Low_Boost to Reserved_High_Boost. The following lists some common priority boost values, from lowest to highest:

Value

Meaning

Reserved_Low_Boost

Reserved for use by system.

Cur_Run_VM_Boost

Use to boost the priority of each thread, in turn, forcing them to run for their allotted timeslices.

Low_Pri_Device_Boost

Use for operations that need timely processing but are not time critical.

High_Pri_Device_Boost

Use for time-critical operations that should not circumvent the critical section boost.

Critical_Section_Boost

Use to boost the priority of the thread whenever it enters a critical section (calls Begin_Critical_Section).

Time_Critical_Boost

Use for operations that require immediate processing, even when another thread is in a critical section. For example, VPICD uses this when simulating hardware interrupts.

Reserved_High_Boost

Reserved for use by system.


ThreadHandle

Handle of the thread.

Because the nonsuspended thread with the highest execution priority is always the current thread, this service causes a task switch under two circumstances:

1 The execution priority of the current thread is lowered (EAX is negative), and there is another thread with a higher priority that is not suspended.

2 The execution priority of a nonsuspended thread which is not the current thread is raised (EAX is positive) higher than the current thread's execution priority.

Even if the current thread is in a critical section, a task switch will still occur if the priority of another nonsuspended thread is raised higher than the current thread's priority. However, this will only occur when a thread is given a time-critical boost, for example, to simulate a hardware interrupt.

It is often more convenient to call the Call_Priority_VM_Event service than to call this service directly.

See also Adjust_Exec_Priority, Begin_Critical_Section, Call_Priority_VM_Event