This call allows a process to change the priority of all the threads of any process; or all the threads of the current process or a child process, as well as any descendants; or a single thread within the current process. When a process changes the priority of threads in other processes, only default priorities are changed.
DosSetPrty
Scope (USHORT) - input
Value
Value
The OS/2 scheduler has a concept of priority classes and levels. DosSetPrty allows threads to move between classes in response to changes in their execution environments. Within each class, a thread's priority level can vary because of a DosSetPrty request or action taken by the system. System-initiated priority variation is performed as a combination of a specific thread's actions and the overall system activity.
A time-critical thread has the highest priority class and executes before any fixed-high, regular, or idle-time threads. A fixed-high thread has a priority class that is lower than time-critical but executes before any regular or idle-time threads.
Time-critical threads have static priorities that are not varied by OS/2. Threads are scheduled in priority order, with round-robin scheduling of threads of equal priority.
For each of the four priority classes, there are 32 distinct priority levels, 0 to +31. Whenever DosSetPrty is issued with a class specification, but no value is specified for PriorityDelta, the base priority level defaults to zero.
The priority level of a process consists of a computed priority value that is based upon the display status (foreground or background) of the process, its recent I/O and processor time-usage history, and other factors. The signed value specified in PriorityDelta is added to the computed priority to produce the actual priority used by the scheduler. The result is restricted to the valid range, based upon the current priority class.
Specifying a higher priority delta allows a thread to obtain better processor scheduling than it normally would. A lower priority delta gives the thread less processor resource than it normally receives.
When used with PriorityClass to change to a different class, the delta value applies to the base priority. A new base level of 0 is assigned the target thread and any PriorityDelta specified is relative to zero.
A process can change the priority of any thread within its current process. However, when a process changes the priority of threads in another process, only those with default priorities are changed. The priority of any thread in another process that has explicitly changed its priority from the default with DosSetPrty is not changed.
The initial thread of execution for an application is given a regular class priority that varies by the system. A thread started with DosCreateThread inherits the priority of the thread in the process that creates it. A child process started by a DosExecPgm call inherits the priority of the thread in the parent process that creates it.