Upload
hoangtu
View
222
Download
0
Embed Size (px)
Citation preview
Part I: NSPart I: NS22 BasicsBasicsPart I: NSPart I: NS22 BasicsBasicsPart I: NSPart I: NS2 2 BasicsBasicsPart I: NSPart I: NS2 2 BasicsBasics
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 1
PPreed
pared
repa
k: T. Issariyaku
yby
at
erwat
NSNS22
Tee
NSNS
ulya
kul
sariy
a
Issa
Part I: OutlineTh B i• The Basics– Simulation of computer networks– Tcl/OTcl Tutorial– Tcl/OTcl Tutorial
• NS2 FundamentalsNS2 Fundamentals– An introduction to NS2– Linkage Between OTcl and C++ in NS2– Random Number Generators– Event Driven Simulation in NS2
NS2 Main Network Components– NS2 Main Network Components
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 2
PPrepare
ddrivn NMain N
repa
k: T. Issariyaku
y
e
by umber
en Sim
at
tw
erwat
Teeto NS2en O
ulya
kul
sariy
a
Issa
orks
Simulation of Computer NetworksSimulation of Computer NetworksSimulation of Computer NetworksSimulation of Computer NetworksSimulation of Computer NetworksSimulation of Computer NetworksSimulation of Computer NetworksSimulation of Computer Networks
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 3
PPreed
pared
repa
k: T. Issariyaku
yby
at rw
atompomomomomomom
Tee
Comomomomomomom
ulya
kul
sariy
a
Issa
Outline• Computer Networks
A Study of Computer Networks• A Study of Computer Networks• Time-Dependent Simulationp• Example
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 4
Preed
pared
repa
k: T. Issariyaku
yby
atNe
erwaer Ne
Simu
Tee
ulya
kul
sariy
a
Issa
Computer Networks• Computer + Networking
NetworkingNetworking
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 5
PPreed
dedededededpa
rededpa
reareeared
paredredare
dar
repa
k: T. Issariyaku
ybybbyby
bybybyby
atat aatatataterw
aterwrwwrw
arw
atrw
atwatwrwatw
TeeTeeTeeTe
ulya
kul
sariy
aks
Issa
Computer Networks• Generally, there are so many tasks• Layering Concept: SeparateLayering Concept: Separate
functionalityOSI M d l TCP/IP M d l– OSI Model - TCP/IP Model
Application
TSession
Presentation
T
Application
Data LinkNetwork
Transport
Data LinkNetwork
Transport
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.PhysicalData Link
PhysicalData Link
6
PPrepk: T
Preped
ddpaDataareaetworkredre
port
PrepPhepa
ep
atayyyyyby
bybybyby
tpara
erwaepar
T
Tee- T
ulya
kul
sariy
aks
Issa
many
A Study of Computer Networks• Suppose you devise a great protocol.
How do you show that it’s great?How do you show that it s great?– Experiment: Put all routers together
d l t l s thand let people use them– Mathematic model: Model routers using
h ha graph theory– Simulation: Use programming (e.g., C++ p g g ( g
or NS2) to represent routers
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 7
Preed
tion
paredS2) t
repa
k: T. Issariyaku
yby heory
: U
at
gt it s
erwat it
all routh
Teese tmode
ulya
kul
sariy
atwork
Issa
eat p
A Study of Computer Networks
Pros Cons
Experiment Realistic Expensive/ Sometime not possible
M h i I i h N d kMathematic Model
Insight Need to make assumptions
Simulation •Easy (Cheap)•Used for verification
Not much insight, sometimes need to
k tiTextbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
make assumption8
PPrepk: T. Issariyaku
parearee
d eedede•Eas
epaa
ep
yyby ght
at
erwatw
TeeT
ulya
kul
sariy
atwork
Issa
IsIsCo
Time-Dependent Simulation
• Most commonly-usedy• Simulation proceeds chronologically.
T i t• Two main types:– Time-Driven Simulation– Event-Driven Simulation
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 9
PPreed
pared
repa
k: T. Issariyaku
ybyriven at
erwatds ch
TeeesSim
ulya
kul
sariy
aulatio
Issa
Time-Driven Simulation• Observe the system at a fixed interval.• Event occurs within an interval is assumed to
occur at the end of the interval• Suppose an interval = � seconds. Then the
simulation proceeds as follows:
– a,b,c,d are eventsi d 2– a is assume to occurred at t= 2�
– b,c are assume to occurred at t=( 5� )• The simulation finishes at a pre specified time
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
• The simulation finishes at a pre-specified time.10
P
ed e e
pared
ume toare ass
simu
Prepk: T. Issariyaku
e simubyent
atval is
erwaterval
secones as fol
ulya
kul
sariy
ation
Issa
interva
E nt D i n Sim l ti nEvent-Driven Simulationb• Observe every event.
• Each event provide a reference to the next event (e.g.,Each event provide a reference to the next event (e.g., using pointer)
a b cNext_event Next_event Next_event
• Simulation finishes– At a pre-specified time– When there is no more event
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
When there is no more event
11
ed d
paredn finis
pre-shen th
Prepa
k: T. Issariyaku
When tyyybyy
yerwence
Tee
ence
TeTeb
ulya
kul
n
sariy
aon
Issa
Example: Queuing System
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 12
Preed
pared
repa
k: T. Issariyaku
by
ulya
kul
sariy
aystem
ssa
Example: Queuing System
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 13
PPrepa
k: T. Issariyaku
eree
ulya
kul
sariy
aystem
Issa
Example: Queuing System
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 14
Pp
Prepa
k: T. Issariyaku
Tee
ulya
kul
sariy
aystem
Issa
Example: Queuing System
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 15
PP
ulya
kul
sariy
aystem
ssa
Summary• Computer Networks = Computer + Networking• A Study of Computer NetworksA Study of Computer Networks
– Experimental– Mathematical Model– Mathematical Model– Simulation
Tim D p d t Sim l ti• Time-Dependent Simulation– Time-Driven Simulation
E D l– Event-Driven Simulation• Example: A queuing system
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 16
Prepa ed
en
aredDriven
ple: A
repa
k: T. Issariyaku
ytby nt
Simu
t
pwor
erwatwor
Tee
ulya
kul
sariy
a
Issa
uter +