?? plm.tex
字號:
\subsection{Instantiation of a PLM Source}To create a PLM source, place it at node \code{n}, and start it at {\tt t$_0$}, we callthe PLMTopology instproc {\tt place\_source n t$_0$}. This instproc return {\ttaddr}, the address required to attach a receiver to this source. {\ttplace\_source} calls the Simulator instproc \code{PLMbuild_source_set} thatcreates as many Application/Traffic/CBR\_PP instances as there are layers (in the following we call aninstance of the class Application/Traffic/CBR\_PP a layer). Each layer corresponds to adifferent multicast group. To speed up the simulations when the PLM sources start we use thefollowing trick:At $t=0$, \code{PLMbuild_source_set} restricts eachlayer to sendonly one packet ({\tt maxpkts\_} set to 1). That allows to build the multicast trees-- one multicast tree per layer -- without flooding the whole network. Indeed,each layer only sends one packet to build the corresponding multicast tree. The multicast trees take at most the maximum RTT of the network to be established andmust be established before {\tt t$_0$}, the PLM source starting time. Therefore,{\tt t$_0$} must be carrefully chosen, otherwise the source sends a large number of useless packets. However, as we just need to start the PLM source after the multicast trees are estabished,{\tt t$_0$} can be largely overestimated. At time {\tt t$_0$}, we set {\it maxpkts\_} to 268435456 for all the layers.It is fundamental, in order to have persistent multicast trees, that theprune timeout is set to a large value. For instance, with DM routing: \begin{program} DM set PruneTimeout 1000\end{program}Each layer of a same PLM source has the same flow id {\tt fid\_}. Consequently,each PLM source is considered as a single flow for a Fair Queueingscheduler. The PLM code manages automatically the {\tt fid\_} to prevent differentsources to have the same {\tt fid\_}. The {\tt fid\_} starts at 1 for the firstsource and is increased by one for each new source. Be careful to avoid otherflows (for instance concurrent TCP flows) to have the same {\tt fid\_} than thePLM sources. Additionally, If you consider {\tt fid\_} larger than 32, do notforget to increase the {\tt MAXFLOW} in \nsf{fq.cc} ({\tt MAXFLOW} must be setto the highest {\tt fid\_} considered in the simulation).\subsection{Instantiation of a PLM Receiver}\begin{figure}[tbp] \centerline{\includegraphics{figures/instanPLMrecv.eps}} \caption{Inheritance and instantiation when we create a receiver.} \label{fig:instanPLMrecv}\end{figure}All the PLM machinery is implemented at the receiver. In this section we decribethe instantiation process of a receiver. To create, place at node{\tt n}, attach to source {\tt S}, and start at {\tt t$_1$} a PLM receiver wecall the PLMTopology instproc {\tt build\_receiver n addr t$_1$ C} where {\tt addr} is the address returnedby {\tt place\_source} when {\tt S} was created, and {\tt C} is the check value. Thereceiver created by {\tt build\_receiver} is an instance of the class PLM/ns,the ns interface to the PLM machinery. At the initialisation of the receiver, the PLM instproc {\tt init} iscalled due to inheritance. {\tt init} calls the PLM/ns instproc{\tt create-layer} and, by this way, creates as many instances of the class PLMLayer/ns (the ns interface to the PLMLayer class) as there are layers. Eachinstance of PLMLayer/ns creates an instance of the class PLMLossTrace which isreponsible for monitoring the received and lost packets thanks to the fact that the classPLMLossTrace inherits from the class Agent/LossMonitor/PLM. Fig.~\ref{fig:instanPLMrecv} schematically describes the process of a PLMreceiver instantiation. In the following we describe the behavior of a PLMreceiver when it receives a packet and when it detects a loss.\subsection{Reception of a Packet}\label{sec:PLMReception-Packet}We create a new c++ class PLMLossMonitor (\nsf{plm/loss-monitor-plm.cc}) thatinherits from LossMonitor. The OTcl class name of the c++ PLMLossMonitor class isAgent/LossMonitor/PLM.\begin{program}class PLMLossMonitor : public LossMonitor {public: PLMLossMonitor(); virtual void recv(Packet* pkt, Handler*);protected: // PLM only int flag_PP_; double packet_time_PP_; int fid_PP_;};static class PLMLossMonitorClass : public TclClass {public: PLMLossMonitorClass() : TclClass("Agent/LossMonitor/PLM") {} TclObject* create(int, const char*const*) { return (new PLMLossMonitor()); }} class_loss_mon_plm;\end{program}We add in {\tt void PLMLossMonitor::recv(Packet* pkt, Handler*)} a Tcl call to the Agent/LossMonitor/PLM instproc {\tt log-PP} each time a packet is received :\begin{program} void LossMonitor::recv(Packet* pkt, Handler*) { ... if (expected_ >= 0) { ... } Tcl::instance().evalf("%s log-PP", name()); }\end{program}The Agent/LossMonitor/PLM instproc {\tt log-PP} is empty. In fact, we define the {\tt log-PP} instproc for the class PLMLossTrace. {\tt log-PP}computes an estimate of the available bandwidth based on a single PP burst (oflength {\tt PP\_burst\_length} in packets). Once {\tt log-PP} has received the {\tt PP\_burst\_length} packets of the burst, it computes the estimate and calls the PLM instproc {\tt make\_estimate} with the computed estimate as argument. {\tt make\_estimate} puts the estimate based on a single PP({\tt PP\_value}) in an array of estimate samples ({\tt PP\_estimate}). If {\tt PP\_value} is lower than the current subscription level (i.e.~lower than thethroughput achieved according to the current number of layers subscribed), {\tt make\_estimate} calls the PLM instproc {\tt stability-drop} which simply dropslayers until the current subscription level becomes lower than {\tt PP\_value}.{\tt make\_estimate} makes an estimate {\tt PP\_estimate\_value} by taking theminimum {\tt PP\_value} received during the last {\tt check\_estimate} period(if there are atleast {\tt PP\_estimation\_length} single PP estimate received). Once {\tt make\_estimate} has a {\tt PP\_estimate\_value} it calls the PLM instproc {\tt choose\_layer} which joins or drops layer(s) according to the current subscriptionlevel and to the {\tt PP\_estimate\_value}. For details about the PLM instproc\code{make_estimate}, refer to its code in \nsf{tcl/plm/plm.tcl}.\subsection{Detection of a Loss}Each time a loss is detected by an instance of the class PLMLossMonitor, a call tothe Agent/LossMonitor/PLM instproc {\tt log-loss} is triggered. TheAgent/LossMonitor/PLM instproc {\tt log-loss} is empty. In fact, we define the {\tt log-loss} instproc for the classPLMLossTrace. The PLMLossTrace instproc {\tt log-loss} simplycalls the PLM instproc {\tt log-loss} which contains the PLM machinery in caseof loss. In summary, {\tt log-loss} only drops a layer when the loss rateexceeds 10\% (this test is executed by the PLM instproc {\tt exeed\_loss\_thresh}). After a layer drop {\tt log-loss} precludes anyother layer drop due to loss for 500ms. For details about the PLM instproc {\tt log-loss}, refer to its code in \nsf{tcl/plm/plm.tcl}. \subsection{Joining or Leaving a Layer}To join a layer the PLM instproc {\tt add-layer} is called. This instproccalls the PLMLayer instproc {\tt join-group} which calls the PLMLayer/ns instproc {\tt join-group}.To leave a layer the PLM instproc {\tt drop-layer} is called. This instproccalls the PLMLayer instproc {\tt leave-group} which calls the PLMLayer/ns instproc {\tt leave-group}.\section{Commands at a Glance}Note: This section is a copy paste of the end ofsection~\ref{sec:Configuration}. We add this section to preserve homogeneity withthe ns manual.All the simulations for PLM should be set using the PLMTopology environment (asin the example script where we define a PLMTopology superclass called Scenario0). Theuser interface is (all the instproc can be found in \nsf{tcl/plm/plm-topo.tcl}):\begin{description}\item[\tt build\_link a b d bw] creates a duplex link between node \code{a} and \code with a delay \codellhvpzh and a bandwidth \code{bw}. If either node does not exist, \code{build_link} creates it.\item[\tt place\_source n t] creates and places a PLM source at node \code{n} and starts it at time \code{t}. \code{place_source} returns \code{addr} which allows to attach receivers to this source.\item[\tt place\_receiver n addr C nb] creates and places a PLM receiver at node \code{n} and attached it to the source which return the address \code{addr}. The check value for this PLM receiver is \code{C}. An optional parameter \code{nb} allows to get an instance of the PLM receiver called \code{PLMrcvr($nb)}. This instance is only useful to get some specific statistics about this receiver (mainly the number of packets received or lost). %$\end{description}}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -