📄 new_queue.html
字号:
<html><head><title>Add New Queue</title></head><body background="parchment.gif" tppabs="http://nile.wpi.edu/NS/Icons/parchment.gif" text="#000000" link="#0000FF"vlink="#000080" alink="#FF0000"><br><center><h2>Add New Queue</h2></center><center><h3>(Tested with ns-2.1b8a, ns-2.1b9a and ns-2.26)</h3></center><br><br><li><b>Objective</b></li><p>To build a simple drop-tail router output queue that uses around-robin dequeue scheduling for priority 15 packets (from a "MmApp"over "UDPmm") and the other packets in the queue. That is, whilepriority 15 packets and other packets coexist in the queue, itdequeues the oldest packets of each type one by one in turn. </p><br><li><b>Design</b></li><p>The queue has two logical FIFO queues, say LQ1 and LQ2, of whichthe 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 apacket 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 beenqueued to an appropriate logical queue. To implement the round-robindequeue scheduling, the dequeue manager tries to dequeue one packetfrom a logical queue and the next one from the other logical queue inturn. I.e. packets in the two logical queues are dequeued at 1:1 ratioif both queues have packets.</p><br><li><b>Implementation</b></li><p>We named the C++ name for this queue object "<fontcolor=RED>DtRrQueue</font>" (Drop-Tail Round-Robin Queue) that isderived from "<font color=BLUE>Queue</font>" class. The matching OTclname is "<font color=GREEN>Queue/DTRR</font>". When the "recv" memberfunction that is implemented in the "Queue" class (in "queue.cc")receives a packet, it invokes the "enqueue" member function of thequeue object and invokes "dequeue" if the link object is notblocked. When the link came from a blocked state, it also calls the"dequeue" member function of its queue object. Therefore, we needed towrite "<font color=PURPLE>enqueue</font>" and "<fontcolor=BROWN>dequeue</font>" member functions of the "DtRrQueue" objectclass. Figure 30 shows the "DtRrQueue" class definition and its"enqueue" and "dequeue" member functions. For the completeimplementation, refer to "<ahref="dtrr-queue.h.htm" tppabs="http://nile.wpi.edu/NS/Example/dtrr-queue.h">dtrr-queue.h</a>" and "<ahref="dtrr-queue.cc" tppabs="http://nile.wpi.edu/NS/Example/dtrr-queue.cc">dtrr-queue.cc</a>" files. Since the codesare really easy to understand, no further explanation is given.</p><p align="center"><img src="fig30.gif" tppabs="http://nile.wpi.edu/NS/Figure/fig30.gif"><br><br><b>Figure 30.</b> "DtRrQueue" class implementation</p><br><li><b>Test Simulation</b></li><p>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 <a href="ex-dtrr-queue.tcl" tppabs="http://nile.wpi.edu/NS/Example/ex-dtrr-queue.tcl">this script</a> and test your newly added queue components.</p><p align="center"><a href="ex-dtrr-queue.tcl" tppabs="http://nile.wpi.edu/NS/Example/ex-dtrr-queue.tcl"><img src="fig31.gif" tppabs="http://nile.wpi.edu/NS/Figure/fig31.gif" border=1 alt="ex-dtrr-queue.tcl"></a><br><br><b>Figure 31.</b> "DtRrQueue" test simulation script </p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -