Queue Modules
Figure 159: Standard Icon Used for a Queue Module

Queue modules provide a superset of the functionality of processor modules. Like processors, they can execute an arbitrary process model that describes the behavior of a particular process or protocol, and can be connected via packet streams to other modules, allowing them to send and receive data packets. The process model can also affect the queue object’s list of attributes. The previous section on the processor module provides information concerning the relationship between process models and processors that is also applicable to queues.
The primary difference between processors and queue modules is that queues contain additional internal resources called subqueues, as illustrated in the figure below. Subqueues facilitate buffering and managing a collection of data packets. While it is possible to implement this functionality with ordinary processor modules, the use of subqueues, together with the Kernel Procedures that manipulate them, provide greater flexibility and ease of implementation of a variety of queueing disciplines. Moreover, subqueues automatically compute a number of statistics about their operation, which may be collected in a straightforward manner by using probes. For more information, see “Probe Reference” on page 107.
Figure 160: Internal Structure of Queue with k Subqueues

Each queue module contains a definable number of subqueues. A subqueue is an object which is subordinate to the queue object and which has its own attributes used to configure it. It is contained within the queue by means of the queue’s “subqueue” compound attribute. This attribute holds a compound-attribute object which is the parent of one or more subqueues. See “Modeling Framework” on page 80 for more information about how subordinate objects are stored using compound attributes.
The capacity of each subqueue to hold data is unlimited by default, but a limit may be set on the number of packets or the total size of all packets (or both) within a subqueue. It is up to the processes in the queue to determine what action to take when subqueues become full: packets may be removed to create space for new arrivals, or the new arrivals may be discarded. The Simulation Kernel merely provides notification that a subqueue can no longer accept additional packets when an insertion is attempted.
Most of the Kernel Procedures related to queue modules operate directly on a specified subqueue (for example, packet insertion and deletion, accessing statistics, or flushing a subqueue). Some Kernel Procedures, however, access properties of the queue module as a whole (for example, obtaining aggregate statistics or flushing the contents of an entire queue module), or of a packet within the queue module without regard to the particular subqueue which holds it (for example, queue insertion time or waiting time). For more information about these Kernel Procedures, see “Queue Package” on page 1 and “Subqueue Package” on page 1.
Because the user controls the process model executed by a queue, it is possible to model any queueing protocol by defining the manner in which the subqueues are accessed and managed. Within a module, subqueues may be selected directly by a physical index, or via abstract indices, which allow the process model to choose a subqueue based on its state relative to other subqueues. For example, the shortest subqueue may be chosen, or the one with the largest queueing delay. Likewise, packets within a subqueue may be accessed directly by index number, or they may be retrieved abstractly by requesting the packet at the head or the tail of the subqueue, or the packet with the highest priority. For more details on how these features can be used to implement a particular queueing discipline, see Modeling Queues.