Implementing Finite Queues

Limitations in buffer space can be modeled by specifying the maximum number of packets or bits that can be held by each subqueue of a queue module. Usually, either a packet limit or a bit limit is set. However, if both are used, they are applied as separate criteria, so that if either limit is reached, further insertions into the subqueue will be prevented. These limits are set with the pk capacity and bit capacity attributes of subqueues. The default value for these attributes is “infinite”.

Limitations imposed on subqueue sizes have no effect on queueing behavior until a packet insertion is attempted that would cause the limits to be exceeded. For example, if a subqueue with a capacity of fifty packets already contains fifty packets, then calling the Kernel Procedure op_subq_pk_insert() to insert an additional packet results in a failure: instead of returning the status flag OPC_QINS_OK as usual, the procedure returns OPC_QINS_FAIL, indicating that the queue insertion was not successful. The Simulation Kernel does not resolve the contention for buffer space. Instead, the process model must take some explicit action. Depending on the nature of the process being modeled, it might choose to insert the new packet at the expense of a packet already in the queue, which would first have to be removed from the queue to permit a successful insertion, or it might choose to discard the newly arriving packet instead.

Each time an insertion fails due to lack of capacity in a subqueue, a queue statistic called overflows is increased by one. This statistic either can be written to the simulation output file and viewed in the Results Browser or used dynamically by process models as the simulation progresses, to monitor and/or modify the behavior of the queue.