Add New Queue
Objective
To build a simple drop-tail router output queue that uses a round-robin dequeue scheduling for priority 15 packets (from a "MmApp" over "UDPmm") and the other packets in the queue. That is, while priority 15 packets and other packets coexist in the queue, it dequeues the oldest packets of each type one by one in turn.
Design
The queue has two logical FIFO queues, say LQ1 and LQ2, of which the total size is equal to the size of physical queue (PQ), i.e. LQ1 + LQ2 = PQ. To implement a normal drop-tail enqueue behavior, when a packet is to be enqueued, the enqueue manager checks if size of LQ1 + LQ2 is less than maximum allowed PQ size. If so, the packet will be enqueued to an appropriate logical queue. To implement the round-robin dequeue scheduling, the dequeue manager tries to dequeue one packet from a logical queue and the next one from the other logical queue in turn. I.e. packets in the two logical queues are dequeued at 1:1 ratio if both queues have packets.
Implementation
We named the C++ name for this queue object "DtRrQueue" (Drop-Tail Round-Robin Queue) that is derived from "Queue" class. The matching OTcl name is "Queue/DTRR". When the "recv" member function that is implemented in the "Queue" class (in "queue.cc") receives a packet, it invokes the "enqueue" member function of the queue object and invokes "dequeue" if the link object is not blocked. When the link came from a blocked state, it also calls the "dequeue" member function of its queue object. Therefore, we needed to write "enqueue" and "dequeue" member functions of the "DtRrQueue" object class. Figure 30 shows the "DtRrQueue" class definition and its "enqueue" and "dequeue" member functions. For the complete implementation, refer to "
dtrr-queue.h" and "
dtrr-queue.cc" files. Since the codes are really easy to understand, no further explanation is given.
Figure 30. "DtRrQueue" class implementation
Test Simulation
We used the simulation script used for testing "MmApp" over "UDPmm" in the previous section with changing the RED queue to DTRR queue for the link r1-r2. The changes to the script are show in Figure 31. Download
this script and test your newly added queue components.
Figure 31. "DtRrQueue" test simulation script
Hello, i must say that this is a very informative blog, especially for beginners in ns2 like me. I have a question regarding this DtRrQueue object that you have created. I have ns 2.35, will it work with that. Apparently, it doesnt accept it when i run it saying that it is invalid. i cant seem to understand why this is so. can i use this object with sources that dont run this MmApp, because that is what i am trying to do. Run it for simple TCP/FTP sources. What changes should i make to make it run? Your help would be appreciated. Once again, thanks for putting up such an informative blog. cheers.
ReplyDelete