📄 node447.html
字号:
<html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with jLaTeX2HTML 2002 (1.62) JA patch-1.4patched version by: Kenshi Muto, Debian Project.LaTeX2HTML 2002 (1.62),original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>33.5.0.0.1 Request Mechanisms</TITLE><META NAME="description" CONTENT="33.5.0.0.1 Request Mechanisms"><META NAME="keywords" CONTENT="everything"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="everything.css" tppabs="http://www.isi.edu/nsnam/ns/doc/everything.css"><LINK REL="next" HREF="node448.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node448.html"><LINK REL="previous" HREF="node446.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node446.html"><LINK REL="up" HREF="node446.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node446.html"><LINK REL="next" HREF="node448.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node448.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html8261" HREF="node448.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node448.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html8255" HREF="node446.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node446.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html8249" HREF="node446.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node446.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html8257" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html8259" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html8262" HREF="node448.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node448.html">33.5.0.0.2 Repair Mechanisms</A><B> Up:</B> <A NAME="tex2html8256" HREF="node446.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node446.html">33.5 Loss Recovery Objects</A><B> Previous:</B> <A NAME="tex2html8250" HREF="node446.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node446.html">33.5 Loss Recovery Objects</A>   <B> <A NAME="tex2html8258" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html8260" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H4><A NAME="SECTION06450010000000000000">33.5.0.0.1 Request Mechanisms</A></H4>SRM agents detect loss when they receive a message, andinfer the loss based on the sequence number on the message received.Since packet reception is handled entirely by the compiled object,loss detection occurs in the C++ methods.Loss recovery, however, is handled entirely by instance proceduresof the corresponding interpreted object in OTcl.<P>When any of the methods detects new losses, it invokes[]Agent/SRM::request../ns-2/srm.tclAgent/SRM::requestwith a list of the message sequence numbers that are missing.[]request will create a new <TT>requestFunction_</TT>object for each message that is missing.The agent stores the object handle in its array of <TT>pending_</TT> objects.The key to the array is the message identifier sender:msgid.<UL><LI>The default <TT>requestFunction_</TT> is SRM/request. The constructor for the class SRM/request calls the base class constructor to initialize the simulator instance (<TT>ns_</TT>), the SRM agent (<TT>agent_</TT>), trace file (<TT>trace_</TT>), and the <TT>times_</TT> array. It then initializes its <TT>statistics_</TT> array with the pertinent elements.<P></LI><LI>A separate call to []set-params../ns-2/srm.tclSRM::set-params sets the <TT>sender_</TT>, <TT>msgid_</TT>, <TT>round_</TT> instance variables for the request object. The object determines <TT>C1_</TT> and <TT>C2_</TT> by querying its <TT>agent_</TT>. It sets its distance to the sender (<TT>times_(distance)</TT>) and fixes other scheduling parameters: the backoff constant (<TT>backoff_</TT>), the current number of backoffs (<TT>backoffCtr_</TT>), and the limit (<TT>backoffLimit_</TT>) fixed by the agent. []set-params writes the trace entry ``<SMALL>Q DETECT</SMALL>''.<P></LI><LI>The final step in []request is to schedule the timer to send the actual request at the appropriate moment. The instance procedure []SRM/request::schedule../ns-2/srm.tclSRM/request::schedule uses []compute-delay../ns-2/srm.tclSRM/request::compute-delay and its current backoff constant to determine the delay. The object schedules []send-request../ns-2/srm.tclSRM/request::send-request to be executed after <TT>delay_</TT> seconds. The instance variable <TT>eventID_</TT> stores a handle to the scheduled event. The default []compute-delay function returns a value uniformly distributed in the interval <!-- MATH $[C_1 d_s, (C_1 + C_2) d_s]$ -->, where is twice <TT>$times_(distance)</TT>. The []schedule schedules an event to send a request after the computed delay. The routine writes a trace entry ``<SMALL>Q NTIMER </SMALL> at time''.</LI></UL><P>When the scheduled timer fires, the routine[]send-request../ns-2/srm.tclSRM/request::send-requestsends the appropriate message.It invokes ``<TT>$agent_</TT> send request args'' to send the request.Note that []send is an instproc-like,executed by the []command method of the compiled object.However, it is possible to overload the instproc-likewith a specific instance procedure []sendfor specific configurations.As an example, recall that the file <TT>tcl/mcast/srm-nam.tcl</TT>overloads the []send commandto set the flowid based on type of message that is sent.[]send-request updates the statistics, and writes the trace entry``<SMALL>Q SENDNACK</SMALL>''.<P>When the agent receives a control message for a packetfor which a pending object exists,the agent will hand the message off to the object for processing.<UL><LI>When a request for a particular packet is received../ns-2/srm.tclSRM/request::recv-request, the request object can be in one of two states: it is ignoring requests, considering them to be duplicates, or it will cancel its send event and re-schedule another one, after having backed off its timer. If ignoring requests it will update its statistics, and write the trace entry ``<SMALL>Q NACK </SMALL> dup''. Otherwise, set a time based on its current estimate of the <TT>delay_</TT>, until which to ignore further requests. This interval is marked by the instance variable <TT>ignore_</TT>. If the object reschedules its timer, it will write the trace entry `` <SMALL>Q NACK IGNORE-BACKOFF </SMALL> ignore''. Note that this re-scheduling relies on the fact that the agent has joined the multicast group, and will therefore receive a copy of every message it sends out.<P></LI><LI>When the request object receives a repair for the particular packet../ns-2/srm.tclSRM/request::recv-repair, it can be in one of two states: either it is still waiting for the repair, or it has already received an earlier repair. If it is the former, there will be an event pending to send a request, and <TT>eventID_</TT> will point to that event. The object will compute its serviceTime, cancel that event, and set a hold-down period during which it will ignore other requests. At the end of the hold-down period, the object will ask its agent to clear it. It will write the trace entry ``<SMALL>Q REPAIR IGNORES </SMALL> ignore''. On the other hand, if this is a duplicate repair, the object will update its statistics, and write the trace entry ``<SMALL>Q REPAIR </SMALL> dup''.</LI></UL><P>When the loss recovery phase is completed by the object,[]Agent/SRM::clear../ns-2/srm.tclAgent/SRM::clearwill remove the object from its array of <TT>pending_</TT> objects,and place it in its list of <TT>done_</TT> objects.Periodically, the agent will cleanup and delete the <TT>done_</TT> objects.<P><HR><!--Navigation Panel--><A NAME="tex2html8261" HREF="node448.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node448.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html8255" HREF="node446.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node446.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html8249" HREF="node446.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node446.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html8257" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html8259" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html8262" HREF="node448.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node448.html">33.5.0.0.2 Repair Mechanisms</A><B> Up:</B> <A NAME="tex2html8256" HREF="node446.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node446.html">33.5 Loss Recovery Objects</A><B> Previous:</B> <A NAME="tex2html8250" HREF="node446.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node446.html">33.5 Loss Recovery Objects</A>   <B> <A NAME="tex2html8258" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html8260" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <!--End of Navigation Panel--><ADDRESS>2003-09-23</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -