Priority Queue¶
The PriorityQueue module is a compound module that implements priority queueing with the help of a classifier submodule, multiple queues and a scheduler.
It contains a configurable number of PacketQueue’s. A PacketClassifier module classifies packets into the queues according to the configured packet classifier function. A PriorityScheduler pops packets from the first non-empty queue, thus earlier queues have a priority over the later ones.
In this example network, packets are produced at random intervals by an active packet source (ActivePacketSource). The source is connected to a priority queue (PriorityQueue) with two inner queues (PacketQueue). The packets are collected at random intervals by an active packet sink (ActivePacketSink).
network PriorityQueueTutorialStep
{
@display("bgb=600,200");
submodules:
producer: ActivePacketSource {
@display("p=100,100");
}
queue: PriorityQueue {
@display("p=300,100");
}
collector: ActivePacketSink {
@display("p=500,100");
}
connections allowunconnected:
producer.out --> queue.in;
queue.out --> collector.in;
}
[Config PriorityQueue]
network = PriorityQueueTutorialStep
sim-time-limit = 10s
*.producer.packetLength = 1B
*.producer.productionInterval = uniform(0s, 2s)
*.queue.numQueues = 2
*.queue.classifier.typename = "WrrClassifier"
*.queue.classifier.weights = "1 1"
*.collector.collectionInterval = uniform(0s, 2s)