CS244a: An Introduction To Computer Networks: Handout 3: Foundations and Basic Concepts
CS244a: An Introduction To Computer Networks: Handout 3: Foundations and Basic Concepts
Winter 2008
CS244a Handout 3
Outline
A Detailed FTP Example Layering Packet Switching and Circuit Switching Some terms
Data rate, Bandwidth and throughput Propagation delay Packet, header, address Bandwidth-delay product, RTT
CS244a Handout 3
Winter 2008
Example: FTP over the Internet Using TCP/IP and Ethernet 1 App A Stanford B (MIT) 20 App
2 3 OS 4
Ethernet
19 18 OS 17 14 R5 5 R1 15 R5 R1 6 8 11 7 9 R2 R3 R2 R3 12 16 13 10 R4 R4
CS244a Handout 3
Ethernet
Winter 2008
Winter 2008
Encapsulation
IP Packet
Winter 2008
IP Data
CS244a Handout 3
Creates MAC frame with Frame Check Sequence (FCS). Wait for Access to the line. MAC requests PHY to send each bit of the frame.
IP Header
Encapsulation
Ethernet FCS
Ethernet Data
Ethernet Header
Ethernet Packet
Winter 2008
CS244a Handout 3
In Router R1
5. Link (MAC or Ethernet) Protocol
IP Packet
IP Data
Accept MAC frame, check address and Frame Check Sequence (FCS). Pass data to IP Protocol.
IP Header
Decapsulation
Ethernet FCS
Ethernet Data
Ethernet Header
Ethernet Packet
Winter 2008
CS244a Handout 3
In Router R1
6. Internet Protocol (IP)
Use IP destination address to decide where to send packet next (next-hop routing). Request Link Protocol to transmit packet. IP Data IP Header
Destination Address: IP B
Source Address: IP A Protocol = TCP
IP Packet
Winter 2008
CS244a Handout 3
In Router R1
7. Link (MAC or Ethernet) Protocol
IP Packet
IP Data
Creates MAC frame with Frame Check Sequence (FCS). Wait for Access to the line. MAC requests PHY to send each bit of the frame.
IP Header
Encapsulation
Ethernet FCS
Ethernet Data
Ethernet Header
Ethernet Packet
Winter 2008
CS244a Handout 3
In Router R5
16. Link (MAC or Ethernet) Protocol
IP Packet
IP Data IP Header
Creates MAC frame with Frame Check Sequence (FCS). Wait for Access to the line. MAC requests PHY to send each bit of the frame.
Encapsulation
Ethernet FCS
Ethernet Data
Ethernet Header
Ethernet Packet
Winter 2008
CS244a Handout 3
10
Accept MAC frame, check address and Frame Check Sequence (FCS). Pass data to IP Protocol.
IP Header
Decapsulation
Ethernet FCS
Ethernet Data
Ethernet Header
Ethernet Packet
Winter 2008
CS244a Handout 3
11
Verify IP address. Extract/decapsulate TCP packet from IP packet. Pass TCP packet to TCP Protocol.
TCP Header Destination Address: IP B IP Source Address: IP A Header Protocol = TCP
Decapsulation
IP Packet
Winter 2008
IP Data
CS244a Handout 3
12
TCP Data
Winter 2008
TCP Header
13
Outline
A Detailed FTP Example Layering Packet Switching and Circuit Switching Some terms
Data rate, Bandwidth and throughput Propagation delay Packet, header, address Bandwidth-delay product, RTT
CS244a Handout 3
Winter 2008
14
Presentation 6
4 Transport 3 Network
Link 1 Physical
2
Router
Peer-layer communication
Router
Winter 2008
Outline
A Detailed FTP Example Layering Packet Switching and Circuit Switching Some terms
Data rate, Bandwidth and throughput Propagation delay Packet, header, address Bandwidth-delay product, RTT
CS244a Handout 3
Winter 2008
17
Circuit Switching
A Source B Destination
Its the method used by the telephone network. A call has three phases:
1. Establish circuit from end-to-end (dialing), 2. Communicate, 3. Close circuit (tear down).
Originally, a circuit was an end-to-end physical wire. Nowadays, a circuit is like a virtual private wire: each call has its own private, guaranteed data rate from end-to-end.
Winter 2008 CS244a Handout 3 18
Circuit Switching
Each phone call is allocated 64kb/s. So, a 2.5Gb/s trunk line can carry about 39,000 calls.
Telephone Network
Source Caller Central Office C.O. Trunk Exchange Central Office C.O.
Destination Callee
Winter 2008
CS244a Handout 3
19
Packet Switching
A Source
R2 R1 R4 R3
B Destination
Its the method used by the Internet. Each packet is individually routed packet-by-packet, using the routers local routing table. The routers maintain no per-flow state. Different packets may take different paths. Several packets may arrive for the same output link at the same time, therefore a packet switch has buffers.
Winter 2008 CS244a Handout 3 20
10
Packet Switching
Simple router model
4
Link 2 Link 1, ingress
Link 1, egress
Link 1
R14
Link 4
Link 2, egress
Link 3, ingress
Link 3, egress
Link 4, ingress
Link 4, egress
Winter 2008
CS244a Handout 3
21
Statistical Multiplexing
rate
One flow
time
Network traffic is bursty. i.e. the rate changes frequently. Peaks from independent flows generally occur at different times. Conclusion: The more flows we have, the smoother the traffic. Winter 2008 CS244a Handout 3
time
rate
Many flows
Average rates of: 1, 2, 10, 100, 1000 flows.
time
22
11
Packet Switching
Statistical Multiplexing
Queue Length X(t)
Dropped packets
R R R
X(t)
Link rate, R
Packet buffer
Time
Because the buffer absorbs temporary bursts, the egress link need not operate at rate N.R. But the buffer has finite size, B, so losses will occur.
Winter 2008 CS244a Handout 3 23
Statistical Multiplexing
Rate A
C A C
time Rate B
C
time
Winter 2008 CS244a Handout 3 24
12
time
For high reliability, ... [the Internet] was to be a datagram subnet, so if some lines and [routers] were destroyed, messages could be ... rerouted - Tanenbaum
CS244a Handout 3 26
Winter 2008
13
Some Definitions
Packet length, P, is the length of a packet in bits. Link length, L, is the length of a link in meters. Data rate, R, is the rate at which bits can be sent, in bits/second, or b/s.1 Propagation delay, PROP, is the time for one bit to travel along a link of length, L. PROP = L/c. Transmission time, TRANSP, is the time to transmit a packet of length P. TRANSP = P/R. Latency is the time from when the first bit begins transmission, until the last bit has been received. On a link:
Latency = PROP + TRANSP.
Winter 2008
CS244a Handout 3
27
Packet Switching
A Source
R2 R1 R4 R3
B Destination
Host A
R1 R2 R3
TRANSP1 TRANSP2
PROP1
TRANSP3
PROP2
TRANSP4
PROP3
Host B
Winter 2008
CS244a Handout 3
28
14
Packet Switching Why not send the entire message in one packet?
M/R M/R
Host A
R1 R2 R3
Host B
Latency =
(PROP + M / R )
i i i
Host A R1 R2 R3 Host B
Latency = M / Rmin +
PROP
i
Breaking message into packets allows parallel transmission across all links, reducing end to end latency. It also prevents a link from being hogged for a long time by one message.
Winter 2008 CS244a Handout 3 29
Because the egress link is not necessarily free when a packet arrives, it may be queued in a buffer. If the network is busy, packets might have to wait a long time.
Host A
R1 R2 R3
TRANSP3
PROP2
TRANSP4
PROP3
Winter 2008
CS244a Handout 3
30
15
To understand the performance of a packet switched network, we can think of it as a series of queues interconnected by links. For given link rates and lengths, the only variable is the queueing delay. If we can understand the queueing delay, we can understand how the network performs.
Winter 2008
CS244a Handout 3
31
16
A router queue
Model of FIFO router queue
A(t),
D(t)
Q(t)
The arrival process. The number of arrivals in interval [0, t ]. : The average rate of new arrivals in packets/second. D(t ) : The departure process. The number of departures in interval [0, t ]. 1 : The average time to service each packet.
A(t ) : Q(t ): The number
Winter 2008
33
D(t)
Q(t)
Winter 2008
CS244a Handout 3
34
17
A(t) D(t)
A (t )
Q(t)
Service process
D(t)
time
Winter 2008
CS244a Handout 3
35
D(t)
time
Queueing delay, d(t), is the time spent in the queue by a bit that arrived at time t, and if the queue is served first-come-first-served (FCFS or FIFO)
Winter 2008 CS244a Handout 3 36
18
Example
Q(t) d(t)
100
A(t)
D(t)
Example: Every second, a train of 100 bits arrive at rate 1000b/s. The maximum departure rate is 500b/s. What is the average queue occupancy?
Solution: During each cycle, the queue fills at rate 500b/s for 0.1s, then drains at rate 500b/s for 0.1s.The average queue occupancy when the queue is non-empty is therefore: (Q(t ) Q(t ) > 0) = 0.5 (0.1 500) = 25 bits. The queue is empty for 0.8s each cycle, and so: Q(t ) = (0.2 25) + (0.8 0) = 5 bits. (You'll probably have to think about this for a while...).
0.1s
0.2s
1.0s
time
Winter 2008
CS244a Handout 3
37
1.
2.
3.
Usually, arrival processes are complicated, so we often model them as random processes. The study of queues with random arrival processes is called Queueing Theory. Queues with random arrival processes have some interesting properties. Well consider some here.
CS244a Handout 3 38
Winter 2008
19
Properties of queues
Time evolution of queues. Examples Littles Result. The M/M/1 queue.
Burstiness increases delay Determinism minimizes delay
Winter 2008
CS244a Handout 3
39
Q(t)
Packet Arrivals: Departures:
1
time
Q(t)
Winter 2008
CS244a Handout 3
40
20
Winter 2008
41
In general, determinism minimizes delay. random arrival processes lead to larger delay than simple periodic arrival processes.
i.e.
Winter 2008
CS244a Handout 3
42
21
Littles Result
L = d
Winter 2008
Where: L is the average number of customers in the system (the number in the queue + the number in service), is the arrival rate, in customers per second, and d is the average time that a customer waits in the system (time in queue + time in service). Result holds so long as no customers are lost/dropped.
CS244a Handout 3
43
3. Successive interarrival times are independent of each other (i.e. arrivals are not bursty).
Winter 2008
CS244a Handout 3
44
22
It makes the math easy. Be warned Network traffic is very bursty! Packet arrivals are not Poisson. But it models quite well the arrival of new flows.
Winter 2008 CS244a Handout 3 45
Arrival of new phone calls to a telephone switch Decay of nuclear particles Shot noise in an electrical circuit
An M/M/1 queue
Model of FIFO router queue
A(t),
D(t)
If A(t) is a Poisson process with rate , and the time to serve each packet is exponentially distributed with rate , then:
Average delay, d =
Winter 2008
1 ;
46
23