12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>The</strong> default requestFunction_ is class SRM/request <strong>The</strong> co<strong>ns</strong>tructor for the class SRM/request calls thebase class co<strong>ns</strong>tructor to initialize the simul<strong>at</strong>or i<strong>ns</strong>tance (<strong>ns</strong>_), the SRM agent (agent_), trace file (trace_), <strong>and</strong>the times_ array. It then initializes its st<strong>at</strong>istics_ array with the pertinent elements.A separ<strong>at</strong>e call to set-params{} sets the sender_, msgid_, round_ i<strong>ns</strong>tance variables for the request object. <strong>The</strong>object determines C1_ <strong>and</strong> C2_ by querying its agent_. It sets its distance to the sender (times_(distance)) <strong>and</strong>fixes other scheduling parameters: the backoff co<strong>ns</strong>tant (backoff_), the current number of backoffs (backoffCtr_),<strong>and</strong> the limit (backoffLimit_) fixed by the agent. set-params{} writes the trace entry “Q DETECT”.<strong>The</strong> final step in request{} is to schedule the timer to send the actual request <strong>at</strong> the appropri<strong>at</strong>e moment. <strong>The</strong>i<strong>ns</strong>tance procedure SRM/request::schedule{} uses compute-delay{} <strong>and</strong> its current backoff co<strong>ns</strong>tant todetermine the delay. <strong>The</strong> object schedules send-request{} to be executed after delay_ seconds. <strong>The</strong> i<strong>ns</strong>tancevariable eventID_ stores a h<strong>and</strong>le to the scheduled event. <strong>The</strong> default compute-delay{} function retur<strong>ns</strong> avalue uniformly distributed in the interval [C 1 d s , (C 1 + C 2 )d s ], where d s is twice $times_(distance). <strong>The</strong>schedule{} schedules an event to send a request after the computed delay. <strong>The</strong> routine writes a trace entry “QNTIMER <strong>at</strong> 〈time〉”.When the scheduled timer fires, the routine send-request{} sends the appropri<strong>at</strong>e message. It invokes “$agent_ sendrequest 〈args〉” to send the request. Note th<strong>at</strong> send{} is an i<strong>ns</strong>tproc-like, executed by the comm<strong>and</strong>() method of the compiledobject. However, it is possible to overload the i<strong>ns</strong>tproc-like with a specific i<strong>ns</strong>tance procedure send{} for specific configur<strong>at</strong>io<strong>ns</strong>.As an example, recall th<strong>at</strong> the file tcl/mcast/srm-nam.tcl overloads the send{} comm<strong>and</strong> to set the flowidbased on type of message th<strong>at</strong> is sent. send-request{} upd<strong>at</strong>es the st<strong>at</strong>istics, <strong>and</strong> writes the trace entry “Q SENDNACK”.When the agent receives a control message for a packet for which a pending object exists, the agent will h<strong>and</strong> the message offto the object for processing.When a request for a particular packet is received, the request object can be in one of two st<strong>at</strong>es: it is ignoring requests,co<strong>ns</strong>idering them to be duplic<strong>at</strong>es, or it will cancel its send event <strong>and</strong> re-schedule another one, after having backed offits timer. If ignoring requests it will upd<strong>at</strong>e its st<strong>at</strong>istics, <strong>and</strong> write the trace entry “Q NACK dup”. Otherwise, set <strong>at</strong>ime based on its current estim<strong>at</strong>e of the delay_, until which to ignore further requests. This interval is marked bythe i<strong>ns</strong>tance variable ignore_. If the object reschedules its timer, it will write the trace entry “ Q NACK IGNORE-BACKOFF 〈ignore〉”. Note th<strong>at</strong> this re-scheduling relies on the fact th<strong>at</strong> the agent has joined the multicast group, <strong>and</strong>will therefore receive a copy of every message it sends out.When the request object receives a repair for the particular packet, it can be in one of two st<strong>at</strong>es: either it is still waitingfor the repair, or it has already received an earlier repair. If it is the former, there will be an event pending to send arequest, <strong>and</strong> eventID_ will point to th<strong>at</strong> event. <strong>The</strong> object will compute its serviceTime, cancel th<strong>at</strong> event, <strong>and</strong> set ahold-down period during which it will ignore other requests. At the end of the hold-down period, the object will ask itsagent to clear it. It will write the trace entry “Q REPAIR IGNORES 〈ignore〉”. On the other h<strong>and</strong>, if this is a duplic<strong>at</strong>erepair, the object will upd<strong>at</strong>e its st<strong>at</strong>istics, <strong>and</strong> write the trace entry “Q REPAIR dup”.When the loss recovery phase is completed by the object, Agent/SRM::clear{} will remove the object from its arrayof pending_ objects, <strong>and</strong> place it in its list of done_ objects. Periodically, the agent will cleanup <strong>and</strong> delete the done_objects.Repair Mechanisms <strong>The</strong> agent will initi<strong>at</strong>e a repair if it receives a request for a packet, <strong>and</strong> it does not have a request objectpending_ for th<strong>at</strong> packet. <strong>The</strong> default repair object belongs to the class SRM/repair. Barring minor differences, thesequence of events <strong>and</strong> the i<strong>ns</strong>tance procedures in this class are identical to those for SRM/request. R<strong>at</strong>her than outline everysingle procedure, we only outline the differences from those described earlier for a request object.<strong>The</strong> repair object uses the repair parameters, D1_, D2_. A repair object does not repe<strong>at</strong>edly reschedule is timers; therefore, itdoes not use any of the backoff variables such as th<strong>at</strong> used by a request object. <strong>The</strong> repair object ignores all requests for the317

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!