By contrast, threads which are currently "blocked" need no CPU time anyway, so for them, priorities do not matter until they are unblocked again. Note that on your typical &os2; system, the large majority of threads will be in "blocked" state at any given point in time.
&os2; is capable of controlling thread priorities in a very refined way. It differentiates between four priority classes:
Such a thread should only use the minimum possible CPU time because it cannot be
interrupted (except by other time-critical threads) and can easily hang the system.
Even if it yields the CPU via DosSleep(0)
(see the documentation for
DosSleep
in the Toolkit documentation*),
other non-time-critical threads will not run.
This is normally only used for network and other communications software, or
CD writers, or MP3 players.
A few examples:
Within the "regular priority" class however &os2; ensures that no thread
"starves", i.e. never gets processor time, by dynamically raising each
thread's priorities after a certain time automatically. This period of time
is determined by the MAXWAIT
&cfgsys; setting. Moreover, &os2;
boosts a thread's priority temporarily if it is to receive keyboard input,
if the process of the thread runs in the foreground, or if the thread is
currently doing I/O.
These dynamic adjustments are only then performed if &cfgsys; does
not contain the command PRIORITY=ABSOLUTE,
which is not
recommended.