I want to model a queue. Should I use a queue/subqueue, or could I model it with a List instead? Are there any considerations for preferring subqueues over lists and vice versa? For example: simulation speed, memory, etc.?

Categories:
Solution Number:
S20725
Last Modified:
2013-08-20
Issue

I want to model a queue. Should I use a queue/subqueue, or could I model it with a List instead? Are there any considerations for preferring subqueues over lists and vice versa? For example: simulation speed, memory, etc.?

Solution

In OPNET you can perform the same tasks of flexible insertion/deletion with the subqueues as you will be able to do with lists.There are several advantages to using subqueues over lists. Basically, it comes down to why reinvent the wheel?OPNET supports priority modeling in subqueues. To accomplish this with lists, you'd have to write your own queuing scheme.Since queues are OPNET objects they are a convenience during the debugging. You can find out detailed information about a queue interactively in OPNET Debugger (ODB) with no development. Though this causes a small overhead, it is an issue only when there are a large number of them. To trace lists in ODB, you would have to write custom traces.Subqueues have built-in statistics such as queue size, queue delay, etc. These statistics can help you gain insight into the each subqueue activity. To accomplish this with lists, you'd have to create and calculate the statistics manually using Stathandles.In brief, both List and Queue/Subqueue packages in OPNET come with a rich set of Kernel Procedures (KPs) to help you handle them effectively. However, the Queue/Subqueue package is much more specialized for queue-related tasks. For example, the subqueue package in OPNET comes with KPs that help determine the whether the subqueue is full (since it may have a fixed size as opposed to list) and handle the condition appropriately. A list is good for dealing with a collection of items, but a queue is specifically designed for those who wish to model a packet queue.Rather than write your own lists from scratch, you can use the OMS Buffer package, as documented in the General Models manual, chapter OMS.You can also use the oms_buffer model support package (available in <models>/std/utilities/oms directory) to implement queues in your system.The oms_buffer uses the built-in list package and allows you to dynamically create queues during simulation (including hierarchical queues). To refer to an example on its usage, take a look at the various places in the standard models (e.g., IP and ATM) where the oms_buffer package is used (you can grep/find in files for oms_buffer in the standard model directories to get more references). There is also an example process model -- oms_buffer_pool_demo that provides a simple example.

Environment

DES Kernel->Process Modeling/Coding

Attachments
NOTICE: Riverbed® product names have changed. Please refer to the Product List for a complete list of product names.
Can't find an answer? Create a case