Upload
morela
View
84
Download
0
Tags:
Embed Size (px)
DESCRIPTION
EE 122: Midterm Review. Ion Stoica TAs: Junda Liu, DK Moon, David Zats http://inst.eecs.berkeley.edu/~ee122/fa09 (Materials with thanks to Vern Paxson , Jennifer Rexford, and colleagues at UC Berkeley). Announcements. Midterm Information Date: 19 October 2008 - PowerPoint PPT Presentation
Citation preview
1
EE 122: Midterm ReviewIon Stoica
TAs: Junda Liu, DK Moon, David Zatshttp://inst.eecs.berkeley.edu/~ee122/fa09
(Materials with thanks to Vern Paxson, Jennifer Rexford,and colleagues at UC Berkeley)
2
Announcements Midterm Information
Date: 19 October 2008 Time: 4:00 PM to 5:30 PM Closed book, open 8.5” x 11” crib sheet (both sides) No Blue Books; all answers on exam sheets we hand
out No calculators, PDAs, cell phones with cameras, etc. Please use PENCIL and bring ERASER
Ion, one additional office hour on Monday: 1-3pm
3
Overview
Layering and e2e Argument Little Theorem Packet delays IP Forwarding and Addressing Stop-and-Wait and Sliding Window Bit encoding CSMA/CD & Ethernet & Ethernet
4
Layering: The Problem
Re-implement every application for every technology?
No! But how does the Internet architecture avoid this?
Telnet FTP NFS
Packetradio
Coaxial cable
Fiberoptic
Application
TransmissionMedia
HTTP
5
Layering: Solution Introduce an intermediate layer that provides a single
abstraction for various network technologies New application just need to be written for intermediate layer New transmission media just need to provide abstraction of
intermediate layer
SMTP SSH NFS
Packetradio
Coaxial cable
Fiberoptic
Application
TransmissionMedia
HTTP
Intermediate layer
6
LayeringLayering is a particular form of modularization
System is broken into a vertical hierarchy of logically distinct entities (layers)
Service provided by one layer is based solely on the service provided by layer below
Rigid structure: easy reuse, performance suffers
7
Layering: InternetUniversal Internet layer: Internet has only IP at the Internet layerMany options for modules above IPMany options for modules below IP
Internet
Net access/Physical
Transport
Application
IP
LAN Packetradio
TCP UDP
Telnet FTP DNS
8
Hourglass
9
Implications of Hourglass
Single Internet layer module:Allows networks to interoperate
Any network technology that supports IP can exchange packets
Allows applications to function on all networksApplications that can run on IP can use any network
Simultaneous developments above and below IP
10
E2E Arguments: Where to Place Functionality?
Most influential paper about placing functionality is “End-to-End Arguments in System Design” by Saltzer, Reed, and Clark
“Sacred Text” of the InternetEndless disputes about what it meansEveryone cites it as supporting their position
11
E2E Arguments: Moderate Interpretation
Think twice before implementing functionality in the network
If hosts can implement functionality correctly, implement it a lower layer only as a performance enhancement
But do so only if it does not impose burden on applications that do not require that functionality
12
Overview
Layering and e2e Argument Little Theorem Packet delays IP Forwarding and Addressing Stop-and-Wait and Sliding Window Bit encoding CSMA/CD & Ethernet
13
Little’s Theorem Assume a system (e.g., router, network, checkout line
in a supermarket) at which packets arrive at rate a(t) Let d(i) be the delay or service time of packet i , i.e.,
time packet i spends in the system What is the average number of packets in the
system?
systema(t) – arrival rate
d(i) = delay of packet i
Intuition: Assume arrival rate is a = 1 packet per second and the delay of
each packet is s = 4 seconds What is the average number of packets in the system?
14
Example
Arrival rate = 1; delay = 4
Time = 0
15
Example
Arrival rate = 1; delay = 4
Time = 1
delay = 1
16
Example
Arrival rate = 1; delay = 4
Time = 2
delay = 1
delay = 2
17
Example
Arrival rate = 1; delay = 4
Time = 3
delay = 2
delay = 3
delay = 1
18
Example
Arrival rate = 1; delay = 4
Time = 4
delay = 3
delay = 4
delay = 2
delay = 1
19
Example
Arrival rate = 1; delay = 4
Time = 4
delay = 3
delay = 2
delay = 1
Q: What is the average number of packets in system?
A: number_of_packets_in_system = avg_arrival_rate x avg_delay
20
Overview
Layering and e2e Argument Little Theorem Packet Delays IP Forwarding and Addressing Stop-and-Wait and Sliding Window Bit encoding CSMA/CD & Ethernet
21
Definitions Link bandwidth (capacity): maximum rate (in bps) at
which the sender can send data along the link Propagation delay: time it takes the signal to travel from
source to destination Packet transmission time: time it takes the sender to
transmit all bits of the packet Queuing delay: time the packet need to wait before being
transmitted because the queue was not empty when it arrived
Processing Time: time it takes a router/switch to process the packet header, manage memory, etc
22
Sending One PacketR bits per second (bps)
T seconds
P bits
Bandwidth: R bpsPropagation delay: T sec
time
Transmission time = P/RT
Propagation delay =T = Length/speed
1m/speed = 3.3 usec in free space 4 usec in copper 5 usec in fiber
23
Queueing The queue has Q bits when packet arrives packet
has to wait for the queue to drain before being transmitted
P bits
time
P/RT
Q bits
Queueing delay = Q/R
Capacity = R bpsPropagation delay = T sec
24
Packet 1
Packet 1
Store & Forward
Packet 1
Queuing & processing
delay of Packet 1 at Node 2
Host 1 Host 2Node 1 Node 2
propagationdelay betweenHost 1 and Node 1
transmission time of Packet 1at Host 1
25
Store & Forward: Various Capacities Example
A packet is stored (enqueued) before being forwarded (sent)
Sender Receiver
10 Mbps 5 Mbps 100 Mbps 10 Mbps
time
26
Store & Forward: Multiple Packet Example
Sender Receiver
10 Mbps 5 Mbps 100 Mbps 10 Mbps
time
27
Overview
Layering and e2e Argument Little Theorem Packet Delays IP Forwarding and Addressing Stop-and-Wait and Sliding Window Bit encoding
28
Packet Forwarding Store a mapping between IP addresses and output
interfaces Forward an incoming packet based on its destination address
……
31.2.3.6 11.2.3.5
1
21.2.3.5
1.2.3.4
1.2.3.4 2
29
Scalability Challenge Suppose hosts had arbitrary addresses
Then every router would need a lot of information …to know how to direct packets toward the host
host host host
LAN 1
... host host host
LAN 2
...
router router routerWAN WAN
1.2.3.4 5.6.7.8 2.4.6.8 1.2.3.5 5.6.7.9 2.4.6.9
1.2.3.41.2.3.5
forwarding table
30
Solution: Hierarchical Addressing (IP Prefixes) Divided into network (left) & host portions (right) 12.34.158.0/24 is a 24-bit prefix with 29 addresses
Terminology: “Slash 24”
00001100 00100010 10011110 00000101
Network (24 bits) Host (8 bits)
12 34 158 5
31
Scalability Improved Number related hosts from a common subnet
1.2.3.0/24 on the left LAN 5.6.7.0/24 on the right LAN
host host host
LAN 1
... host host host
LAN 2
...
router router routerWAN WAN
1.2.3.4 1.2.3.7 1.2.3.156 5.6.7.8 5.6.7.9 5.6.7.212
1.2.3.0/245.6.7.0/24
forwarding table
32
Easy to Add New Hosts No need to update the routers
E.g., adding a new host 5.6.7.213 on the right Doesn’t require adding a new forwarding entry
host host host
LAN 1
... host host host
LAN 2
...
router router routerWAN WAN
1.2.3.4 1.2.3.7 1.2.3.156 5.6.7.8 5.6.7.9 5.6.7.212
1.2.3.0/245.6.7.0/24
forwarding table
host
5.6.7.213
33
Classful Addressing Class A: if first byte in [0..127], assume /8 (top bit = 0)
Very large blocks (e.g., MIT has 18.0.0.0/8) Class B: first byte in [128..191] assume /16 (top bits = 10)
Large blocks (e.g,. UCB has* 128.32.0.0/16) Class C: [192..223] assume /24 (top bits = 110)
Small blocks (e.g., ICIR has 192.150.187.0/24) The “swamp” (many European networks, due to history)
0******* ******** ******** ********
10****** ******** ******** ********
110***** ******** ******** ********
34
Classful Addressing (cont’d) Class D: [224..239] (top bits 1110)
Multicast groups Class E: [240..255] (top bits 11110)
Reserved for future use
What problems can classful addressing lead to? Only comes in 3 sizes Routers can end up knowing about a lot of class C’s
1110**** ******** ******** ********
11110*** ******** ******** ********
35
Classless Inter-Domain Routing (CIDR)
IP Address : 12.4.0.0 IP Mask: 255.254.0.0
00001100 00000100 00000000 00000000
11111111 11111110 00000000 00000000
Address
Mask
for hosts Network Prefix
Use arbitrary length prefixesUse two 32-bit numbers to represent a network.
Network number = IP address + Mask
Written as 12.4.0.0/15 or 12.4/15
36
Scalability: Address Aggregation
Provider is given 201.10.0.0/21 (201.10.0.x .. 201.10.7.x)
201.10.0.0/22 201.10.4.0/24 201.10.5.0/24 201.10.6.0/23
Provider
Routers in the rest of the Internet just need to know how to reach 201.10.0.0/21. The provider can direct the
IP packets to the appropriate customer.
37
5 Minute Break
Questions Before We Proceed?
38
Overview
Layering and e2e Argument Little Theorem Packet Delays IP Forwarding and Addressing Stop-and-Wait and Sliding Window Bit encoding CSMA/CD & Ethernet
39
Automatic Repeat reQuest (ARQ)
Time
Packet
ACKTim
eout
Automatic Repeat Request Receiver sends
acknowledgment (ACK) when it receives packet
Sender waits for ACK and times out if does not arrive within some time period
Simplest ARQ protocol Stop and Wait Send a packet, stop and wait
until ACK arrives
Sender Receiver
40
How Fast Can Stop-and-Wait Go? Suppose we’re sending from UCB to New York:
Bandwidth = 1 Mbps (megabits/sec) RTT = 100 msec Maximum Transmission Unit (MTU) = 1500 B = 12,000 b No other load on the path and no packet loss
What (approximately) is the fastest we can transmit using Stop-and-Wait? Answer: 12,000b/0.1s = 120 kbps
How about if Bandwidth = 1 Gbps?
41
Allowing Multiple Packets in Flight
“In Flight” = “Unacknowledged” Sender-side issue: how many packets (bytes)? Receiver-side issue: how much buffer for data
that’s “above a sequence hole”? I.e., data that can’t be delivered since previous data is
missing
42
Sliding Window Example (This is NOT TCP !) Sender
Sending rate = 1 pkt/s Receiver:
Delivering rate = 0.5 pkt/s Delivers packets in sequence to application Acknowledges (acks) each delivered pkt Send negative ack. (nack) if packet lost
Round-trip time = 4 sec Receiver Window = 4 packets Note: max. achievable throughput = 0.5pkt/s
Sliding Window ExampleSender Receiver1 1 1s
2s3s
4s5s6s7s8s
9s10s11s12s13s14s
Sender, at 1s Send 1st pkt
Sliding Window ExampleSender Receiver1
1
1 1s2s3s
4s5s6s7s8s
9s10s11s12s13s14s
Sender, at 1s Send 1st pkt
Receiver, at 3s Get 1st pkt Deliver 1st pkt
to appl. Send ack=1 to
sender
ack=1
Sliding Window Example
Sender, at 2s Send 2nd pkt,
which is lost
Sender Receiver1 1
ack=1
1s2s3s
4s5s6s7s8s
9s10s11s12s13s14s
2 1 2
Sliding Window Example1s2s3s
4s5s6s7s8s
9s10s11s12s13s14s
Sender Receiver1
2 13 2 1
3 2
123 ack=1
nack=2
Sender, at 3s Send 3nd pkt
Receiver, at 5s: Get 3rd pkt;
doesn’t deliver it since out of seq.
Send nack=2 (request 2nd pkt)
Sliding Window Example1s2s3s
4s5s6s7s8s
9s10s11s12s13s14s
Sender Receiver1
2 13 2 1
3 2
123 ack=1
nack=2
Sender, at 4s Send 4th pkt Receiver
window full!
Receiver, at 6s Get 4th packet
4 3 2 1 4
4 3 2
Sliding Window Example1s2s3s
4s5s6s7s8s
9s10s11s12s13s14s
Sender Receiver1
2 13 2 1
3 2
123 ack=1
nack=2
Sender, at 5s Get ack=1 Remove 1st pkt
from buffer Send 5th pkt;
now 2, 3, 4, 5 are in flight (window full!)
Receiver, at 7s Get 5th pkt
4 3 2 1 4
4 3 25 4 3 2 5
4 35 2
Sliding Window Example1s2s3s
4s5s6s7s8s
9s10s11s12s13s14s
Sender Receiver1
2 13 2 1
3 2
123 ack=1
nack=2
Sender, at 7s Get nack=2 Resend pkt 2
Receiver, at 9s Get 2nd pkt Deliver it to
appl. Send ack=2
4 3 2 1 4
4 3 25 4 3 2 5
4 35
ack=2
25 4 3 2 2
4 35 2
Sliding Window Example1s2s3s
4s5s6s7s8s
9s10s11s12s13s14s
Sender Receiver1
2 13 2 1
3 2
123 ack=1
nack=2
Sender, at 11s Get ack=2 Send pkt 6;
pkts 3, 4, 5, 6 are in-flight
Receiver, at 11s Deliver 3d pkt
to appl. (recall, delivery rate is 1pkt every 2s)
Send ack=3
4 3 2 1 4
4 3 25 4 3 2 5
4 35
ack=2
25 4 3 2 2
4 35 2
6 5 4 3 4 35ack=36
Sliding Window Example
16s17s18s19s20s
If no more losses, throughput = 0.5pkt/sec
This is max throughput as receiver cannot deliver more than 0.5pkt/sec
6 5 4 3 4 35ack=3
7 6 5 4
11s12s13s14s15s
5 46
8 7 6 5 6 57
ack=4
9 8 7 6 5 46
4 35
ack=5
ack=6
6
7
8
9
What If Sending & Delivey Rates are 2 pkt/s?
Throughput limited by window size = Window/RTT = 4pkt/4 = 1 pkt/s
Sender Receiver1 1,2 1s
2s3s
4s5s6s7s8s
9s10s
2
121234 3,4
34ack=1, ack=2
3456 ack=3, ack=4
5,6
5678
5678
53
Performance with Sliding Window
Given previous UCB New York 1 Mbps path with 100 msec RTTand Sender (and Receiver) window = 100 Kb = 12.5 KB
• How fast can we transmit?• Answer: min(100Kb/0.1s, 1Mbps) = 1 Mbps
• What about with 12.5 KB window & 1 Gbps path?• Window required to fully utilize path:
• Bandwidth-delay product (or “delay-bandwidth product”)• 1 Gbps * 100 msec = 100 Mb = 12.5 MB• Note: large window = many packets in flight
54
Overview
Layering and e2e Argument Little Theorem Packet Delays IP Forwarding and Addressing Stop-and-Wait and Sliding Window Bit encoding CSMA/CD & Ethernet
55
Encoding Signals propagate over physical links
How do we represent the bits? Physical layer issue
Simplify some electrical engineering details Assume two discrete signals, high and low E.g., could correspond to two different voltages
Basic approach High for a 1, low for a 0 How hard can it be?
Sender & receiver agree: what’s “high”, what’s “low” And: when to read the signal
56
Non-Return to Zero (NRZ) 1 high signal; 0 low signal
(Actual signals are of course not so sharp) How does receiver know where one bit stops and another
begins? 0 0 1 0 1 0 1 1 0
NRZ(non-return to zero)
Clock
Receiver reads the signal on the clock’s leading edge
Sender begins to transmit signal on clock’s falling edge
57
Clock Coordination How do the sender and receiver agree on the running
of the clock? Problem: without explicit synchronization, receiver’s
clock can drift with respect to sender’s0 0 1 0 1 0 1 1 0
NRZ
Clock
58
Clock Recovery
To avoid clock drift, we use the signal itself to coordinate
Whenever see a transition (0 1 or 1 0) we know that corresponds to sender clock’s trailing edge So pull our clock in phase towards it
Problem with NRZ: long strings of 0s or 1s Quite common No transitions from low-to-high, or high-to-low Clock recovery fails and receiver’s clock begins to drift
59
Non-Return to Zero Inverted (NRZI) 1 make transition; 0 stay at same level Fixes previous problem for long sequences of 1’s But not for 0’s
0 0 1 0 1 0 1 1 0
Clock(read on
falling edge)
NRZI(non-return to zero
inverted)
60
Manchester Encoding 1 high-to-low transition; 0 low-to-high
transition Addresses clock recovery problems But: physical signaling must be twice as fast
To support 2 transitions/cycle Efficiency of 50%
0 0 1 0 1 0 1 1 0
Clock(read on each
rising edge)
Manchester
61
4-bit/5-bit (100Mb/s Ethernet) Goal: address inefficiency of Manchester encoding, while
avoiding long periods of no transition Solution:
Use 5 bits to encode every sequence of four bits such that No 5 bit code has more than one leading 0 or two trailing 0’s
Use NRZI to then encode the 5 bit codes Efficiency is 80%
0000 111100001 010010010 101000011 101010100 010100101 010110110 011100111 01111
1000 100101001 100111010 101101011 101111100 110101101 110111110 111001111 11101
4-bit 5-bit 4-bit 5-bit
62
Overview
Layering and e2e Argument Little Theorem Packet Delays IP Forwarding and Addressing Stop-and-Wait and Sliding Window Bit encoding CSMA/CD & Ethernet
63
Ethernet: CSMA/CD Protocol Carrier sense: wait for link to be idle Collision detection: listen while transmitting
No collision: transmission is complete Collision: abort transmission & send jam signal
Random access: exponential back-off After collision, wait a random time before trying again After mth collision, choose K randomly from {0, …, 2m-
1} … and wait for K*512 bit times before trying again
The wired LAN technology Hugely successful: 3/10/100/1000/10000 Mbps
64
Minimum Packet Sizepropagation delay (d)a) Time = t; Host 1
starts to send frame
Host 1 Host 2
propagation delay (d)Host 1 Host 2
b) Time = t + d; Host 2 starts to send a frame, just before it hears fromhost 1’s frame
propagation delay (d)Host 1 Host 2c) Time = t + 2*d; Host 1
hears Host 2’s frame detects collision
2*d < min_frame_size/bandwidth 2*(max_length/light_speed) < min_frame_size/bandwidth max_length < min_frame_size*light_speed/(2*bandwidth)
65
Minimum Packet Sizepropagation delay (d)a) Time = t; Host 1
starts to send frame
Host 1 Host 2
propagation delay (d)Host 1 Host 2
b) Time = t + d; Host 2 starts to send a frame, just before it hears fromhost 1’s frame
propagation delay (d)Host 1 Host 2c) Time = t + 2*d; Host 1
hears Host 2’s frame detects collision
min_frame_size = 512b; light_speed = 2.5*108mps; bandwidth = 10Mbps max_length = (min_frame_size)*(light_speed)/(2*bandwidth) = = (8*64b)*(2.5*108mps)/(2*107 bps) = 6400m approx
66
Midterm Information Date: 19 October 2008 Time: 4:00 PM to 5:30 PM Closed book, open 8.5” x 11” crib sheet (both sides) No Blue Books; all answers on exam sheets we hand out No calculators, PDAs, cell phones with cameras, etc. Please use PENCIL and bring ERASER
Ion, one additional office hour on Monday: 1-3pm