Transcript 00:00 the following content is provided under 00:01 a Creative Commons license your support 00:04 will help MIT OpenCourseWare continue to 00:06 offer high quality educational resources 00:08 for free 00:09 to make a donation or view additional 00:12 materials from hundreds of MIT courses 00:14 visit MIT opencourseware at ocw.mit.edu 00:27 so the goal for today is to talk about a 00:30 particular kind of communication network 00:33 called a shared medium network and there 00:35 are many many examples of shared media 00:37 communication networks that exist today 00:39 now these are generally speaking 00:41 networks that don't span the globe or 00:43 even span the country with one exception 00:45 and that exception is the satellite 00:47 network shown here the model here is 00:50 that you have a set of ground stations 00:53 this is a picture from an actual 00:54 Internet service provider in the middle 00:57 of the Pacific I mean I'd love to go 01:00 there on assignment and the way this 01:03 network works is in order to communicate 01:04 between these islands the way they do 01:06 this is they have satellite ground 01:07 stations that can receive and transmit 01:09 data and there's a satellite up in the 01:12 sky so you communicate between two of 01:14 these islands by transmitting data from 01:16 the one of the ground stations up to the 01:18 satellite and down there and the way the 01:21 system works is not to divide 01:23 frequencies amongst the different 01:25 satellites and the reason they don't do 01:27 that is that they don't know how often 01:30 each of these satellites these ground 01:32 stations is going to communicate so you 01:34 don't divide up the frequencies up front 01:36 between the ground stations so all of 01:38 the ground stations sending to the 01:40 satellite do so on the same frequency 01:42 and the satellite downlink is on a 01:45 different frequency 01:46 so what could happen if two satellites 01:49 communicate up at the same time is that 01:51 the satellite up if two ground stations 01:54 communicate to the satellite at the same 01:55 time the satellite may not be able to 01:57 pull together the two different 01:58 transmissions apart because they're on 02:00 the same frequency now they could use 02:02 frequency division multiplexing it's a 02:04 perfectly reasonable solution but they 02:06 don't do it because if one satellite one 02:09 ground station has data to send in the 02:11 other doesn't you end up wasting 02:12 frequencies and and not getting as high 02:15 throughput so that's one example of a 02:17 shared medium network this here is a 02:20 picture of something called Ethernet 02:21 which was one of the most successful 02:23 networking technologies developed it was 02:24 invented in the early 1970s and the idea 02:28 here is you have a shared boss a shared 02:31 wire and many stations connect to it and 02:34 if two stations transmit at the same 02:36 time the two transmissions could collide 02:38 and you don't actually receive the data 02:40 and what you would like to do is to 02:42 figure out a way by which these 02:44 different stations or nodes on the 02:46 Ethernet can somehow manage to 02:49 communicate or by collaboratively 02:51 figuring out how to transmit on the 02:57 medium and the idea is to make it so 03:00 that only one node transmits at any 03:01 point in time 03:03 other examples of shared media are you 03:05 know wireless networks or 802 11 is an 03:08 example of a shared communication medium 03:11 if a bunch of us communicate and share 03:12 that access point or we're all running 03:15 on the same channel and in 802 11 or 03:18 Wi-Fi there are a bunch of different 03:19 channels available but any given access 03:23 point tends to have a cell which is some 03:26 area around it that in order to 03:29 communicate with that access point you 03:30 use the same channel so we need a way by 03:32 which we have to take the shared network 03:36 and allocate our access to this medium 03:39 amongst these different nodes and if you 03:41 look at an entire building there's a big 03:43 plan in place for how the different 03:44 access points communicate potentially on 03:47 different channels or the same channel 03:48 and there's an entire process by which 03:51 this building's network is laid out and 03:53 the campus network is laid out and so 03:55 forth and cellular networks you know 03:58 Verizon AT&T Sprint and t-mobile and all 04:00 these guys have the same problem that 04:02 they have to solve so these are very 04:04 interesting questions which boil down to 04:07 how you take shared me or shared medium 04:10 whether it be a wire like an Ethernet or 04:14 radio which is over-the-air or it could 04:17 be acoustic how do you take all of that 04:19 and have these different nodes that are 04:21 communicating with each other on that 04:22 medium 04:26 somehow make it so that they can all 04:29 share the medium without colliding with 04:30 each other and that's the problem that 04:33 solved by these media access or Mac 04:35 protocols now all the stuff is that I'm 04:39 going to tell you is based on chapter 15 04:41 which is on Mac protocols and there's a 04:43 little more in it than we'll be able to 04:45 cover in recitation in lecture and 04:47 recitation but I it's hard for me to 04:49 keep straight what we cover and what we 04:51 don't so you're sort of responsible for 04:54 everything in that chapter will cover 04:55 most of the issues there's a bunch of 04:57 details in the chapter that are worth 04:59 understanding in order for you to really 05:01 get your you know understanding to be 05:02 clear so I want to you know caveat that 05:05 upfront we lost a lecture because the 05:07 hurricane and I I just can't keep 05:08 straight what I tell you and what I 05:10 don't 05:10 so everything in that chapter is fair 05:13 game but we'll cover the most important 05:16 issues okay so here's the abstract model 05:20 and you know there's a shared medium it 05:23 could be a wire it could be a wireless 05:26 and you have these nodes and the nodes 05:29 have two things there that you have to 05:30 worry about the first thing here is just 05:32 a detail it's the channel interface it's 05:34 a way by which the data on that node 05:38 gains access to the medium and then each 05:41 node has a set of cues or one cue mat or 05:44 two cues a transmit Q and a receive Q 05:46 which has packets waiting to be sent on 05:48 that medium and the basic idea is that 05:52 you have all these nodes on the medium 05:54 and it may be that these nodes are all 05:56 trying to communicate with a single 05:58 router or a switch or a satellite or it 06:00 may be that the nodes are directly 06:01 communicating with each other like your 06:03 laptop is communicating with mine you 06:05 know your phone is communicating with 06:06 your laptop and somehow they're all 06:08 sharing this medium and we're going to 06:12 come up with the world's simplest shared 06:13 medium network because it's simple and 06:15 because it's a reasonable model of 06:17 reality which is that at any point in 06:21 time if more than one transmission is on 06:24 that we shared medium then you end up 06:28 having what's called a collision and you 06:31 cannot decode the packet 06:32 so let me repeat the model here is if 06:35 there's exactly one transmission on the 06:37 medium we'll assume that it's delivered 06:38 correctly if there is no transmission on 06:41 the medium at some point in time nothing 06:43 happens that the channel is sort of 06:44 wasted it's not used if there's more 06:47 than one transmission on the medium 06:48 overlapping in time 06:50 neither transmission successfully gets 06:53 decoded so there are two or three or 06:55 four people hitting the channel at the 06:56 same time overlapping in time nobody 06:59 succeeds okay that's the abstraction and 07:02 what we want is a communication protocol 07:05 or rules of engagement between the nodes 07:07 that allow us to get reasonably good 07:09 performance in sharing the medium now 07:15 depending on the details of the network 07:17 the nodes that are on this shared medium 07:19 may be able to hear each other perfectly 07:21 or maybe they can't hear each other at 07:23 all or maybe they can partially hear 07:26 each other and we're going to deal with 07:27 all of these cases but for now just 07:30 assume that you have these nodes on the 07:32 medium and for simplicity and 07:34 completeness let's take the example of 07:36 the satellite network you have a 07:38 satellite up here and you have a bunch 07:43 of ground stations that are all trying 07:47 to communicate up to the satellite 07:50 whenever they have data to send and just 07:53 assume for now that the nodes cannot 07:55 hear each other and the satellite 07:58 doesn't really know whether a node has 08:00 packets waiting to be sent or not and 08:02 somehow we're going to invent a protocol 08:04 or rules of engagement that allow these 08:07 nodes to in a distributed way figure out 08:10 when it's okay for them to transmit data 08:12 and when they should keep their mouth 08:14 shut 08:14 and each of these nodes has a queue of 08:18 packets waiting to be sent 08:22 sometimes the queue may be empty 08:25 sometimes the queue may have one or more 08:27 packets that depends on what the 08:29 application is doing and how quickly 08:31 that node has been able to transmit data 08:33 on the channel if the node has packets 08:38 waiting to be sent so a queue can either 08:40 be empty or it has one or more packets 08:47 waiting to be sent in which case we're 08:49 going to use the word backlogged so at 08:55 any point in time some subset of the 08:57 nodes may have backlogged packets Matt 08:59 may have backlog queues and our goal is 09:02 to come up with a way by which these 09:04 nodes can transmit data on the channel 09:10 now there are two or three different 09:12 ways of solving this problem the first 09:15 approach to solving this problem is r2 09:18 to do frequency division multiplexing 09:21 you could just allocate different 09:23 frequencies and you solve the problem 09:26 but as I mentioned before we don't want 09:28 to do that because if you've allocated 09:29 and predefined a frequency to a node and 09:31 the node is empty doesn't have packets 09:34 then you've essentially wasted bandwidth 09:36 because you've allocated a portion of 09:38 the frequency to a node that isn't 09:40 actually going to send any data somebody 09:42 else who had data to send could have 09:45 more profitably used it and helped you 09:47 win help you get better performance the 09:50 second thing you can do is to somehow 09:52 divide up time in other words they all 09:54 run on the same frequency and somehow 09:57 make it so that you give the illusion 09:59 that each node gets access to the 10:03 channel for some fraction of the time 10:05 and if you do that there's it's a model 10:08 of sharing called time sharing as 10:09 opposed to frequency sharing so one 10:11 approach to dealing with it is frequency 10:13 sharing 10:18 which is a good idea in some cases but 10:20 not in this case when the traffic is 10:22 quite bursty the second thing you can do 10:24 is time sharing and there are two ways 10:31 of doing time sharing one of them is 10:33 called time division multiplexing or TDM 10:36 it's also called TDM a four time 10:39 division multiple access and we will 10:45 talk about this intercept ation tomorrow 10:46 so I won't belabor it here the second 10:50 approach to solving this problem which 10:51 is what we will spend the rest of today 10:53 on is a class of protocols called 10:55 contention protocols and these protocols 11:01 are really beautiful because they're 11:03 completely distributed there is no 11:05 central intelligence it's highly 11:09 distributed intelligence each node makes 11:11 its own independent decisions as to what 11:13 it should do based on very little 11:15 information that it learns as it sends 11:18 its packets and determines what happens 11:19 to those packets and yet somehow the 11:22 nodes are able to come up with them with 11:24 a way of sharing the channel by 11:26 essentially cooperating but yet 11:28 competing with each other that's why 11:30 these are called contention protocols 11:31 that ends up getting pretty good 11:32 performance there's a third kind of 11:35 sharing which we won't talk about it all 11:37 in 602 and that's code code division 11:43 the slides that are on line says say a 11:46 little bit about it and you can look it 11:47 up on on the internet if you want we're 11:49 not going to talk about it here so for 11:51 today my goal is to tell you about 11:53 contention protocols and largely 11:55 speaking for Mac protocols right now 11:57 in this chapter and this part of the 11:59 course we are interested in time sharing 12:01 TDMA and contention so before I tell you 12:07 about the protocols I want to tell you a 12:08 little bit about what we would like what 12:11 makes the protocol good and what doesn't 12:13 what's bad so if I tell you that you 12:16 have a bunch of these nodes that are 12:17 trying to share this medium and you 12:20 would like to get good performance in 12:21 this protocol to share access to the 12:25 channel by what metric or metrics would 12:28 you measure this performance how would 12:32 you know it's good or bad yes 12:38 well the model here is if two people 12:41 send at the same time you fail we fail 12:49 okay so good let's keep going with that 12:51 now let's say that someone observes the 12:53 system and watches its evolution over 12:56 time they observe whether packets 12:59 succeed in packets fail and so forth 13:01 and they want to count something what 13:03 would they count to determine if a 13:04 protocol is good or bad sorry 13:07 rate of failure I mean Lybia positive 13:09 people so let's count the rate of 13:10 success okay so there's a word for this 13:13 rate of success it's it's a measure of 13:15 if you succeed more it means you're able 13:16 to deliver data faster which means you 13:19 get higher throughput or a higher rate 13:22 so the first metric that you have so 13:24 these are metrics the first metric that 13:28 you have is throughput and throughput is 13:34 generally measured in bits per second or 13:36 packets per second so let's just imagine 13:38 that it's packets per second for 13:40 simplicity assume that all the packets 13:42 are the same size so you can translate 13:45 into bits per second now throughput by 13:49 itself is a good metric but really we 13:52 would like protocols we would like to 13:54 evaluate protocols without worrying 13:57 about whether the underlying channel 13:59 can't send data at one megabit per 14:01 second or 10 megabits per second or a 14:03 gigabit per second or 100 gigabits per 14:05 second I mean we really don't want to 14:06 care about what the actual throughput or 14:08 the rate supportable by the channel is 14:10 so we're going to translate this 14:12 throughput into a different word which 14:14 means which which is a proxy for a 14:16 throughput called the utilization 14:21 and we'll represent that by you and the 14:24 utilization of a Mac protocol or in fact 14:28 of any protocol over over a network is 14:31 defined as the throughput that the 14:33 protocol achieves divided by the maximum 14:38 rate at which it's possible to send data 14:41 over that channel or over that network 14:45 so if you have a certain maximum rate at 14:47 which if everything were in your favour 14:49 you could send data at a certain maximum 14:51 rate stick that in the denominator look 14:54 at what throughput you actually get and 14:56 take the ratio the higher the 15:00 utilization the higher the throughput we 15:01 just normalized out by the maximum rate 15:03 and of course by definition we know that 15:06 the utilization must be between 0 and 1 15:08 because you can't exceed the maximum and 15:12 this is an aggregate measure so if you 15:15 have let's say 4 nodes and the max rate 15:18 just for example let's say the max rate 15:21 is 10 megabits per second and you have 4 15:25 nodes and the throughput that the 4 15:28 nodes get are let's say one megabit per 15:31 second 2 megabits per second 4 megabits 15:33 per second and one megabit per second 15:37 what's the utilization 15:41 the total throughput is 8 megabits per 15:43 second the maximum is 10 so the 15:45 utilization in this example is 0.8 in 15:51 fact if you had a 4 the same 4 nodes if 15:56 the throughput you got were 0 1 7 and 1 15:59 the utilization would also be point 8 16:08 can't add can't multiply but can't 16:12 involve all right now which of these two 16:18 is better it depends on if your 16:22 democrat-republican what which of those 16:25 two is better if you were designing a 16:30 network which of these would you want 16:33 wait yeah Democrats 16:41 well this is a tough question you know 16:44 you might say that everybody's you know 16:45 they should be sort of as equal as 16:47 possible you might say that they should 16:49 get what proportion to what they pay for 16:52 this is various ways of thinking about 16:53 this we're not going to worry about the 16:56 I mean it's actually a pretty deep set 16:58 of topics that connect with economics 16:59 and social justice and so on and a lot 17:02 of people do work on what it means to 17:04 have fairness and what it means kinds of 17:06 fairness and for those who are 17:08 interested I can point you to lots of 17:09 literature and it's still somewhat open 17:11 in terms of what is the right way to 17:13 think about it we're simple people we'll 17:15 just assume that absent any other 17:18 information we would like to get as 17:19 equal as possible and to do that we 17:21 there are many ways to define fairness 17:24 and there's a particular one that I like 17:26 because it's simple and somewhat 17:28 intuitive and it's used a lot in 17:30 networking it's called the Fairness 17:31 Index this isn't the only way to measure 17:36 fairness but but this is one that we'll 17:38 use and the definition of it is that I 17:42 will look at either the utilization or 17:45 the throughput it doesn't matter let me 17:47 call that X I in other words X I is the 17:50 throughput or the utilization let me 17:53 call it open achieve by node I and if I 18:01 look at this number here X I squared 18:04 divided by n summation X I squared 18:11 that's my definition of fairness now 18:13 this looks a little daunting but it's 18:14 actually very simple what it's saying is 18:17 that I take each of the throughputs that 18:21 I get and I add them all up and I square 18:24 them so you know if I were to divide 18:27 both sides by N or N squared essentially 18:30 this is capturing for me something 18:32 that's relative to the ratio of the 18:36 square of the mean to the variance so in 18:41 other words what ends up happening with 18:42 a term like this this is a second moment 18:44 kind of a definition of fairness this 18:46 thing here looks like the square of the 18:48 mean this thing here is related to the 18:49 variance and this is capturing on the 18:52 ratio of those two terms if you have a 18:56 situation where you have n nodes and you 18:59 end up with everybody getting equal then 19:04 the fairness index is 1 because if 19:07 everybody has an equal value and you 19:09 just run the calculation through you'll 19:10 find that the answer is equal to 1 19:16 so this is f X between 0 & 1 19:19 what's the minimum value of the Fairness 19:21 Index from this formula well that 19:24 happens when you have n guys and the 19:26 throughput looks something like this one 19:29 of them gets all the throughput and the 19:31 others get 0 and if you plug that in 19:33 here what you'll find is that only one 19:35 term survives the 1 over N term and 19:37 everything else becomes 0 and so the 19:40 minimum value of the fairness is 1 over 19:42 and this is intuitive in that it says 19:45 that if you have two people and one guy 19:47 hogs everything that's a little bit less 19:50 unfair then if you have 5 people and one 19:53 guy hogs everything because in the sense 19:54 one guy hugging everything out of 5 is 19:56 worse than one guy hugging everything 19:58 out of 2 the only real reason we care 20:03 about this fairness is we're going to 20:04 compare different way variance of a 20:06 protocol along this index and I'd like 20:09 to you to get a feel for what is a 20:10 little fairer than worry and what's less 20:12 fair there's nothing particularly sacred 20:14 about this particular definition of 20:16 fairness and indeed people will argue 20:19 also that this is a terrible definition 20:21 of fairness because it doesn't reflect 20:22 how much people have paid for the 20:23 resource but those are details because 20:26 you could you could have waited versions 20:27 where people are weighted by how much 20:29 they pay and so forth so you can handle 20:31 some of that stuff is this kind of clear 20:34 these two basic definitions so we're 20:36 going to worry about throughput and 20:38 fairness in protocols any questions so 20:42 far 20:45 yes 20:48 Oh depends on whether you care about it 20:51 or not I mean it depends on the 20:53 application so typically speaking when I 20:55 look at for example measuring the 20:57 performance of my let's say I'm 20:58 downloading web pages when I measure the 21:02 performance of web downloads all header 21:04 information is just pure overhead so I 21:06 only look at how long it's taken to 21:08 download my content but now I can go in 21:10 and look at how well is my arm you know 21:12 TCP which is the Transfer Protocol or IP 21:14 or whatever some lower level protocol 21:16 working in which case everything else is 21:19 overhead but I will include the the 21:21 particular headers related to TCP in my 21:24 measurement so the answer to whether 21:26 something is overhead or not is it sort 21:28 of depends on what it is you care about 21:29 so if I'm delivering video you know all 21:32 this other stuff is overhead and the 21:34 only thing I care about is my video 21:36 frame but so typically you know the word 21:40 throughput is by itself not meaningful 21:43 you have to say throughput of walk and 21:44 Here I am talking about throughput of a 21:45 protocol which is what you always have 21:47 to say and this is a true put of the Mac 21:49 protocol and it does include the Mac / 21:51 Mac header overhead if you have any 21:53 headers any other question okay there's 21:58 a third metric that's important which is 22:00 that we would like to have you know 22:04 reasonable delays 22:05 so in general delay is a good metric or 22:08 bounded delay is a good metric and this 22:11 matters because I can get extremely high 22:15 utilization and extremely high fairness 22:18 by doing something utterly dumb and 22:20 naive which is that if I have all these 22:24 nodes with a lot of packets which if 22:26 they're all backlogged then what I will 22:27 say is today this node gets access to 22:30 the network tomorrow he gets access to 22:33 the network 22:34 day after tomorrow he gets access to the 22:35 network if I look at if they're always 22:38 backlogged then clearly the throughput 22:39 is you know the utilization is is very 22:41 high because the network is always being 22:43 used profitably and there are no 22:44 collisions and no idle slots no idle 22:47 time that the network is fair because if 22:50 I measure this over you know a month or 22:52 you know 22:53 or something everybody gets the equal 22:55 throughput but I've clobbered the delay 22:57 because you know what this guy got lucky 22:59 but everybody else waiting and waiting 23:00 and in fact even he has to wait once 23:02 today is over he's gotta wait many days 23:04 before he gets a turn so you actually 23:06 would like to have bounded delay or at 23:08 least load delay and this is something 23:11 we're going to measure we're not going 23:12 to try to optimize in the work we're 23:14 going to talk about okay so that's the 23:16 statement of the problem and the 23:19 statement of the metrics that we wish to 23:20 optimize you have to ask me questions 23:23 because if the problem set up isn't 23:25 clear the solution is kind of going to 23:26 be completely meaningless so does anyone 23:28 have any questions about the problem 23:30 statement 23:36 it's one of these things we're stating 23:38 the problem was actually a little harder 23:39 than the actual solution so I'm going to 23:43 ask tell you now one method to solve 23:44 this problem I'll get you and the method 23:46 we're going to use to solve this problem 23:48 was invented in the context of satellite 23:50 networks and then it got put into 23:51 Ethernet and then it's now part of Wi-Fi 23:54 so everybody uses a variant of the 23:56 method that we are going to study yes 24:02 the delay is measured per packet it's 24:05 measured between when the package showed 24:07 up at the cue to when it actually 24:08 successfully got received at the 24:10 receiver and then typically we'll take 24:12 an average across all of the packets and 24:14 report an average delay and perhaps the 24:16 standard deviation you are a common okay 24:22 all right so the solution we're going to 24:25 study the basic solution is something 24:27 called Aloha Aloha was a protocol 24:30 developed by a group led by non-parents 24:32 Abramson who was a professor at the time 24:35 he did this at the University of Hawaii 24:37 I believe he moved from Stanford to 24:39 Hawaii because he was an avid surfer and 24:42 he decided that this was in the late 60s 24:45 that he wanted a scheme to connect the 24:48 different islands together there were 24:49 seven of these islands or seven of these 24:51 stations that he wanted to connect 24:52 together and he came up with a scheme 24:55 that on the face of it should really not 24:58 work and the only thing good about it is 25:00 how utterly simple it is and the fact 25:03 that it works is is actually very 25:05 fortunate and very useful and it the 25:07 reason it works is because in a way 25:10 nodes doing things that look completely 25:12 random as long as the probability with 25:15 which they do these things is controlled 25:17 it turns out they work pretty well so 25:21 let me first show you a picture that 25:23 will define a few terms and I'm going to 25:25 come up with a version of this Aloha 25:28 protocol that ends up being a pretty 25:30 popular version and it's called slotted 25:32 Aloha 25:42 and this model that I had from before 25:44 where the nodes have cues and when two 25:48 packets run at the same time they end up 25:51 colliding all of that remains I'm going 25:53 to add one or two more restrictions to 25:55 the kinds of to the to the model the 25:59 first an important thing that defines 26:01 slotted Aloha is that and in fact it 26:03 defines real implementations of this 26:05 this kind of protocol is the time is 26:07 slotted what that means is that you 26:15 cannot send a packet at an arbitrary 26:17 point in time onto the network 26:20 instead what ends up happening is that 26:23 if time if you view time as a continuous 26:25 arm as a continuous variable you divide 26:30 up time into time slots I mean these 26:34 slots could be any length it doesn't 26:36 matter and the assumption we're going to 26:39 make is that packets can only get 26:42 transmitted at the beginning of a time 26:44 slot so these are legal let me 26:53 this is a legal packet transmission and 26:56 this is the legal packet transmission 26:57 but this is not a legal packet 26:59 transmission not allowed and the second 27:03 assumption is that every packet is an 27:07 integer number of time slots so in other 27:09 words this is legal but this is not 27:11 legal 27:12 you cannot have a packet that starts 27:14 here and ends in the middle they're all 27:16 packets are an integer number of time 27:18 slots ok so if I have both of those 27:23 assumptions that tells me Aloha by 27:28 slotted Aloha we're also going to make 27:30 the additional assumption that each 27:32 packet is exactly one time slot long 27:38 later on we'll relax this assumption but 27:41 I want to come up with the world's 27:42 simplest working protocol in other words 27:44 the only legal packets in slotted Aloha 27:48 are like that okay and as shown on this 27:53 picture this is a picture of how slotted 27:55 Aloha works you have time going on that 27:57 axis times divided into slots and I have 28:00 these three different nodes blue red and 28:02 green when no node sends packets in a 28:06 time slot that time slot is less said to 28:09 be idle and the channel is said to be 28:12 idle in that time slot if you have more 28:17 than one node send in a time slot we 28:20 have a collision and but in our model 28:23 none of the packets that sent in that 28:25 time slot gets decoded all of them are 28:28 wasted and everything else is a success 28:32 if you have a time slot in which exactly 28:34 one packet is sent we'll assume in this 28:37 model that the packet is successfully 28:39 decoded and we get to count that as a 28:41 successful packet reception reception 28:44 so if you count and look in this picture 28:47 the utilization here is a 65% because we 28:54 have 20 time slots here and in 13 of 28:57 those time slots we were able to 28:59 successfully transmitted exactly one 29:01 packet each and that gives us the 29:04 utilization of 65% and the advantage of 29:06 picking many of these things is you 29:08 can't really check in real time if I got 29:09 the numbers right or wrong you can check 29:12 that later on I'm pretty sure I'm not 29:15 sure of anything it's probably correct 29:16 you should just count the number of 29:18 slots in which exactly one guy said ok 29:22 so that's the that's the picture here so 29:25 what I want to do now is to come up with 29:29 an algorithm with a protocol that each 29:31 of the nodes can implement that allows 29:33 us to get reasonable utilization 29:37 reasonable fairness and reasonable delay 29:39 and an example of this protocol and and 29:43 one way of solving this problem is to 29:47 solve the problem in this context under 29:49 these assumptions and then we're going 29:50 to calculate the utilization of that 29:51 protocol so let me start by telling you 29:54 what the protocol is 30:01 the protocol each node independently 30:05 runs a version of this protocol and in 30:08 the protocol each node maintains in the 30:12 simplest version of the protocol each 30:14 node maintains one variable and the 30:17 variable it maintains is a probability 30:27 so each node maintains a variable I'm 30:30 going to call it P and P is the 30:33 probability with which the node will 30:36 transmit a packet if it has a packet to 30:39 transmit in other words each node has 30:42 its own variant its own version of P and 30:45 the semantics of this is that if backlog 30:51 we won't just greedily go ahead and 30:54 transmit but instead if we're backlog we 30:57 will transmit our packet on the channel 31:00 with probability P 31:06 how do you generate how do you actually 31:08 do something with probability P like 31:10 what would you do to do something if I 31:13 were asking you you know write write a 31:15 program to transmit a packet with 31:17 probability P how will you actually do 31:19 that yes call a human roll a dice 31:29 alright let's try to make it a little 31:30 more practical actually dice has only 31:33 got six sides how would I get P out of a 31:35 dice a lot of that is okay what if I 31:40 want P with 10 to the minus 17 yeah all 31:44 right 31:45 does someone have a slightly more 31:47 practical solution yes 31:57 that sounds good so you pick a random 31:59 number between 0 & 1 I mean how do you 32:00 get that well that's a deep question but 32:02 I would just call random dot random and 32:04 Python or whatever the fingers oh and 32:06 you know how Python does it is very you 32:09 know this way is to botch it but for our 32:11 purposes we'll assume it's correct and 32:13 if the number you get is less than or 32:15 equal to P that tells you an event with 32:17 probability P that's great 32:19 okay so suppose we did this I'm not 32:22 telling you how to pick P yet 32:24 that's magic that's going to come up a 32:26 little bit later but suppose every node 32:27 had a value of P that someone came and 32:30 told it you know what there are n nodes 32:32 in the system let's assume there are n 32:35 backlogged nodes in the system and I 32:37 told you that somebody came and told 32:39 each node that it can transmit with P 32:42 what is the utilization of this protocol 32:44 so if I have n backlogged nodes each 32:51 transmitting with this probability P 32:55 what is the utilization of the protocol 32:57 I want to know what is the utilization 33:04 which is of course a function of N and P 33:07 and the way you have to answer this 33:09 question is of course you draw this 33:11 picture in time and you divide time into 33:13 slots you got some of these things where 33:18 you have one packet going through some 33:20 of these things where more than one goes 33:21 through in which case this is the 33:22 collision and I ask you what is the 33:26 utilization how would you calculate it 33:29 suppose you observe the running of the 33:32 protocol and you find that in some time 33:34 slots there's a collision and some time 33:35 slots there's nothing and in some time 33:37 slots there's exactly one transmission 33:44 if you look at this how would you 33:47 calculate the utilization of the 33:49 protocol the utilization is the 33:53 throughput over the maximum rate what's 33:56 the maximum rate of this channel well 33:58 the rate is measured in the rate here is 34:01 measured in packets per timeslot and 34:03 I've said that each packet occupies one 34:05 timeslot so the maximum rate is every 34:08 time slot is occupied with a packet so 34:10 the maximum rate is one packet per 34:12 timeslot but you cannot send faster than 34:14 that so the denominator is just one 34:17 therefore the utilization in this model 34:20 is simply equal to the throughput which 34:21 is simply equal to the number of time 34:24 slots in which I have exactly one packet 34:26 right or put another way if I look for a 34:29 long enough amount of time it's the 34:31 number of time slots with exactly one 34:33 packet that tells me the throughput and 34:34 therefore tells me the utilization so if 34:40 I look for a very very long time and I 34:41 count the number of successful packets 34:43 that's going to tell me the utilization 34:46 if I take the number and divide by arm 34:49 the amount the number of time slots and 34:51 therefore the utilization is equal to 34:54 simply the fraction of time slots in 34:57 which I have one packet and exactly one 35:00 packet send which is equivalent to 35:02 asking what's the probability that in 35:04 any given time slot I have exactly one 35:06 successful one exactly one packet sent 35:10 so I'm going to repeat this 35:14 the utilization of this protocol is 35:16 exactly equal to the probability that in 35:18 any given time slot I have exactly one 35:20 transmission if you disagree with that 35:24 statement you have to raise your hand 35:26 now or if you don't understand it so I 35:29 can explain it again because we're going 35:30 to use this idea repeatedly in pretty 35:33 much you know there's a guaranteed to be 35:34 some question on the quiz related to 35:36 this idea and then you have to work some 35:38 probability out so does everyone 35:39 understand why the utilization of the 35:41 protocol is equal to the probability 35:43 that in any time slot there's exactly 35:46 one transmission of a packet the reason 35:50 why that's true is it follows from this 35:52 definition right because the maximum 35:54 rate here is one packet per time slot 35:56 and so I want to know what the 35:57 throughput is the throughput is simply I 35:59 look over a long period of time many 36:01 time slots and I count what's the number 36:03 of packets I said so if I take the 36:05 number of successful packets I sent and 36:07 divided by the number of time slots well 36:09 that's actually the definition of a 36:10 probability that in any given time slot 36:12 I have exactly one successful 36:13 transmission and therefore the 36:16 utilization is equal to the probability 36:18 that I have exactly one transmission 36:26 so I have n backlogged nodes each guy 36:29 sends with probability P in a time slot 36:32 what's the probability that I have 36:34 exactly one transmission 36:41 well there's certainly a P which is 36:43 success times one minus P to the N minus 36:46 one which is all the other guys keep 36:48 quiet this right it's almost right times 36:56 n there's an N choose 1 which is there 36:59 anyways to pick the winner and therefore 37:01 that's the answer 37:04 all right let's let's hold um n times so 37:09 let me write this as u equals n times P 37:12 times 1 minus P to the N minus 1 suppose 37:16 you knew n suppose n will were you know 37:18 some value 10 15 whatever therefore I 37:23 would view this assuming n is constant I 37:25 could view this as a function of P if I 37:35 want to maximize this utilization I want 37:38 it obviously I want to maximize it right 37:40 if I want to maximize the utilization 37:43 what should be B 37:53 or I'll call it P star what's the value 37:57 of P equal to P star that maximizes this 38:00 utilization yes 1 over N yeah you could 38:05 do this the hard way or the easy way 38:09 great so if you did that off the answer 38:12 works out to be P star if you do u prime 38:16 of P equals 0 and you solve that you'll 38:19 find that P star is 1 over N the long 38:25 way to do it is is the way you describe 38:27 but it the answer is intuitive because 38:29 what it really says is that if I did 38:32 have every node transmitted with 38:33 probability 1 over N in a time slot the 38:36 expected number of transmissions within 38:38 any given time slot is n times or 1 over 38:42 N which is 1 which is kind of what you 38:44 would expect you would expect that to 38:46 maximize the utilization the expected 38:48 number of nodes that transmit in any 38:49 given time slot is 1 and that's 38:52 fortunately what you do get if you solve 38:55 the equation so P star is 1 over n so if 38:59 somebody told you the number of backlog 39:01 nodes in the network and they had the 39:03 ability to program each node to set the 39:06 appropriate probability the probability 39:08 you would use is 1 over n so let's 39:13 assume still this world where we know 39:16 the number of backlog nodes and somebody 39:18 came and told us the probability we 39:19 should use um do I need anything here 39:24 let me erase this 39:27 if somebody came and told you the 39:28 probability you should use you would 39:30 pick one over there that's great so now 39:35 therefore I can now review you star of n 39:40 which is the maximum probability now 39:43 becomes a function of n right because I 39:45 can go back in here and I scan set 39:46 assuming you pick this value of P you 39:50 can stick P equal to 1 over N in this 39:51 formula and then you get a utilization 39:53 that's purely a function of n because I 39:57 want to draw this picture of what it 39:58 looks like with them so you start of n 40:00 is equal to n times 1 over n which is 40:03 the value of P that's the best value of 40:05 P times 1 minus 1 over N to the N minus 40:08 1 so that make sense haven't done 40:11 anything other than substitute value of 40:13 P star equal to 1 over N and that's 40:17 equal to 1 minus 1 over n to the power n 40:22 minus 1 40:26 now one of the questions we want to ask 40:28 is is this hard this is the best you can 40:30 do in this protocol how good or how bad 40:34 is it so let's draw a picture of what 40:36 this looks like as n becomes large so I 40:40 want to draw a picture of n on this axis 40:43 and the best value of the utilization 40:46 which is U star of n on this axis 40:51 well when n is 1 or I get 2 n is one 40:54 actually intuitively when n is 1 what's 40:57 the utilization when you have one 40:58 backlog node and the protocol runs with 41:00 a value of P equal to 1 over N what's 41:02 the utilization the utilization is 1 41:06 this formula you know you have to take 41:08 the limit and so on but the answer is 1 41:10 ok 41:10 so let's assume this is 1 & 2 & 3 & 4 41:14 and so on so it's 1 what is it when N 41:18 equals 1 N equals 2 what's the 41:20 utilization when N equals 2 well it's 41:22 1/2 to the power 1 which is 50% so I get 41:26 a value which is 1/2 when n is 3 what 41:29 happens well 1 minus 1/3 squared which 41:33 is 4 over 9 41:40 as n goes bigger and bigger and bigger 41:42 what is this value become yep 41:47 yeah as n goes bigger and bigger and 41:50 bigger you do the limit when n goes to 41:51 infinity of this thing here n minus 1 41:54 and n are more or less the same things 41:55 you can get rid of that this should be a 41:58 well-known limit if you don't know it 42:00 you take the log so it becomes you take 42:03 the if you take the log and you find the 42:04 limit as it goes to infinity you can 42:06 expand that into a power series and 42:08 you'll find that the answer the limit of 42:10 the log is minus 1 or this value the 42:13 limit goes to 1 over u so in fact it 42:18 goes to a value which is 1 over E when n 42:22 is large or about 37% this is actually 42:27 not bad it's actually very good for a 42:29 protocol that did nothing sophisticated 42:30 all it did was pick a value of this 42:33 probability the fact that it's able to 42:35 get not a zero utilization but a 42:37 reasonably good utilization is an 42:39 extremely strong is a pretty strong 42:41 result and that's the basic aloha 42:45 protocol the basic Aloha protocol or a 42:48 fixed probability a lower protocol is 42:50 somebody telling you the number of 42:51 backlogged nodes and you using that 42:53 information for to make sure that every 42:55 node sends with some probability and 42:57 they just are the probability you would 43:00 pick is 1 over n now this is not 43:03 actually a very practical protocol 43:05 because how do you know which nodes have 43:07 backlogged packets and which nodes don't 43:08 what we would like is to come up with a 43:10 way by which we automatically have a 43:13 protocol that somehow gets us to the 43:16 correct 43:17 utilization and we're going to do that 43:19 by adding a method to this Aloha 43:22 protocol that will make it completely 43:23 practical and that method is called 43:25 stabilization 43:27 and the purpose of stabilization is to 43:31 determine at each node what the actual 43:33 value of P it should use is and that 43:35 value of P is going to change with time 43:37 as other nodes you know have traffic to 43:40 send and if nodes go away so the magic 43:42 protocol is going to be somehow that 43:45 we're able to change the value of P at 43:48 every node every node runs an algorithm 43:50 which adapts its value of P over time 43:52 and if there's a lot of competition the 43:55 value of P will reduce if there's very 43:57 unique competition the value of P 43:58 increases and if we do that we're going 44:01 to be able to get pretty good 44:03 utilization and this process is called 44:05 stabilization 44:12 nope the nodes will end up not 44:17 transmitting the same probability 44:18 because they're each going to be making 44:19 independent decisions so the first 44:21 ingredient is each node is still going 44:22 to have of P but in fact Noda is going 44:25 to have its own variable so we're going 44:27 to say that node I has its own variable 44:29 that only it knows and it's probability 44:32 is P I so the way we're going to do the 44:37 stabilization is very very simple we're 44:40 going to say that at node I it's going 44:42 to do you know the only information it 44:44 gets as it sends a packet and if it if 44:46 the packet succeeds it knows something 44:48 if the packet doesn't succeed it knows 44:50 something so let's say the node sends a 44:53 packet and the packet fails and the way 44:56 you know that a packet fails and I 44:57 haven't talked about this but the way 44:59 this protocol all these protocols end up 45:01 working is they send a packet and then 45:02 they watch to see if the packet succeeds 45:04 or not they can get that information by 45:07 an acknowledgment coming from the 45:08 receiver or in the case of certain 45:11 networks like Ethernet when you send a 45:12 packet if you aren't able to receive 45:14 your own packet on that bus then you 45:17 know that it's failed so that's just a 45:19 detail but the assumption here is this 45:21 some feedback that tells the node 45:23 whether a packet transmission succeeded 45:25 or not 45:26 in general it's with an acknowledgment 45:28 that comes from the receiver if you get 45:29 an ack it means it succeeds so we're 45:33 going to have two rules if you don't 45:35 succeed in other words there's a 45:36 collision then you do something and in 45:40 contrast if you succeed arm you do 45:43 something 45:45 so what we're going to do on a collision 45:47 is let's say that you send a packet and 45:49 it didn't succeed it collided yes 45:56 yeah you're out of luck because in 46:00 reality in Wi-Fi when an acknowledgment 46:03 fails what ends up happening is you 46:05 assume the packet collided so how people 46:07 deal with this problem is typically to 46:10 essentially do to do very strong error 46:13 protection on the acknowledgement you 46:15 send it at a very low bit rate and what 46:16 that really means is you're adding a lot 46:18 of redundancy to their acknowledgement 46:20 so you imagine you're coding the heck 46:21 out of it using channel coding that's 46:24 that's well that's what happens okay 46:28 let's say you send a packet and it 46:30 collides what should you do to the nodes 46:33 transmission probability increase it or 46:37 reduce it sorry reduce it because the 46:42 assumption is it collided because 46:43 presumably there's a lot of competition 46:44 and you're a nice guy and your 46:46 assumption is that all the other nodes 46:47 are nice people to with which is kind of 46:51 changing nowadays with all these 46:52 software-defined radios and you know the 46:54 hacking that you can do on Wi-Fi cards 46:56 it's possible for your node to not 46:58 actually back off but if you're a nice 47:01 node what you're going to do is you're 47:02 going to reduce the probability and one 47:04 way of doing that a good way of doing 47:05 that is called multiplicative reduction 47:07 or multiplicative decrease you reduce it 47:10 by a factor of two you just have it and 47:14 on a success you could do a bunch of 47:16 different things but one thing you can 47:17 do is you know you can be a little bit 47:19 greedy and stay out and I succeeded 47:21 which means there's not that much 47:23 competition in the network maybe there's 47:25 nobody else in the network in which case 47:27 I want to keep trying to increase my 47:28 transmission probability and maybe you 47:30 double it and my notes talk about you 47:33 know whether this is the right or 47:34 something else is right but it really 47:36 doesn't matter it turns out the 47:38 important rule is this rule 47:39 the protocol turns out to be not very 47:42 sensitive to how you increase you do 47:43 have to increase but it doesn't matter 47:45 how you do it now of course the 47:48 probabilities can't exceed one so we're 47:49 going to actually pick the minimum 47:51 of two times P and one this is the our 47:55 basic stabilization protocol now every 47:58 node has its own version of P and so you 48:01 know you may run with a P of 0.8 and I 48:03 might be at a papi 0.1 presumably if I 48:06 succeed I'm going to increase if you 48:08 fail you're going to decrease and 48:09 something happens the question is what 48:10 happens and that's what I want to show 48:13 you I'm going to skip all the stuff we 48:15 went through so if I run this protocol 48:20 exactly as I described on this board 48:22 here and this is an experiment with 48:24 you'll be doing all the stuff in the lab 48:25 yourself this is with with ten nodes 48:29 what you see is that you have a 48:32 utilization of 0.33 which is not too far 48:35 from the one over e utilization which is 48:38 remarkable that this protocol where 48:40 everybody just jumped around 48:41 multiplicative ly changing P I like this 48:44 would talk to be a pretty good 48:46 utilization but there's a big problem in 48:48 the protocol and the problem in the 48:49 protocol is that the fairness is pretty 48:51 terrible as it happens it's 0.47 I was 48:54 reminded the 47% of the nodes here got 48:56 pretty how's the two good it's probably 48:58 you know looking for handouts or 49:00 something but anyway it's pretty bad and 49:03 what's going on here is that when a node 49:06 is running at a high value of its 49:08 probability and some of the node is at a 49:10 low value of the probability if they 49:12 collide the guy with the higher value of 49:15 its probability reduces some by factor 49:17 of two but it's still a pretty high 49:19 value whereas if a node has a 49:20 probability of transmission's somehow 49:22 it's got screwed and it's now running at 49:24 you know 1 over 32 it becomes 1 over 64 49:27 then 1 over 128 it's practically zero it 49:30 doesn't it ever doesn't ever get out of 49:31 that you know real morass that it's in 49:33 and ever start being able to 49:35 successfully transmitted again and 49:36 that's what's happening here and the way 49:39 you solve this problem there's a very 49:41 simple solution to this problem the way 49:43 you solve this problem is you decide 49:45 that nobody should get really really 49:47 poor that you decide that you know 49:49 you're going to have a value of the 49:51 probability P min that will never 49:54 actually get you 49:55 never go below that so you modify the 49:58 protocol to do that and if you do that 50:02 you end up with much better performance 50:03 you end up with performance that looks 50:06 like this and you see this in the lab 50:12 but what you find here is something very 50:14 puzzling what you find here is that the 50:16 fairness is amazing it's 99.99 which is 50:19 really really good fairness but what you 50:21 find is that the utilization is 0.71 50:25 that's actually too good to be true 50:27 because the best utilization you could 50:30 expect is probably around 37% and the 50:33 fact is we're getting something 50:34 astonishingly good what's happening here 50:37 actually is something that's really 50:38 important it took people a few years to 50:40 figure it out it's called the capture 50:42 effect what's happening here is that 50:44 some node captures the channel for a 50:45 quite a substantial period of time 50:48 shutting everybody else out and then 50:49 some other node captures the channel for 50:51 some period of time shutting everybody 50:52 else out so you get significant 50:54 short-term unfairness or equivalently 50:56 you get long delay so some nodes may end 50:58 up waiting for a long time and then they 51:00 get access and then they keep access for 51:02 quite a while and then they lose access 51:04 and then some other nodes get it so 51:06 what's really going on here is even 51:07 though you have many many nodes 51:08 competing at any point in time 51:10 effectively the competition is only 51:11 between one or two nodes and this is a 51:14 problem called the capture effect and 51:17 the way you solve this problem is 51:18 symmetrically to change this value of 51:21 the probability there's a maximum value 51:22 which is P max so you have to pick a 51:25 different value less than one that's the 51:28 maximum probability in other words once 51:30 a node has a transmission probability of 51:32 let's say 0.25 or 0.3 you don't want to 51:35 have it keep increasing because what 51:36 ends up happening is then it captures 51:37 the channel for quite a while and it's 51:39 only upon successive collisions that it 51:42 comes down to the point where other 51:43 nodes can gain access to the channel so 51:46 if you put all of that together and run 51:47 the experiment we just put in this 51:49 protocol as described exactly on this 51:51 board and you can play around with these 51:53 things there's a lot of leeway in 51:54 picking these 51:55 rameters if you run this protocol you 51:57 get a utilization in this case of 0.41 52:00 which for n equal to 10 is pretty much 52:02 what you would get according to sticking 52:03 into that formula a fairness that's 52:05 extremely high and it's super cool 52:08 because this is exactly what you would 52:09 want to get if somebody magically told 52:11 you the number of backlogged nodes and 52:13 you theoretically calculated the optimal 52:15 value of the probability you couldn't do 52:17 better than this protocol and we managed 52:18 to do it by simply these nodes that are 52:21 just independently making these 52:22 decisions figuring out what they should 52:25 do and if you were to plot the actual 52:27 evolution of the probabilities you find 52:29 that at no point in time does any node 52:31 have a value of 1 over n even though in 52:34 the experiment there's some value of the 52:36 number of backlogged nodes the node kind 52:39 of down surrounded but they never 52:40 actually stick to it but they conspire 52:42 to dance around it in a way that gives 52:44 you exactly the same result as you would 52:46 get if you in fact had a pretty good 52:50 thing I'm going to close with one last 52:52 comment this is from a student from 52:54 about I think two terms ago a guy called 52:57 chase Lambert who was took this class 52:58 and I was very gratified to hear this 53:01 because it turned out he in turn or he's 53:02 working a worked or working at a company 53:05 called Quizlet which is a startup 53:07 company and one of the things he had to 53:09 do was a load generator and he ended up 53:11 using exactly these ideas to come up 53:13 with a load generating scheme that was 53:14 stable because you want to be able to 53:16 generate load that allows you to measure 53:18 the throughput of a system and he used 53:20 this random backup idea so it's not that 53:22 you'll find these ideas useful only if 53:24 you were doing you know this kind of 53:26 networking you actually find these ideas 53:28 useful in other contexts so I'm going to 53:30 stop here we'll pick up on some of these 53:31 topics and recitations and then back 53:33 here on Monday