Awakening threads for synchronization mechanisms
When only one thread is to be awakened for a newly available synchronization
mechanism, the selection is made by the following general rule.
-
Preference is given to bound threads over multiplexed threads.
-
If there is still more than one candidate for awakening,
the thread with the highest (Threads Library) ``priority''
is chosen.
-
If there is still more than one candidate for awakening,
the thread that blocked first is selected.
-
FIFO ordering of threads of the same priority is generally true
but not guaranteed.
In this implementation,
there are race conditions in which the ordering is not strictly FIFO.
There are some exceptions to this algorithm:
-
For a broadcast on a condition variable and
for barriers, more than one thread is awakened.
Conceptually, these are awakened simultaneously.
-
For reader-writer locks,
the order of awakening is strictly FIFO,
regardless of priority or other factors.
Next topic:
Further considerations for synchronization mechanisms
Previous topic:
Condition variables
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005