DOC PREVIEW
CMU CS 15744 - Problem

This preview shows page 1-2-3 out of 9 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Carnegie MellonComputer Science Department.15-744 Spring 2007 Problem Set 2This problem set has 4 questions (each with several parts). Answer them as clearly and concisely aspossible. You may discuss ideas with others in the class, but your solutions and writeup must be your own.If you do discuss at length with others, please mention in your solution for the problem who you collaboratedwith. Do not look at anyone else’s solutions or copy them from anywhere.This assig nment is due by 5:00pm, Monday, March 5th either in class or to the course secretary inWean Hall 8018 .In the first two parts, you will use ns. In the third part, you will examine some BGP tables. Althoughthe first question is long, it is not difficult; it is designed to help you learn the basics of ns.A NS Tutorial1. ns is a network simulator that will be use ful in ho meworks, the class pr oject and in networks researchin general.The purpose of this ques tion is to give you a gentle introdution to using ns and to make you familiarwith the ns manual (http://www.isi.edu/nsnam/ns/ns-documentation.html).A.1 Setting UpHere’s what you need to do before you star t this question:1. Download and Install nsDownload ns-allinone from the ns-2 ho mepage. This version of ns contains all the components youneed, including the Tcl interpreter. We recommend using this “build-it-all-at-once” approach notonly because it is less hassle-free than to build ns from its constituent pieces; but also because youmight get different results or problems if you use a different version of ns or the Tcl interpreter.Visit http://www.isi.edu/ ns nam/ns/ns-build.html#allinone for instructions to install ns. Makesure you have enough disk space on your machine: to build ns you will need around 250 Mb.A version of the ns-all-in-one package has been posted to the course webpag e , with install scriptsmodified, that should easily compile on any facilitized cs machine running Linux. If you don’thave access to such a machine, please email Jeff ([email protected]) and he will get you anaccount on one.2. Starting nsAfter installation, you can start ns with the command ‘ns <tclscript>’ (assuming that you are in thedirectory with the ns executable, or that your pa th points to that directory), where ‘<tclscript>’ isthe name of a Tcl script file which defines the simulation scenario (i.e. the topology and the events).This will be more clear as you go along. You could also just start ns without any arguments (nswill return a % prompt on most systems) and enter the Tcl comma nds in the Tcl shell but that isdefinitely less comfortable.3. Understanding OtclThis problem will be easier if you have a basic understanding of Otcl.http://www.isi.edu/ ns nam/otcl/doc/tutorial.html gives a short introduction to Otcl for C++ pro-grammers, which you might want to read if you are not familiar with Otcl.4. Hand in answers to the questions in boxes. Hand in printouts of the tcl files you write for questio nsthat request it.A.2 A brief overview of nsns is an event-driven object-oriented simulator, written in C++, with an Otcl interpreter as a front-end.This means that most of your simulation scripts will be written in Tcl. If you want to develop newcomponents for ns you might have to use both Tcl and C++.ns uses two languages be c ause any network simulator, in general, has two different kinds of things itneeds to do. On the one hand, detailed simulations of protoc o ls requires a systems programming languagewhich can efficiently manipulate bytes, packet headers, and implement algorithms that run over largedata 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. On the other hand, a large part of network research involvesslightly varying parameters or c onfigurations, or quickly exploring a number of scena rios. In these cases,iteration time (change the model and re-run) is more important. Since configur ation runs once (at thebeginning of the simulation), r un- time of this part of the task is less important.ns meets both of these needs with two langua ges, C++ and Otcl. C++ is fast to run but slower tochange, making it suitable for detailed protocol implementation. Otcl runs much slower but can bechanged very quickly (and interactively), making it ideal for simulation configuration. ns (via tclcl)provides glue to make objects and variables appear on both languages.In the first part of this assignment, you will learn how to w rite simulation scripts for ns. In the secondpart of the ass ignment, you will write new components for ns to extend the functionality of ns.A.3 A simple exampleFigure 1 shows a simple example of an ns script. E ven without knowing ns you might be able to guesswhat the script is doing: it creates two nodes and connects them with a link. Then, 1 second aftersimulation begins it starts a constant-bit-rate source on one of the nodes. The sourc e stops after 4.5seconds and after 5 seconds the entire simulation is stopped.In the next couple of sections we will examine the individual components of a typical ns script like theone in Figure 1.A.4 How to start: A template for ns scriptsIn this section you are going to write a template that you can use for all your simulation scr ipts.A simulation in ns is described by a Tcl class Simulator. A simulation script, therefo re, generallybegins by creating an instance of this class. This is done with the commandset ns [new Simulator]After cre ating the simulator object a simulation script usually calls various methods to create nodes andtopologies. We will see in Section A.5 how exactly this is done. Next we have to define what e xactly wewant to happen in the simulation. Since the ns simulator is an event-driven simulator this is done byscheduling events: when creating a simulator o bject a scheduler is created which runs by selecting thenext ea rliest event, executing it to completion, and returning to execute the next event. An event canfor exa mple b e the sending of data from o ne node to another node or the failure of a link. T he commandto schedule an event is$ns at <time in sec> <event>After scheduling all the e vents being scheduled we are ready to start the simulator:Page 2set ns [new Simulator] # instantiate simulator objset nf [open out.nam w] # file to write sim trace to$ns namtrace-all $nfproc finish {} { # called at end of simglobal ns nf$ns flush-traceclose $nfexec nam out.nam & #


View Full Document

CMU CS 15744 - Problem

Documents in this Course
Lecture

Lecture

25 pages

Lecture

Lecture

10 pages

Lecture

Lecture

10 pages

Lecture

Lecture

45 pages

Lecture

Lecture

48 pages

Lecture

Lecture

19 pages

Lecture

Lecture

97 pages

Lecture

Lecture

39 pages

Lecture

Lecture

49 pages

Lecture

Lecture

33 pages

Lecture

Lecture

21 pages

Lecture

Lecture

52 pages

Lecture

Lecture

6 pages

03-BGP

03-BGP

13 pages

Lecture

Lecture

42 pages

lecture

lecture

54 pages

lecture

lecture

21 pages

Lecture

Lecture

18 pages

Lecture

Lecture

18 pages

Lecture

Lecture

58 pages

lecture

lecture

17 pages

lecture

lecture

46 pages

Lecture

Lecture

72 pages

Lecture

Lecture

44 pages

Lecture

Lecture

13 pages

Lecture

Lecture

22 pages

Lecture

Lecture

48 pages

lecture

lecture

73 pages

17-DNS

17-DNS

52 pages

Lecture

Lecture

10 pages

lecture

lecture

53 pages

lecture

lecture

51 pages

Wireless

Wireless

27 pages

lecture

lecture

14 pages

lecture

lecture

18 pages

Lecture

Lecture

16 pages

Lecture

Lecture

14 pages

lecture

lecture

16 pages

Lecture

Lecture

16 pages

Lecture

Lecture

37 pages

Lecture

Lecture

44 pages

Lecture

Lecture

11 pages

Lecture

Lecture

61 pages

Multicast

Multicast

61 pages

Lecture

Lecture

19 pages

Lecture

Lecture

8 pages

Lecture

Lecture

81 pages

Lecture

Lecture

9 pages

Lecture

Lecture

6 pages

Lecture

Lecture

63 pages

Lecture

Lecture

13 pages

Lecture

Lecture

63 pages

Lecture

Lecture

50 pages

lecture

lecture

35 pages

Lecture

Lecture

47 pages

Lecture

Lecture

29 pages

Lecture

Lecture

92 pages

Load more
Download Problem
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Problem and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Problem 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?