Server boost

Updated: May 06, 2022

If a high-priority thread becomes SEND-blocked on a server, the kernel tries to find one or more threads that are likely to receive on the given channel, and then it boosts their priorities.

When there are no server threads that are RECEIVE-blocked on a channel, and a client sends a message or pulse, the kernel boosts the priority of all server threads that last received on that channel, in the hope that one of them will soon finish up and be able to do a receive.

Note: This situation is considered to be a symptom of a poorly designed server, and the kernel's response is an attempt to work around it. A server or resource manager should always have at least one RECEIVE-blocked thread.

When a thread is boosted for the first time, its original priority is recorded. The thread may be boosted multiple times if multiple threads become SEND-blocked, but the kernel records only the priority before the initial boosting.

When a message is next received, the kernel reevaluates the situation. If there are still pulses or SEND-blocked threads, then some of the boosted threads may remain boosted (although potentially at a lower priority), while others may drop back to their original priority.

If there are no SEND-blocked threads, then all threads that were originally boosted return to their original priorities.

A thread is associated with a channel when it does a MsgReceive() on it. In the case of multiple channels, a thread is associated with the last channel it received from. After receiving a message, a thread can dissociate itself from the channel by calling MsgReceive() with a -1 for the channel ID.