📄 node6.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>3.1 Concept Overview</TITLE><META NAME="description" CONTENT="3.1 Concept Overview"><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="node7.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node7.html"><LINK REL="previous" HREF="node5.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node5.html"><LINK REL="up" HREF="node5.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node5.html"><LINK REL="next" HREF="node7.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node7.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html1234" HREF="node7.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node7.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html1228" HREF="node5.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node5.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html1222" HREF="node5.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node5.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html1230" 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="tex2html1232" 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="tex2html1235" HREF="node7.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node7.html">3.2 Code Overview</A><B> Up:</B> <A NAME="tex2html1229" HREF="node5.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node5.html">3. OTcl Linkage</A><B> Previous:</B> <A NAME="tex2html1223" HREF="node5.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node5.html">3. OTcl Linkage</A>   <B> <A NAME="tex2html1231" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html1233" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H1><A NAME="SECTION02110000000000000000">3.1 Concept Overview</A></H1><P><I>Why two languages?</I> uses two languages because simulator has two different kinds of things it needs to do.On one hand, detailed simulations of protocols requires a systems programming language which can efficiently manipulate bytes, packet headers, and implement algorithms that run over large data sets.For these tasks run-time speed is important and turn-around time (run simulation, find bug, fix bug, recompile, re-run) is less important.<P>On the other hand, a large part of network research involves slightly varying parameters or configurations, or quickly exploring a number of scenarios.In these cases, iteration time (change the model and re-run) is more important.Since configuration runs once (at the beginning of the simulation), run-time of this part of the task is less important.<P>meets both of these needs with two languages, C++ and OTcl.C++ is fast to run but slower to change, making it suitable for detailed protocol implementation.OTcl runs much slower but can be changed very quickly (and interactively), making it ideal for simulation configuration. (via <TT>tclcl</TT>) provides glue to make objects and variables appear on both langauges.<P>For more information about the idea of scripting languages and split-language programming, see Ousterhout's article in IEEE Computer [<A HREF="node589.html#Ousterhout98a" tppabs="http://www.isi.edu/nsnam/ns/doc/node589.html#Ousterhout98a">27</A>].For more information about split level programming for network simulation, see the ns paper [<A HREF="node589.html#Bajaj99a" tppabs="http://www.isi.edu/nsnam/ns/doc/node589.html#Bajaj99a">2</A>].<P><I>Which language for what?</I>Having two languages raises the question of which language shouldbe used for what purpose.<P>Our basic advice is to use OTcl:<UL><LI>for configuration, setup, and ``one-time'' stuff</LI><LI>if you can do what you want by manipulating existing C++ objects</LI></UL><P>and use C++:<UL><LI>if you are doing <I>anything</I> that requires processing each packet of a flow</LI><LI>if you have to change the behavior of an existing C++ class in ways that weren't anticipated</LI></UL><P>For example, links are OTcl objects that assemble delay, queueing, andpossibly loss modules. If your experiment can be done with thosepieces, great. If instead you want do something fancier (a specialqueueing dicipline or model of loss), then you'll need a new C++object.<P>There are certainly grey areas in this spectrum:most routing is done in OTcl(although the core Dijkstra algorithm is in C++).We've had HTTP simulations where each flow was started in OTcl and per-packet processing was all in C++.This approache worked OK until we had 100s of flows starting per second of simulated time.In general, if you're ever having to invoke Tcl many times per second, you problably should move that code to C++.<P><HR><!--Navigation Panel--><A NAME="tex2html1234" HREF="node7.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node7.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html1228" HREF="node5.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node5.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html1222" HREF="node5.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node5.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html1230" 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="tex2html1232" 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="tex2html1235" HREF="node7.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node7.html">3.2 Code Overview</A><B> Up:</B> <A NAME="tex2html1229" HREF="node5.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node5.html">3. OTcl Linkage</A><B> Previous:</B> <A NAME="tex2html1223" HREF="node5.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node5.html">3. OTcl Linkage</A>   <B> <A NAME="tex2html1231" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html1233" 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 + -