DOC PREVIEW
USC CSCI 551 - 04_ns-intro

This preview shows page 1-2-3-4-30-31-32-33-34-61-62-63-64 out of 64 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS551NS TutorialSlides Developed by:John [email protected]/ISI1 Computer Communications - CSCI 551 Copyright © William C. Chengsimple modela discrete event simulator2ns-2, the network simulator Computer Communications - CSCI 551 Copyright © William C. Chengwired, wireless, satellitefocused on modeling network protocolsTCP, UDP, multicast, unicastweb, telnet, ftpad hoc routing, sensor networksinfrastructure: stats, tracing, error models, etc.support networking research and education3ns goals Computer Communications - CSCI 551 Copyright © William C. Chengprotocol design, traffic studies, etc.protocol comparisonprovide a collaborative environmentfreely distributed, open sourceshare code, protocols, models, etc.allow easy comparision of similar protocolsincrease confidence in resultsmore people look at models in more situationsexperts develop modelsmultiple levels of detail in one simulatorBegan as REAL in 19894ns history Computer Communications - CSCI 551 Copyright © William C. Chengns by Floyd and McCanne at LBLns-2 by McCanne and the VINT project (LBL, PARC, UCB,USC/ISI)currently maintained at USC/ISI, with input from Floyd et al.ns, the simulator itself5"ns" components Computer Communications - CSCI 551 Copyright © William C. Chengvisualize ns (or other) outputnam, the Network AniMatorGUI input simple ns scenariostraffic and topology generatorspre-processing:simple trace analysis, often in Awk, Perl, or Tclpost-processing:web, FTP, telnet, constant-bit rate, Real AudioTraffic models and applications:6ns models Computer Communications - CSCI 551 Copyright © William C. Chengunicast: TCP (Reno, Vegas, etc.), UDPTransport protocols:multicast: SRMwired routing, ad hoc rtg and directed diffusionRouting and queueing:queueing protocols: RED, drop-tail, etc.wired (point-to-point, LANs), wireless (multiplepropagation models), satellitePhysical media:platforms: basically all Unix and Windows7ns status Computer Communications - CSCI 551 Copyright © William C. Chengsize: about 200k loc each C++ and Tcl, 350 page manualuser-base: >1k institutions, >10k usersreleases about every 6 months, plus daily snapshotsConcepts8Outlines Computer Communications - CSCI 551 Copyright © William C. ChengEssentialsGetting StartedFundamental tcl, otcl and nssimulator has list of eventsmodel world as events9Discrete Event Simulation Computer Communications - CSCI 551 Copyright © William C. Chengprocess: take next one, run it, until doneeach event happens in an instant of virtual (simulated)time, but takes an arbitrary amount of real timens uses simple model: single thread of control => no lockingor race conditions to worry about (very easy)10Discrete Event Examples Computer Communications - CSCI 551 Copyright © William C. ChengA BConsider two nodeson an Ethernet:simplequeuingmodel:t=1:t=1.01: LAN dequeues pktand triggers BA enqueues pkt on LANdetailedCSMA/CDmodel:t=1.0:t=1.005: A’s NIC concludes cs,starts txA sends pkt to NICA’s NIC starts carrier senset=1.006: B’s NIC begins reciving pktt=1.01: B’s NIC concludes pktB’s NIC passes pkt to app11Discrete Event Scheduler Computer Communications - CSCI 551 Copyright © William C. ChengList: simple linked list, order-preserving, O(N)Four types of scheduler:time_, uid_, next_, handler_time_, uid_, next_, handler_handler_->handle()DispatchRescheduleInsertDequeueEventQueueHead_Heap: O(logN)Calendar: hash-based, fastest, default, O(1)Real-time: subclass of list, sync with real-time, O(N)lots of code reuse (ex. TCP + TCP variants)Object oriented:12ns Software Structure: objectorientation Computer Communications - CSCI 551 Copyright © William C. ChengNsObject: has recv() methodSome important objects:Connector: has target() and drop()BiConnector: uptarget() & downtarget()fast to run, detailed, complete controlUses two languages13ns Software Structure: C++ and Otcl Computer Communications - CSCI 551 Copyright © William C. ChengC++ for packet-processingsimulation setup, configuration, occasional actionsOTcl for controlfast to write and changepros: trade-off running vs. writing speed,powerful/documented config languagecons: two languages to learn and debug in14OTcl and C++: The Duality Computer Communications - CSCI 551 Copyright © William C. ChengnsC++ OTclPure C++objectsPure OTclobjectsC++/OTcl split objectsOTcl (object variant of Tcl) and C++ share class hierarchyTclCL is glue library that makes it easy to share functions,variables, etc.ConceptsEssentialsGetting StartedFundamental tcl, otcl and ns15Outlines Computer Communications - CSCI 551 Copyright © William C. Chengdownload ns-allinone (if you have your own machine,do not build this on USC servers)16Installation and Documentation Computer Communications - CSCI 551 Copyright © William C. Chenghttp://www.isi.edu/nsnam/ns/includes Tcl, OTcl, TclCL, ns, nam, etc.mailing list: [email protected] (see url above)Marc Gries tutorialns manualrun ns and nam on ISD machines:~csci551/ns~csci551/namset ns [new Simulator]$ns at 1 "puts \"Hello World!\""$ns at 1.5 "exit"$ns runsimple.tcl:17Hello World Computer Communications - CSCI 551 Copyright © William C. Chengnunki 74% ~csci551/ns simple.tclHello World!nunki 75% Simulator *ns=new Simulator;ns->at(1, "puts \"Hello World!\"");ns->at(1.5, "exit");ns->run();Think C++:create a simulator, put in var nsset ns [new Simulator]18Hello World, Deconstructed Computer Communications - CSCI 551 Copyright © William C. Chengschedule an event at time t=1 to print HW$ns at 1 "puts \"Hello World!\""and exit at a later time$ns at 1.5 "exit"run time simulator$ns runConceptsEssentialsGetting StartedFundamental tcl, otcl and ns19Outlines Computer Communications - CSCI 551 Copyright © William C. Chengset x 10puts "x is $x"variables:20Basic Tcl Computer Communications - CSCI 551 Copyright © William C. Chengset y [pow x 2]set y [expr x*x]functions and expressions:if {$x > 0} { return $x }else { return [expr -$x] }while { $x > 0 } { puts $x incr x -1}control flow:proc pow {x n} { if {$n == 1} { return $x } set part [pow x [expr $n-1]] return [expr $x*$part]}procedures:Also lists, associative arrays, etc.can use a real programminglanguage to build networktopologies, traffic models, etc.⇒21Basic otcl Computer Communications - CSCI 551 Copyright © William C. ChengClass Person# constructor:Person instproc init {age} { $self instvar age_ set age_ $age}# method:Person instproc greet {} { $self instvar age_ puts "$age_ years old: How are


View Full Document

USC CSCI 551 - 04_ns-intro

Download 04_ns-intro
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 04_ns-intro 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 04_ns-intro 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?