STREAMS Programming Guide

Message Queueing Priority

Sometimes messages with urgent information, such as a break or alarm conditions, must pass through the Stream quickly. To accommodate them, STREAMS uses message queuing priority, and high-priority message types. All messages have an associated priority field. Normal (ordinary) messages have a priority of zero, while priority messages have a priority band greater than zero. High-priority messages have a high priority by virtue of their message type, are not blocked by STREAMS flow control, and are processed ahead of all ordinary messages on the queue.

Nonpriority, ordinary messages are placed at the end of the queue following all other messages that can be waiting. Priority messages can be either high priority or priority band messages. High-priority messages are placed at the head of the queue but after any other high-priority messages already in the queue. Priority band messages that enable support of urgent, expedited data, are placed in the queue after high-priority messages but before ordinary messages. Priority band messages are placed below all messages that have a priority greater than or equal to their own, but above any with a lesser priority. Figure 1-5 shows the message queueing priorities

Figure 1-5 Message Priorities

Graphic

High-priority message types cannot be changed into normal or priority band message types. Certain message types come in equivalent high-priority or ordinary pairs (for example, M_PCPROTO and M_PROTO), so that a module or device driver can choose between the two priorities when sending information.