880 likes | 893 Views
This document provides a primer on probability, a preview of the course materials, and discusses the principles of design for the Internet. It also includes examples and calculations related to independent events, mutually exclusive events, and statistical multiplexing.
E N D
Probability, Preview, and Principles EE122 Fall 2011 Scott Shenker http://inst.eecs.berkeley.edu/~ee122/ Materials with thanks to Jennifer Rexford, Ion Stoica, Vern Paxsonand other colleagues at Princeton and UC Berkeley
Announcements • Sections this week! • ShaddiHasan • We have new account forms • Get them after class, one per person, no exceptions • Project will be released on Wednesday • So we can get to Reliable Transport beforehand • Problem 3.iii Consider case where F and Q increase, but H and P stay constant. • Waiting list: No way to move more students in • Could try doing a 194……
Outline • Primer on probability (6 slides) • Simple, but all you need…. • Discussion of Homework #1 • Layering • Design Principles for the Internet • Layering • E2E Principle • Fate Sharing
Probability Primer Get out a sheet of paper or otherwise be able to jot down your answers This is not a test, this is so you can tell if you understand the material
Independent Events • Independent: occurrence of one event does not affect the likelihood of the other event • Example of two independent events: • Flow 1 sends 5 packets in a particular frame • Flow 2 sends 2 packets in a particular frame • Assume that: • Event A happens with probability pA • Event B happens with probability pB • What is probability both event A and B happen? • Write it down! • Answer: Probability = pApB
Consider Dice • Probability that rolling a single die yields a 1? 1/6th • Probability rolling two dice yields 1 1? 1/36th • Probability rolling two dice yields a 1 and a 2? • Write it down!
Be Careful Counting Events First die is 1 and second die is 2: 1/36th One die is 1 and one die is 2: 1/18th • That’s because you could have 1 2 or 2 1
Mutually Exclusive Events • First roll of die is 1:1/6th • First roll of die is 2:1/6th • First roll of die is 3:1/6th • First roll of die is 4:1/6th • First roll of die is 5:1/6th • First roll of die is 6:1/6th • This set of events is complete (or exhaustive) in that one of them must be true Total of probabilities = 1
Exclusive vs Independent Events • First roll of die is 1, second roll of die is 3 • Independent • First roll of die is 1, first roll of die is 2 • Exclusive
Computing Averages • Assume that x is some property of an event and that events A, B, C are mutually exclusive and complete (i.e., one of them happens) • E.g., x = number of packets sent in a particular frame • Assume that: • Event A has x=5 • Event B has x=2 • Event C has x=10 • What is the average value of x? (denoted by <x>) • Write it down! • Average <x> = 5pA+2pB + 10pC
THIS IS ALL YOU NEED TO KNOW! • The problems are easier than you think… • …but think clearly before computing the answer…
#2: Statistical Multiplexing • Time is divided into “frames”, frames into “slots” • Each flow is assigned one slot per frame • The flows have identical proabilisticbehavior: • With equal probability, send zero, one, or two packets • Exclusive events! • Compute the fraction of packets that are dropped when n flows share their slots, for n=1, 2, 3, 4 • Does fraction dropped decrease as n grows?
Consider Two Flows (n=2) • Flow A sends 1 packet • Probability 1/3rd • Flow B sends no packets • Probability 1/3rd • Are these independent or exclusive events? • Independent! So probability that both happen is: Probability = 1/3 x 1/3 = 1/9 • Average number packets/frame generated by A? (1/3 x 0) + (1/3 x 1) + (1/3 x 2) = 1
n=2 Cases: Each with Prob 1/9th In which cases are packets dropped?
N=2 Cases: Have two slots to share ✔ ✔ ✔ ✔ Average number of drops: 1/9th x (1+1+2) Average number of packets generated: 2 Fraction of drops: 2/9ths
Cases n=3 and n=4 • n=3 you can easily enumerate • n=4 have patience, but if you understand how to group equivalent events (and count permutations properly) then it is easy. • And even easier to focus only on cases where shared and individual differ… • Reason to do 3 and 4 is to convince you that there is a trend as n increases….. • If this problem bores you, compute the asymptotic behavior as a function of n. • Email it to me, don’t hand it in with homework.
#4: PS/CS Retransmission After Failure • Fact: if transmission fails with probability p, number of retransmissionsuntil success is given by:
Derivation • Success on first transmission: (1-p) • Success on second transmission: p(1-p) • Success on third transmission: p2(1-p) • …. • Average number of retransmissions: 0(1-p) + 1*p(1-p) + 2*p2(1-p) + …..=
Failure Model • Assume that probability that the link goes down sometime during a time period t is given by:
Using these facts… • Only delay is transmission time • Ignore latency, queueing • Use this time to determine failure rate • Using the formula f(t) for the right value of t • Use that to determine retransmissions • Using f(t)/(1-f(t)) • Packet-switched has to send Q packets • So do the above calculation for packets, not file….
#3: Delays under PS and CS Compare the time it takes to transfer a file of size F under circuit-switching and packet-switching. Network: n links in a row, bandwidth B, latency L. Circuit-switching: Reservation packet (stored-and-forwarded), confirmation packet, file transmission. Packet-switching: File broken into packets (with headers). Packets stored-and-forwarded at nodes. Express delays in terms of: n,B, L, F, etc. Understand limiting behaviors
Timing in Circuit Switching Host 1 Host 2 Switch 1 Switch 2 time
Timing in Circuit Switching Host 1 Host 2 Switch 1 Switch 2 propagation delay between Host 1 and Switch1 CircuitEstablishment time
Timing in Circuit Switching Host 1 Host 2 Switch 1 Switch 2 Transmission delay propagation delay between Host 1 and Switch1 CircuitEstablishment time
Timing in Circuit Switching Host 1 Host 2 Switch 1 Switch 2 Transmission delay propagation delay between Host 1 and Switch1 CircuitEstablishment time
Timing in Circuit Switching Host 1 Host 2 Switch 1 Switch 2 Transmission delay propagation delay between Host 1 and Switch1 CircuitEstablishment propagation delay between Host 1 and Host 2 time
Timing in Circuit Switching Host 1 Host 2 Switch 1 Switch 2 Information Transmission delay propagation delay between Host 1 and Switch1 CircuitEstablishment propagation delay between Host 1 and Host 2 Transfer time
Timing in Circuit Switching Host 1 Host 2 Switch 1 Switch 2 Information Transmission delay propagation delay between Host 1 and Switch1 CircuitEstablishment propagation delay between Host 1 and Host 2 Transfer time Circuit Teardown
Timing of Datagram Packet Switching Host 1 Host 2 Node 1 Node 2 Packet 1 propagation delay between Host 1 and Node 1
Timing of Datagram Packet Switching 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
Timing of Datagram Packet Switching Host 1 Host 2 Node 1 Node 2 Packet 1 transmission time of Packet 1 at Host 1 Packet 1 We ignoreprocessing delay in the homework! Packet 1
Packet 1 Packet 1 Packet 1 Packet 2 Packet 2 Packet 2 Packet 3 Packet 3 Packet 3 Timing of Datagram Packet Switching Host 1 Host 2 Node 1 Node 2 propagation delay between Host 1 and Node 1 transmission time of Packet 1 at Host 1 We ignore processing delay in the homework!
Modularity in Computer Science “Modularity based on abstractionis the way things get done” --Barbara Liskov
Benefits of Modularity • Implementations hidden behind clean interfaces • Interfaces are incarnations of abstractions • Changes are limited in scope • Allows for continuing evolution and innovation • Easier to reason about
Methodology • Break job down into smaller tasks • And understand how they interact • Define abstractions for these tasks • Then implement them…..
Tasks in Networking • What does it take to send packets across country? • Simplistic decomposition: • Task 1: send along a single wire • Task 2: string these together to go across country • What makes Task 2 nontrivial? • Routing! • More detailed decomposition in next slide….
Tasks in Networking (bottom up) • Electrons on wire • Bits on wire • Packets on wire • Deliver packets across local network • Local addresses • Deliver packets across country • Global addresses • Ensure that packets get there • Do something with the data
How do we organize these tasks? • Put them into “layers” • Layering is a particularly strict form of modularity • Interactions limited to interfaces above and below • To motivate layers, we go back to the beginning…
You now have 3 minutes to answer… Who invented layering?
Wrong Answers • ISO • ARPANET • Walt Disney
Answer: Henry Ford • Before: • Each person worked on the whole car • After: • Each person only handled one particular task • Handed off car to next person in line • Only needed to understand the state of the car as it arrived, and only needed to produce the appropriate output • Could remain ignorant of everything else!
Advantages of Assembly Line • Specialization allows people to get faster • i.e., local improvements in implementation • If you want to change something in the car, only one person needed to know. • i.e., changes of limited scope
More Layering in the Real World • CEO A writes letter to CEO B • Folds letter and hands it to administrative aide • Aide: • Puts letter in envelope with CEO B’s name • Takes to FedEx • FedEx Office • Puts letter in larger envelope • Puts name and street address on FedEx envelope • Puts package on FedEx delivery truck • FedEx delivers to other company Dear Steve, We give up. Let’s merge. --Bill
The Path of the Letter “Peers” on each side understand the same things No one else does Lowest level has most packaging CEO CEO Semantic Content Letter Identity Envelope Aide Aide Location Fedex Envelope (FE) FedEx FedEx
The Path Through FedEx Higher “Stack” at Ends Highest Level of “Transit Stack” is Routing Partial “Stack” During Transit Truck Truck FE FE FE Sorting Office Sorting Office Sorting Office New Crate Crate Crate Crate Airport Airport Airport Deepest Packaging at the Lowest Level of Transport
How Does This Apply to Networking? • Let’s return to task decomposition….
Tasks in Networking • Electrons on wire • Bits on wire • Packets on wire • Deliver packets across local network • Local addresses • Deliver packets across country • Global addresses • Ensure that packets get there • Do something with the data
Resulting Layers • Electrons on wire (contained in next layer) • Bits on wire (Physical) • Packets on wire (contained in next layer) • Deliver packets across local network (Link) • Local addresses • Deliver packets across country (Internetwork) • Global addresses • Ensure that packets get there (Transport) • Do something with the data (Application)