OS/2 uses four priority classes to determine when a thread receives a time slice:
Priority Classes
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³Priority ³Description ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Time-critical ³Highest priority. For use ³ ³ ³when response time is ³ ³ ³critical. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Fixed-high ³Used by threads that provide ³ ³ ³service to other threads. This³ ³ ³priority class is to be used ³ ³ ³when it is desirable that the ³ ³ ³thread not be too sensitive to³ ³ ³the foreground/background ³ ³ ³boost provided by dynamic ³ ³ ³priority variation. It is ³ ³ ³meant for programs that need ³ ³ ³to execute before regular ³ ³ ³programs, but without the ³ ³ ³immediate response time ³ ³ ³requirement called for by ³ ³ ³time-critical threads. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Regular ³Default priority. Most ³ ³ ³threads belong in this class. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Idle-time ³Lowest priority. This ³ ³ ³priority only gets CPU time ³ ³ ³when there is no other work to³ ³ ³do. ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
A time-critical thread always receives a time slice before a fixed-high thread, a fixed-high thread always receives a time slice before a regular thread, and a regular thread always receives a time slice before an idle-time thread.
Time-Critical Threads
Time-critical threads have the highest priority class and execute
before any fixed-high, regular, or idle-time threads.
The time-critical class is for threads that must react to events outside the system. For example, in a communications application, a thread responsible for reading data from the communications device needs enough time to read all incoming data. Because more than a regular time slice might be needed, a time-critical classification ensures that the thread gets all the time required.
Time-critical threads have a static priority that is not varied by OS/2. They are scheduled among themselves in priority level order, with round-robin scheduling of threads of equal priority.
Time-critical threads must be executed quickly, then free the CPU for other work until another time-critical event occurs. This is important to maintain good interactive responsiveness to the user and enable communications and other time critical applications to run concurrently. The time-critical activity should, when possible, be in a thread separate from the rest of the application, to isolate and minimize the time spent processing at the time-critical level. A good rule of thumb is that a time-critical thread should consist of no more than about 20,000 assembly language instructions.
Fixed-High Threads
A fixed-high thread has a priority class that is lower than time-critical
but executes before any regular or idle-time threads. This class of threads
should be used to provide service for other threads where it is desirable
that the thread not be too sensitive to the foreground/background boost
provided by dynamic priority variation. A messaging thread, would be a good
example of this type of thread.
OS/2 varies the priority of a fixed-high thread around a base value according to the activity of the thread and the system at any point in time. The base value can be set by the thread itself.
Regular Threads
A regular thread is the class that the majority of threads fall into.
No explicit action is necessary by the application to run at this priority,
it is the default.
OS/2 varies the priority level of a regular thread around a base value according to the activity of the thread and the system at any point in time. The base value can be set by the thread itself.
Idle-Time Threads
An idle-time thread is one with very low priority that executes only
when there are no regular, fixed-high, or time-critical threads to execute.
Idle-time threads get CPU time only when there is no other work to do. The
idle-time class is for threads that need very little CPU time.
Idle-time threads have a static priority that is not varied by OS/2.