Queue Discipline
The queue discipline determines how
entities
arriving at the queue input will be ranked when the queue is non-empty.
Assume the queue output is connected to a
block
that can accept entities if it is idle, and cannot accept entities if it is busy.
For example, such a block could be a
server.
If the queue is empty but the block (server) is busy, the entity arriving at the queue input becomes first in the queue.
The same happens if the queue is empty but the queue output is not connected to any block.
If the queue is empty and the block is idle, an entity arriving at the queue input is immediately passed to the queue output.
If the queue is not empty, the entity arriving at the queue input is placed in the queue according to the queue discipline.
If the block (server) changes its status from busy to idle, it requests the queue to pass the entity,
and if the queue is not empty, the entity first in the queue is passed to the block.