Table Of Contents
Table Of Contents

Priority Scheduler

This step demonstrates the PriorityScheduler module. The module pops packets from the first connected non-empty queue or packet provider.

In this example network, two active packet sources (ActivePacketSource) generate packets in random periods. The packets are pushed into queues (PacketQueue), where they are stored temporarily. The queues are connected to a priority scheduler (PriorityScheduler). An active packet sink (ActivePacketSink) pops packets from the scheduler, which in turn pops packets from one of the queues in a prioritized way, favoring the first queue.

network PrioritySchedulerTutorialStep
{
    @display("bgb=850,300");
    submodules:
        producer1: ActivePacketSource {
            @display("p=100,100");
        }
        producer2: ActivePacketSource {
            @display("p=100,225");
        }
        queue1: PacketQueue {
            @display("p=325,100");
        }
        queue2: PacketQueue {
            @display("p=325,225");
        }
        scheduler: PriorityScheduler {
            @display("p=550,100");
        }
        collector: ActivePacketSink {
            @display("p=750,100");
        }
    connections allowunconnected:
        producer1.out --> queue1.in;
        producer2.out --> queue2.in;
        queue1.out --> scheduler.in++;
        queue2.out --> scheduler.in++;
        scheduler.out --> collector.in;
}
[Config PriorityScheduler]
network = PrioritySchedulerTutorialStep
sim-time-limit = 10s

*.producer*.packetLength = 1B
*.producer*.productionInterval = uniform(0s, 2s)
*.collector.collectionInterval = uniform(0s, 1s)