670 likes | 799 Views
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
E N D
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 • 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
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
HTTP Packet radio Layering: The Problem • Re-implement every application for every technology? • No! But how does the Internet architecture avoid this? FTP NFS Telnet Application Coaxial cable Fiber optic Transmission Media
HTTP Packet radio 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 SSH NFS SMTP Application Intermediate layer Coaxial cable Fiber optic Transmission Media
Layering • Layering 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
Telnet FTP DNS TCP UDP IP Packet radio LAN Layering: Internet Universal Internet layer: • Internet has only IP at the Internet layer • Many options for modules above IP • Many options for modules below IP Application Transport Internet Net access/ Physical
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 networks • Applications that can run on IP can use any network • Simultaneous developments above and below IP
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 Internet • Endless disputes about what it means • Everyone cites it as supporting their position
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
Overview • Layering and e2e Argument • Little Theorem • Packet delays • IP Forwarding and Addressing • Stop-and-Wait and Sliding Window • Bit encoding • CSMA/CD & Ethernet
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 ispends in the system • What is the average number of packets in the system? d(i) = delay of packet i a(t) – arrival rate system • 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?
Example • Arrival rate = 1; delay = 4 Time = 0
Example • Arrival rate = 1; delay = 4 delay =1 Time = 1
Example • Arrival rate = 1; delay = 4 delay =2 delay =1 Time = 2
Example • Arrival rate = 1; delay = 4 delay =3 delay =2 delay =1 Time = 3
Example • Arrival rate = 1; delay = 4 delay =4 delay =3 delay =2 delay =1 Time = 4
A: number_of_packets_in_system = avg_arrival_rate x avg_delay Example • Arrival rate = 1; delay = 4 delay =3 delay =2 delay =1 Time = 4 Q: What is the average number of packets in system?
Overview • Layering and e2e Argument • Little Theorem • Packet Delays • IP Forwarding and Addressing • Stop-and-Wait and Sliding Window • Bit encoding • CSMA/CD & Ethernet
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
T Transmission time = P/R time Propagation delay =T = Length/speed 1m/speed = 3.3 usec in free space 4 usec in copper 5 usec in fiber Sending One Packet R bits per second (bps) Bandwidth: R bps Propagation delay: T sec T seconds P bits
Queueing • The queue has Q bits when packet arrives packet has to wait for the queue to drain before being transmitted Capacity = R bps Propagation delay = T sec P bits Q bits Queueing delay = Q/R T P/R time
Store & Forward Host 1 Host 2 Node 1 Node 2 Packet 1 propagation delay between Host 1 and Node 1 transmission time of Packet 1 at Host 1 Queuing & processing delay of Packet 1 at Node 2 Packet 1 Packet 1
Store & Forward: Various Capacities Example • A packet is stored(enqueued) before being forwarded (sent) 5 Mbps 100 Mbps 10 Mbps 10 Mbps Receiver Sender time
Store & Forward: Multiple Packet Example 5 Mbps 100 Mbps 10 Mbps 10 Mbps Receiver Sender time
Overview • Layering and e2e Argument • Little Theorem • Packet Delays • IP Forwarding and Addressing • Stop-and-Wait and Sliding Window • Bit encoding
1.2.3.4 1.2.3.5 Packet Forwarding • Store a mapping between IP addresses and output interfaces • Forward an incoming packet based on its destination address 1.2.3.5 1 1.2.3.6 3 1.2.3.4 2 … … 1 2
forwarding table 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 1.2.3.4 5.6.7.8 2.4.6.8 1.2.3.5 5.6.7.9 2.4.6.9 ... ... host host host host host host LAN 2 LAN 1 router router router WAN WAN 1.2.3.4 1.2.3.5
00001100 00100010 10011110 00000101 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” 12 34 158 5 Network (24 bits) Host (8 bits)
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 1.2.3.4 1.2.3.7 1.2.3.156 5.6.7.8 5.6.7.9 5.6.7.212 ... ... host host host host host host LAN 2 LAN 1 router router router WAN WAN 1.2.3.0/24 5.6.7.0/24 forwarding table
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 1.2.3.4 1.2.3.7 1.2.3.156 5.6.7.8 5.6.7.9 5.6.7.212 ... ... host host host host host host LAN 2 LAN 1 router router router host WAN WAN 5.6.7.213 1.2.3.0/24 5.6.7.0/24 forwarding table
0******* 10****** 110***** ******** ******** ******** ******** ******** ******** ******** ******** ******** 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)
1110**** 11110*** ******** ******** ******** ******** ******** ******** 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
00001100 00000100 00000000 00000000 11111111 11111110 00000000 00000000 Classless Inter-Domain Routing (CIDR) Use arbitrary length prefixes Use two 32-bit numbers to represent a network. Network number = IP address + Mask IP Address : 12.4.0.0 IP Mask: 255.254.0.0 Address Mask Network Prefix for hosts Written as 12.4.0.0/15 or 12.4/15
Scalability: Address Aggregation Provider is given 201.10.0.0/21 (201.10.0.x .. 201.10.7.x) Provider 201.10.0.0/22 201.10.4.0/24 201.10.5.0/24 201.10.6.0/23 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.
5 Minute Break Questions Before We Proceed?
Overview • Layering and e2e Argument • Little Theorem • Packet Delays • IP Forwarding and Addressing • Stop-and-Wait and Sliding Window • Bit encoding • CSMA/CD & Ethernet
Packet ACK Automatic Repeat reQuest (ARQ) • 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 Timeout Time
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?
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
Sliding Window Example (This is NOT TCP !) • Sender • Sending rate = 1 pkt/s • Receiver: • Delivering rate = 0.5 pkt/s • Delivers packets in sequenceto 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 Example Sender Receiver 1s 1 1 • Sender, at 1s • Send 1stpkt 2s 3s 4s 5s 6s 7s 8s 9s 10s 11s 12s 13s 14s
Sliding Window Example Sender Receiver 1s 1 1 • Sender, at 1s • Send 1stpkt • Receiver, at 3s • Get 1stpkt • Deliver 1stpkt to appl. • Send ack=1 to sender 2s 3s ack=1 1 4s 5s 6s 7s 8s 9s 10s 11s 12s 13s 14s
Sliding Window Example Sender Receiver 1s 1 1 • Sender, at 2s • Send 2ndpkt, which is lost 2s 2 2 1 3s ack=1 4s 5s 6s 7s 8s 9s 10s 11s 12s 13s 14s
Sliding Window Example Sender Receiver 1s 1 1 • Sender, at 3s • Send 3ndpkt • Receiver, at 5s: • Get 3rdpkt; doesn’t deliver it since out of seq. • Send nack=2 (request 2ndpkt) 2s 2 1 2 3s 3 3 2 1 ack=1 4s 5s nack=2 3 2 6s 7s 8s 9s 10s 11s 12s 13s 14s
Sliding Window Example Sender Receiver 1s 1 1 • Sender, at 4s • Send 4thpkt • Receiver window full! • Receiver, at 6s • Get 4th packet 2s 2 1 2 3s 3 3 2 1 ack=1 4 4s 4 3 2 1 5s nack=2 3 2 6s 4 3 2 7s 8s 9s 10s 11s 12s 13s 14s
Sliding Window Example Sender Receiver 1s 1 1 • Sender, at 5s • Get ack=1 • Remove 1stpkt from buffer • Send 5thpkt; now 2, 3, 4, 5 are in flight (window full!) • Receiver, at 7s • Get 5thpkt 2s 2 1 2 3s 3 3 2 1 ack=1 4 4s 4 3 2 1 5s nack=2 5 5 4 3 2 3 2 6s 4 3 2 7s 5 4 3 2 8s 9s 10s 11s 12s 13s 14s
Sliding Window Example Sender Receiver 1s 1 1 • Sender, at 7s • Get nack=2 • Resend pkt 2 • Receiver, at 9s • Get 2ndpkt • Deliver it to appl. • Send ack=2 2s 2 1 2 3s 3 3 2 1 ack=1 4 4s 4 3 2 1 5s nack=2 5 5 4 3 2 3 2 6s 4 3 2 7s 2 5 4 3 5 4 3 2 2 8s 9s ack=2 5 4 3 2 10s 11s 12s 13s 14s
Sliding Window Example Sender Receiver 1s 1 1 • 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 2s 2 1 2 3s 3 3 2 1 ack=1 4 4s 4 3 2 1 5s nack=2 5 5 4 3 2 3 2 6s 4 3 2 7s 2 5 4 3 5 4 3 2 2 8s 9s ack=2 5 4 3 2 10s 11s 6 5 4 3 ack=3 6 5 4 3 12s 13s 14s