 We've gone through before the management part of the Macla, how to join and discover a network. Now we want to look out once we've joined a network, how do we transfer data? We want to provide efficient, robust and fair data transfer. So what does that mean? Efficiency, we want to deliver data across a wireless link. We know normally wireless links especially compared to wired. We have a limited number of resources. Is the data rate is often an order of magnitude less than an equivalent wired cost technology. And we have limited bandwidth. So efficiency is about trying to minimize any overheads so that we make good use of those resources. So that's an aim of the Macla to minimize overheads. If I want to send data, I don't want to spend a lot of time doing other things, not transmitting data, sending acknowledgments and so on. That increases overhead. Robust in our wireless link, we expect there could be errors. I will send some data and it will not be correctly received by the receiver. So we'd like to fix those errors, handle those errors. So we need a protocol that can deal with errors and also be efficient. We know the basic way of dealing with errors. We send a data frame. If the receiver doesn't receive it or if the receiver detects some error, then it will not respond with an acknowledgement. If everything's okay, the receiver sends back an act. That's one way to deal with errors. I send data, I expect an act back. If I don't receive an act, an acknowledgement, that suggests something went wrong. So a retransmission, and then we retransmit the data. That's a retransmission scheme or an ARQ scheme. We'll see that 802.11 uses such a scheme. We send data. We should respond with an act. If we don't receive an act, something's gone wrong and we'll deal with those errors. The other aspect that we'd like is fairness. Fairness is about treating all the devices in the network equally. From now on, we're going to refer to the devices as stations. So up until now, we've spoke about clients and access points. And they have different roles. Clients, for example, laptops, associate with an access point. But when it comes to transferring data, once you're associated with an access point, access points and clients are treated the same. Generally, we call them a station. A client is a station, a wireless land station, access point is a wireless land station. In terms of the details of the protocol we go through, they are no different in terms of the data transfer. An access point behaves the same as a client with data transfer. Not with management of the network, but just with data transfer. So sometimes we just say a station. Fairness is about giving all the stations an equal share of the wireless medium. With wireless, we have a broadcast radio environment. When we transmit, everyone within range can receive or can hear that transmission. And we've defined before that if two people transmit at the same time, and a receiver receives both of those transmissions, then that's called a collision in that the receiver cannot understand anything that was transmitted, i.e. we have errors. We don't want that to happen. We want to avoid the errors, collisions for example, but also make sure that if multiple people want to transmit data, then they all get an equal opportunity to send their data. For example, there's my laptop, there's your mobile phone, wanting to send data to the access point. We should get approximately 50% of the opportunity to send our data. I shouldn't be able to send 90% of the time while your phone just sends 10% of the time. That would be unfair. Fairness is equal share amongst all the devices. And a reminder of some of our assumptions that we've covered earlier in this topic. If two nodes transmit at the same time and the receiver is within range, then a collision occurs, lost data. No data is received. And that sets up the aim of the 802.11 MAC data transfer protocol. The aim is to avoid collisions. Because collisions lead to lost data, and lost data leads to retransmissions, which leads to a longer delay before we receive the real data, we get lower performance. Collisions can significantly reduce our throughput and increase our delay, which is bad. Collisions occur when two or more stations send at the same time. Therefore, the goal of the MAC protocol is to ensure only one station or one node transmits at a time. If only one station transmits at a time, there will be no collisions, and therefore, there will be no lost data due to collisions. And our performance should be okay. So that's the goal. There are two ways to provide that approach. In the original 802.11, two ways for transferring data. One's called DCF and the other one's called PCF. DCF stands for Distributed Coordination Function, and Point Coordination Function is PCF. So these are functions or algorithms for coordinating who transmits. Distributed means the algorithm is just distributed amongst all the stations. Point Coordination Function, there's a single point, the access point that coordinates who transmits. Today, DCF is the main one used. In the original products, although both were available, DCF is mandatory when someone builds a wireless LAN device, they must implement DCF. PCF was optional because a complexity of PCF originally was not even included in devices. Nowadays, some of the devices you buy support a similar function to PCF, but almost all the time then when you transmit data, you're using DCF for a small variant of it. So most of the data transfer is based upon DCF. And that's all we're going to cover in this course, DCF. Before we look at it, let's... PCF in a very simple term is a polling-based system. The access point says, this client can send. And then it says, okay, now another client can send. So the access point tells the clients when they are allowed to send. Since it's controlled by one central device, the access point can set up a schedule such that no two clients are sending at the same time. So it's like me saying one can transmit when they've finished sending their data, now someone else can transmit. And because a client only transmits when an access point tells it to, no two clients transmit at the same time. So a polling-based transfer controlled by the access point. It's more complex than DCF and hence wasn't implemented in most of the early devices. DCF is distributed. There's no difference between an access point and a client. They all are just stations that want to send data. Distributed in that they independently make their own decisions when to send. There's no one device telling them when to send data. It uses a mechanism called carrier sense multiple access, CSMA. And CSMA was used in the original wired LAN, Ethernet. Multiple access allow multiple devices to access the wireless medium at the same, allow multiple devices to access the wireless medium. Carrier sense, sense is about listening to see whether someone else is sending. And if someone else is sending, you will not send. If no one else is sending, then possibly you can send data. That's the idea. So carrier is about the physical layer and listening in onto the signal. Sense is like listening. So it uses CSMA. In the wired LAN, CSMA was used. Wireless LAN uses a small variation and it uses this feature called collision avoidance. In wired LAN they use collision detection. The differences in the wired and wireless means that collision detection is not possible in wireless LAN. We'll explain later what collision avoidance is or the mechanism. So let's go through DCF. One station transmits at a time. So we need an algorithm that each node follows without exchanging information about what to do with other nodes. They all follow this algorithm and with the aim that if they all follow the algorithm, only one of them will send at a time. So it's implemented in a distributed manner and clients and access points are the same. We call them stations. Within DCF itself there are two modes of operation. One's called basic access and one's called RTSCTS mode. And the modes are selected depending upon the size of the piece of data that wants to be sent. The smaller data basic access is used for larger data RTSCTS. We will go through both modes separately. Explain basic access first today and maybe get on to RTSCTS. In DCF there are four types of frames. There's a data frame. It has a header, the payload, the information we want to transfer to the other station and a trailer. The size varies even of the header and trailer. Some typical values here, often the header and trailer around 34 bytes. It can change in some special cases. And the data is limited up to a maximum of 2,312 bytes. Typically because wide lands use 1,500 bytes, wireless land will limit to 1,500 bytes as well. And the very basic mechanism is the source sends a data frame to the destination, the destination sends back an acknowledgement frame. There's an act frame. There's no data contained in the act. It's a small frame, for example, 14 bytes of header and that's it. And there are two other types of frames. Data and act are used in basic access mode. In the second mode, RTSCTS, there are two new types of frames called RTS, Request Ascend and CTS Clear Ascend. We'll come back to the purpose of them when we look at RTSCTS. Again, they're small, tens of bytes. So normally we send one large frame, a data frame, maybe 34 bytes of header, 1,500 bytes of data and then we expect a small act to come back. Of course, the larger the header and the act relative to the data, the less efficient will be. That's why we'd like to make the data large compared to the other parts. We've gone through the structure of the frame last week and we went through, gave some examples and we've gone through addressing. Let's go into detail how DCF works. So remember, always remember that aim only one station transmits at a time. How do you do that? Let's say in this class, everyone wants to say something. You're in a group of people. Everyone wants to communicate some information. But only one of you can send or talk at a time. What do you do? If you're polite, you may listen and see if someone else is talking and wait for them to stop talking. And if they stop talking, then maybe you wait a little bit of time and then if no one else was talking, then you would start talking. So that's a way in a distributed manner. It's distributed in that everyone is following their own rules as to when to talk. They don't exchange explicit messages with each other as to, okay, now you can talk, now you can talk. They all do it independently. We do the same thing in basic access. We have our stations. They all want to send some data. The concept is a station will transmit if the medium is idle. The medium is idle means no one else is transmitting. The medium is the wireless medium that we send our signals across. Idle means that from my station's perspective, it's not receiving any signal. It's idle. So if no one else is sending, then you can possibly send. If someone else is sending, that is, the medium is busy, then of course wait until they've finished and then possibly transmit. So that's the basic concept. We need to work out the details of that and see what happens if it goes wrong. See what happens or how long do we need to wait for the medium to be idle? How long should it be idle before we can start transmitting and so on? So we'll go through the detailed operation. We're going to go through from the perspective of one station wants to send data to some other station. It doesn't matter if it's a client or an access point, just we want to send some data. Let's look at what the steps are. When a station has data ready to send, first step is it checks if the medium is idle. So what that means is check if it receives a signal, meaning someone else is transmitting. So the radio is in the receive mode. If it receives a signal, which is strong enough, then the medium is busy, someone else is sending. If it doesn't receive a signal, then it assumes the medium is idle. But the medium must be idle for some period of time, and that's defined in the DCF. The first step is the medium must be idle for some period defined as diffs, the DCF into frame space. It's used for DCF into frame space, so it's some space or some time between doing things with frames. The value of diffs, the DCF into frame space, is defined for each physical layer. For example, for 802.11b, it's 50 microseconds. And for 11g, I can't remember the value, I've got it on one of the later slides. So for the different physical layers, there's a value defined for the DCF into frame space in the order of tens of microseconds. So the medium must be idle for that period of time. And then after that period of diffs, in fact, the medium must be idle even longer. What happens is the station keeps checking if the medium is idle, no one else is sending, and it must be idle for another period called a backoff period. In wireless LAN, diffs is fixed, the value. The backoff period is chosen randomly by the station. So for different computers, different stations, it may be a different value. We'll see the algorithm for choosing it shortly. If, from my station's perspective, no one else was sending for the DCF into frame space, and no one else was sending for the backoff period, then I can transmit my data. So when the backoff period is complete, transmit the data frame. So you transmit the data frame to the other station, and I don't know if we don't say it here. When the other station receives the data frame, they wait a short amount of time and then transmit an act back. So receive a data frame, wait a short amount of time, transmit the act. When I receive the act frame, everything's done. The data transfer is complete. The receiver, when they receive the data, they wait a short amount of time. That's called the short interframe space. We'll see that defined shortly. There are some other rules that we need to follow as well. If something goes wrong, if the medium is busy, we'll get to them in a moment. Let's keep defining some of the parameters we have. We have interframe spaces. The two ones that we care about are diffs and sifts. The DCF interframe space and a short interframe space. There was also an interframe space used by PCF, but we don't care about that. The short interframe space is the time from when the receiver receives the data frame until when they send the act. So you receive a data frame, wait for a short interframe space, and then transmit the act. And short interframe space is always less than diffs. And that's important. There's, we said, we wait for the diffs and then we wait for a back-off period. The DCF interframe space is fixed. The short interframe space is fixed. The value is defined. The back-off period is random within some range. When my station's about to enter the back-off period, what it does is it chooses a random number, R in this, an integer, between zero and some maximum value, CW here. And the back-off period is that random integer R multiplied by some other fixed value called the slot time. Again, the slot time is fixed and known in advance. We'll come back to the rest of that, the value of CW and how it changes after we go through an example. So we've got some parameter values and they're defined for each physical layer. So A2 to the 11B, there's some values for 11G, 11N, there are values and they're not always the same amongst the physical layers. They are the DCF interframe space, the short interframe space, the slot time and we'll see that there's a minimum and maximum value of this CW called our contention window. The back-off period is some random integer between zero and CW multiplied by the slot time. Let's look at some values and then go through an example. I think a few slides along, many slides. Here are some values of those parameters. Just for 11B, 11A and 11G. So for 11B, 50 microseconds is the DCF interframe space. So when I want to send data, I must check that no one else is sending for 50 microseconds. If no one else was sending, then I start the back-off period. And the back-off period, I choose a random integer between zero and 31. Multiply by the slot time. So let's say I chose 10, for example, between zero and 31. I choose 10. Multiply by the slot time of 20 means I must wait for 200 microseconds. And then I send my data and the receiver waits a short interframe space of 10 microseconds and sends an act back. If I'm using 11A, same procedure, but just different values here. And 11G and 11N as well. Just so I can remember, let's write them on the board. What have we got? And I'm going to go through an example. There are some examples on the slides. We'll go through some on the board. And just because I have the answers, it's going to be using 11B, which is a bit old, but we'll find the values are easier to work with as well. Because there are multiples of 10 divs. And in my example, I will not show the units just for convenience. Everything's in microseconds. 10 to the power of minus 6 seconds. So 50 microseconds. Sifs. So let's go back to our description. And the backoff period, we choose a random integer between zero and CW, where CW is initially CW min, the minimum value. So it's initially 31 in our case. Later, we'll see that it increases up to some maximum value. So to choose the backoff period, a random integer, random uniform between zero and CW. For example, 31. That's this. And the backoff period, I'll just call BO, is R times slot time. So that CW, we'll see is a contention window. We'll see the significance of it after we go through our first example. CW, originally is CW min, but we'll see the value of CW changes. It may change. It may take values between 31 and 1,023 in our case. So initially, it's the minimum value. Later, we'll see it can increase up to the maximum value. Whenever we have a data frame to send, it's always the minimum value. So if I have a data frame one to send, CW equals 31. The next piece of data I have to send, it's 31 again. But we'll see if we have to retransmit, we may have to, we will increase it. So that are the parameters we have. Let's go through the steps. And to illustrate what happens, we'll try to use these timing diagrams. They can both illustrate what happens, and we'll also use them to calculate how long things take. The way to read it first is time increases as we go from left to right. So in this diagram, each line represents what happens at a station. So in the example on the screen, there are three stations, stations A, B, and C. And for each station, we show the operation that it's performing, or the stage it's in, in terms of the protocol. For example, in this period, it's waiting, it's checking that the medium is idle for the diffs period. Then it's checking that the medium is idle for the backoff period. Then it's transmitting data, and the data transmission takes time. And then, so remember the simple steps, wait for diffs, the medium must be idle. If it's idle, wait for backoff. If it's idle during that period, transmit the data. Depending upon the size of the data frame and the data rate we have, it takes some time to transmit. The receiver, in this case B, receives the data. Once it's received the entire data frame and checked, it's okay. It waits a short interframe space, and then transmits an act in response. And once A receives that entire act, that data frame transmission has been completed. We've finished one frame transfer. And then we can proceed to others. So if you ignore the rest of the details, going diffs, backoff, data, sifts, act, that's the normal case. Assuming nothing, there's no interference, nothing goes wrong. So remember those steps. Diffs, backoff, data, sifts, and act. We will try and calculate how long it takes to transfer the data. And from that, look at the throughput and delay incurred from using the wireless LAN MAC protocol. In this example, of course, there may be other stations that want to send at the same time. So we have station wants to send data to B. So I show here that at this point in time, A has data ready to send to B. So it now follows the steps. No one else is transmitting. Well, assuming there are only three stations in the network, or in the vicinity of each other, B is not sending here, C is not sending. So the meeting would be idle. So we think about when is the meeting idle and when is it busy. It's idle if no one else is sending. If no one else is sending, it's idle for the diffs, so we proceed to backoff. We choose a random number, and the backoff is that random number times by the slot time, some period of time. If it's idle for that period, and in this example it is because B is not sending, B's got no data to send. C is not sending, and start transmitting the data. And in this diagram, I show when the medium is busy by this rectangle here with the slope lines. This is indicating the medium is busy. Someone is transmitting. Because we have a broadcast medium, when A is transmitting from B and C's perspective, the medium is busy. Okay, so I draw that here. B, the medium is busy, and for C it's busy. And we can see for the rest of the cases. Now let's consider what happens if C wants to send some data as well. So A started, and then some time later, at this point in time, C wants to send data, and they want to send data to B. So they follow the rules. They check if the medium is idle. If so, proceed into the diffs phase. The medium must be idle for that entire duration of diffs. Where it's idle, it's idle, it's idle, and then it becomes busy. We start to hear the transmission from A. Even though A is sending data to B, because it's a broadcast medium, everyone within range receives that data, or receives the signal. So C starts receiving the signal and determines the medium is now busy. So when you are in diffs, or even in back off, the medium needs to be idle. If it becomes busy, you wait. So this is the idea of if someone else is sending, wait until they stop sending, and then try again. And sometimes that waiting is called defer. We defer our transmission until a later time. So C is not doing anything here, it's waiting. It's waiting for the medium to become idle again. It's busy, it's busy, and then A stops transmitting. The medium becomes idle. So from C's perspective, it restarts from the start of the diffs. It needs to be idle for diffs. It's idle, it's idle. Ah, it's busy again. Yeah, so restart from the start. So diffs means the medium must be idle. The medium must be idle for that period of time. If it's not idle for the entire period of time, then you wait until the medium becomes idle again, and you, as if you count from zero again, it must be idle for a full diffs again. So here for A's perspective, the medium was idle for the diffs. Here for C it was not. So it has to go back to the start. The medium must be idle for a full diffs. It's not in this case. Because it was idle for a short period of time, but then the act was started to be transmitted. So it becomes busy again. And note that diffs is always greater than the short interframe space. So that means when someone stops transmitting data, another station, C in this case, will not get to finish their diffs, because B waits just a short period of time and then immediately sends. So the act should always come back after the data, assuming there are no other errors. So from C's perspective, it waits for the, or defers for the act to be completed. And then the medium is idle again. So we go back to the start. Diffs, choose a rent. So the medium was idle for that period. Choose a random back off. So choose some random integer R between zero and CW, multiply by the slot time, and then wait for that period of time. And again, the medium must be idle for the entire back off. Any questions so far? We'll keep going in a moment. Any problems? What if diffs at the same time? I think that's a question about, well what if two stations want to send at the same time? We'll see what would happen. We'll see some examples later of what if different cases occur. We'll see it comes back to the random back off and why we have a random integer here. If they both start diffs at the same time, then of course the medium will be idle, but then they'll both start the back off at the same time. And most likely one will choose a different random integer than the other and get to transmit first. We'll come back to that example in a moment. Let's try and finish this one. We've got to a stage where C has data to send to B, A had data to send to B, successful, done. So A is finished from that perspective. Medium is idle for diffs. We start the back off. The back off is quite long in this case. Let's say we chose a large value of R, 30. It's random. In the meantime, B now has data to send back to A. Because A has sent data, maybe depending upon the application, now has something to return. So at this point in time, B has some data to send to A. So it follows the same steps. Diffs, okay. So look at the medium at all three stations. Look if it's idle or busy. Diffs, it's idle. Everything's okay. Choose a back off. In this example, let's say it chose a small random number. Three, for example. It depends upon the exact timing. But let's say it chose a random number such that it finishes its back off while C is still proceeding with its back off. So the time that C needs to back off is quite long. Maybe in the normal case, it may finish here. The time that B needs to back off is quite short. Of course, it just depends upon the random number chosen. So B finishes the back off, and when you complete the back off and the medium has been idle, send the data. So B transmits the data, which interrupts C's back off. Because if B is sending data, the medium is now busy. So station C must defer. It must wait until the medium becomes idle again. We saw that happen with C before. It started the diffs, medium became busy, it deferred, and then it has to restart the diffs. When it becomes idle again, interrupted, restart the diffs. When we interrupt the back off, we wait until the medium becomes idle again, start the diffs. We don't get the diffs completed because, in fact, there's a short interframe space, and then the act comes back. So the medium is busy, we're waiting, we're waiting. Start the diffs. And here's a thing that's different. We don't restart the back off, we continue from where we left off. So if I chose R to be 30, means my back off is 30 slots. If I completed 17 slots here, 17 of the 30 that I required to complete, when I continue, I need to do another 13. I don't need to wait for 30 slots, I need to wait for just 13, the remaining slots. So we continue the back off from where we left off. Once the back off is complete, send the data, although it's not shown here, there'll be a short interframe space and an act, and we'll be done. So first, in summary, the basic steps. Medium must be idle for diffs, medium must be idle for the back off. That's shown here, diffs, back off, then transmit the data. When B receives the data, it waits for the short interframe space. The medium doesn't have to be idle there, it's not checking, it just waits and immediately sends, or then sends the act, and then we're done. But if you have data to send and the diffs is interrupted, wait until the medium is idle again, and then start from the start. If you have data to send and your back off is interrupted, wait for the medium to become idle again, complete a diffs, and continue the back off. So it's a slightly different interruption of the diffs. Send the data, short interframe space, act. So this will see the consequences of this protocol in terms of how it provides efficiency, robustness and fairness, designed to meet those aims and will calculate the efficiency, and we'll see some cases of the fairness and how that's provided. Let's go through an example with some calculations. And the example, I'm not sure if you have it. Do you have it in the handouts? This one, maybe towards the end of the wireless LAN. It just sets some values to go through an example. And you also have just on the page after that some space to draw the diagrams, because I'm going to draw them on the board because we need a lot of space to draw them. But first, let's do some calculations. So in this example, we're going to see what happens when we have, we're going to use 80 to the 11b. It's a bit old, but I've got the values. We have a data rate of 11 megabits per second. So when we transmit the data, the time it takes to transmit depends upon the data size. So data size divided by the data rate, we get the transmission time. We have the diffs and we have these parameters. Let's make some assumptions about the size of frames, because we need to know the size to calculate the transmission time. Data header and trailer, 34 bytes. Act frame, 14 bytes. We're not dealing with RTS, CTS yet. How long does it take to transmit the data frame? We need to know the data size. In the example we're going to go through here, section 3, the basic access. We're going to assume there are three stations. Two clients, AMB, and a single access point. And in all cases, the amount of payload to be sent is 1,341 bytes. Calculate the transmission time of the data frame. That's the data size plus the header. What's the transmission time? So in the previous case, we had the data frame. It's made up of header, payload, the actual data we want to communicate, and a trailer. And we said the header plus trailer is 34 bytes. For these two together, 34 bytes. And in our example, the payload is 1,341. What's the transmission time? How long does it take to send this data frame? We've got a total size of 1, 3, 7, 5 bytes. And our transmission time is simply the size, the total number of bytes we need to send divided by our data rate. Our physical layer transmits our bytes at 11 megabits per second. It was given in the 11B characteristics. So 1,375 bytes divided by 11 megabits per second. You will use your calculator and you'll get anyone around. I want exact. This one, it is on the website somewhere. Yes, it's there. If you follow the links and the handouts for wireless LAN. What's the answer? One millisecond. 1,375 multiplied by 8 is 11,000. 11,000 divided by 11 megabits per second. And let's do it in microseconds. 1,000 microseconds. Let's do everything in microseconds because our value is up here in microseconds. Just for convenience in adding things up. So the data transmission time is 1,000 microseconds. And that's why I chose this strange number of 1,341 bytes. Just so that the answer is 1,000. So let's record that data. I'll just write data. We know it's the transmission time of 1,000. And we also will have an act. And I'm going to simplify things to make it a little bit nicer. I said the act was 112 bits, 14 bytes. Or let's round it down to 100 bits. Because 100 bits, there's one other factor. Let's make it clear. That was our data. What about the act? The act is 14 bytes or 112 bits. For simplicity, let's change it to 100 bits. Approximate. Just so my numbers are easier to work with. You will not do that in an exam unless I tell you to. You will use the exact value. Or I'll give you a nicer value. I'll say it's 100 bits. Now, there's a slight difference here. The data we said is a cent at 11 megabits per second. So it's the data size divided by 11 megabits per second. With control frames, the non-data frames, often they are sent at a lower data rate. Usually the lowest data rate. And in particular, an act frame is sent at, so we have 100 bits. We transmit it in 11 bits at 1 megabit per second, in order to 11 megabits per second. So in fact, your radio device changes the data rate. The data is sent at 11 megabits per second, and then the receiver sends back at 1 megabit per second. Why? Because the control frames, acts and others, RTS, CTS, and even beacons, if you send at a lower data rate, a receiver further away can receive. So if you move up to a higher data rate, that effectively the transmission range reduces. With a very low data rate, you can send a long way. So the idea of sending at a low data rate, the control frames, means other stations can hear this. Even stations which are a long way away can hear it and know about what's going on. So in most cases it's just the data that's sent at the high data rate, and the other frames may be sent at a lower data rate. The exact data rate may differ on the different physical layers. If that's the case, we get an act transmission time of conveniently 100 microseconds. So our data transmission time is 1000 microseconds, the act is 100 microseconds. 100 divided by 1. Again I just chose the sizes so these numbers are nice. Let's use that data to calculate how long it takes to send our data, and then look at the efficiency of our protocol. You have this, what else do we have from there before we remove it? So we've got the scenario 3 here. All stations are within range of each other. So A can hear the access point, and also can hear B, and vice versa. So all stations can transmit and receive directly to each other. Our scenario is that client A has some data to send it to the access point, and they have it at time zero. So we're going to count time from when A starts sending to the access point. 1,420 microseconds later, the access point has data to send to A in this case. So I'm just making up some times when the stations want to send data, and then 220B wants to send to the access point. And when they choose random numbers, each station chooses independent. Your computer chooses a random number between zero and CW to make my calculations easier. Let's say A chooses 10, access point chooses 3 as a random number, and B will choose 10. There's no link between the two values A and B chose, so random. With that information, let's calculate and draw how long it takes to transfer the data. Any questions about the setup before we remove this? Because I'm going to draw on the entire board. So just the transmission times and some of the characteristics of the physical layer. Let's try and draw what happens at those three stations, A, access point, and B. And this is what's going to happen over time. So we're going to draw the operations over time, see if I can get this straight. So time is increasing as we go to the right. And all the times will be in microseconds. So when we start, A has some data to send to the access point. And that's at time zero. That's when we start this exam. What happens? Diffs. So when a station has data to send, it checks if the medium is busy or idle, checks if anyone else is sending. Access point is not sending, B is not sending. Note that B is sending from our numbers at time 220. Checks for the diffs. And I'll draw that here, some period of time, diffs. If we started at time zero, the diffs would finish at time 50. 50 microseconds later. So record the times. No one else is transmitting. So that was successful when we completed the diffs from A's perspective. And then what happens? Back off, how long? Choose a random number. And what value does it choose? Let's say it chooses 10. It chooses a random number between zero and 31. And let's say this time it chooses 10. It chose 10. Next time can be five. So 10 times 20, that is 10 slots. So we think we count in slots. Each slot is 20 microseconds. So the back off must be 20 times 10. 10 slots, 200 microseconds. So we start the back off, BO. And let's just note we chose 10 as a random number. So it needs to be 10 slots long. And when would it finish? 250 somewhere around here. On the setup of the scenario, we say that time 220 B has day to descend. So let's, remember these are three different computers. They don't know what the other computers are doing. B doesn't know that A is doing diffs and back off. All it's doing is counting a timer inside the computer. It's not sending anything, receiving anything. All it's doing is, okay, it starts a timer. A is sensing or listening and seeing if it's receiving a signal. No signal being received for 50 microseconds. Okay, now let's start again. No signal being received. I'm going to wait up to 250. In the meantime, B has some data to send. This won't be exactly to scale, but at time 220. So B will start the procedure, diffs. Remember, it's a distributed system. We need to consider what the devices are doing in parallel. When will its diffs finish? Starts at 220, 270, it should finish. But let's consider what the other stations are doing. What the other stations are doing. This would finish at 270 if no one else was sending. But A is going to finish at time 250, 10 slots. So let's draw what A, the back off, say it's here, at time 250, which is 20 times our 10 slots. And when we finish the back off, what does A do? It transmits the data. When will it finish transmitting the data? 1, 2, 5, 0. Start 250, takes a thousand microseconds to send. 1, 2, 5, 0. It will finish. And maybe it's hard to show here, but that means someone's transmitting. During that time, from the other stations' perspective, from access point and B's perspective, the meeting will be busy. And especially from B's perspective. Because the meeting became busy at time 250. That transmission interrupted B's diffs. What does B do? It didn't finish the diffs, it should finish at 270, but at time 250 someone else started sending. What does B do? We say it defers, it waits. It waits until this meeting becomes idle again. So we can write here, it's waiting. And of course it will go up to 1, 2, 5, 0, defer. It's not transmitting anything. So when we draw diffs back off, defer, the station is not transmitting anything. It's just maintaining an internal state saying, I cannot do anything until this meeting becomes idle again. And when it becomes idle, then it moves up to the next stage. What happens next? Who does sifts? The access point. So A is sending data to the access point. Transmitting the data, transmitting everything's okay. No one else is transmitting, hence no collisions. At time 1, 2, 5, 0, same time here, the access point has received the entire data frame. Okay? So once they receive the data frame, they check, it's okay. It doesn't take any time or any significant time. And then they wait for a short interframe space, sifts, wait for a short interframe space, and then immediately send back the AC. I'll draw the AC here. So the short interframe space is 1, 2, 5, is 10 microseconds. So it takes us to 1, 2, 6, 0. And the AC is 100 microseconds. So it takes us to 1, 3, 6, 0. So that's this time here. Check that I've on the right track. Yep. So access point transmits the AC. And at time 1, 3, 6, 0 here, station A has delivered the data successfully to the access point. From that data frame's perspective, that piece of payload, it's done. Diff's back off, data sifts back. It took 1, 3, 6, 0 microseconds. If we just briefly focus on that data transfer, how efficient were we in delivering the payload? Just ignore B. From A's perspective, how long did it take to deliver the payload? It took 1, 3, 6, 0 microseconds from 0 up into here to deliver the payload. Assuming it has more data to send, then it needs to do the same procedure. And if it always did that same procedure, then every 1, 3, 6, 0 microseconds is delivering, what do we have? 1, 3, 4, 1 bytes. So we'll remove this in a moment. Every 1, 3, 6, 0 microseconds, the payload, the data frame contain header, trailer, and 1, 3, 4, 1 bytes of payload. So we delivered 1,341 bytes of payload in 1,360 microseconds. That gives us a throughput. Assuming we'd always sending 1, 3, 4, 1 bytes and it took 1, 3, 6, 0 microseconds, then that would give us an indicator of throughput. How much payload, or what's the rate at which payload is being delivered? That is payload divided by time. Whatever the value is, multiplied by 8, I would need a calculator. You don't have to calculate that. We'll see later some summary statistics. It's 7.8 megabits per second, 7.88. Remember our physical layer data rate is 11 megabits per second. The throughput just for that individual frame, we could say is 7.88 megabits per second. It's not the maximum of 11. Why not 11? Even though we're sending the payload at 11 megabits per second, we also spend time sending nothing. And we also spend time sending header and trailer and we spend time receiving an act. So the throughput is the measure of the rate at which the real payload gets delivered. And that's a fraction of what the full data rate of 11 megabits per second is. In practice, looking at an individual frame to calculate the throughput is not very accurate. You need to look at a sequence of frames. That is, let's say I send 1,000 frames. Find the total time, do this 1,000 times and then work out 1,000 frames divided by the total time to get more statistical accuracy. So we're seeing some overhead or some inefficiency arising. Let's continue. What have we got? Five minutes left. Let's continue and see what happens at B because A is finished. B deferred up to 1,250. Then what happened? In fact, at 1,250, medium is idle again. So start the diffs, but at 1,260, it becomes busy again. Diffs should last for 50 microseconds. It only lasted for 10. We were interrupted, so we stop again. We defer because the act and 1,360 and now the medium becomes idle again. What happens next? Diffs again. We start it from the start. And when's the diffs going to finish? 1,410. Next, back off and it chooses, only because I have the answers, it chooses 10. Luck, which would take it to, it chooses 10 as a random integer between 0 and 31. It chose 10. No reason it chose the same value as this. It's just unlucky or lucky, however you want to look at it. 10 times 20, 200 time units. So it would take us to 1,610. It would finish the back off. But the other thing is the access point has data to send. At time in the question 1,420, add some more complexity. At time 1,420, access point wants to send data. While B is in the back off period, access point diffs. When's it take us to 1,470, back off, chooses 3 as a random number. Again between 0 and 31 chooses 3. 3 times 20 is 60 would take us to 1,530. So the access point will finish the back off period at 1,530. No one else sending. A is not sending, they've got nothing to send. B is not sending yet. They're still in back off, which should finish at somewhere at 1,610. But in fact the access point starts sending the data because they completed the back off first. So this random integer for determining the back off length impacts upon who gets to send first. We'll see some different cases later, but we see that whoever chooses the smaller value, choosing a smaller value gets you a higher chance to transmit. In this case, A had data, or A started the diffs after, sorry, access point started the diffs after B. But because they chose a small random value here, 3, whereas B chose 10, access point gets to send the data first. Because we would interrupt the back off, we'd have to defer, and we'd see the same here. We'd see it takes 1,000, 2,530, SIFS, so SIFS is 10, which is 2,540, ACK is 100, 2,640, and from B's perspective, it had to defer. It would start the diffs here, but it would be interrupted because of the ACK. Because of the ACK, and have to defer again, and what's next? So although I've skipped through this part quickly, it's the same as here. Data, SIFS, ACK, and the other station defer during the data, start the diffs, but interrupted by the ACK, defer during the ACK, and then done. The data has been delivered to station A, what happens next? We're almost finished, diffs. Takes 50, brings us to 2,690, back off. How long? Calculate the value. So here's something we haven't seen. Here the back off was 10 slots. So think we count in terms of slots, complete slots. 10 slots, 200 microseconds are needed. We completed 120 microseconds. We completed six slots. So the back off, we need to wait for 10 slots in total. Here we've done six of those 10, 120 out of 200. Because 1530 minus 1410, 120, or six slots. So here there are four slots remaining, 80, and then we'd send our data, and I'm out of room and out of time. And you'll see that you'll just finish. There'll be data, SIFS, and ACK, and you'll complete. For reference, the final ACK is at time, if I can read my own writing, 3880. So you can complete that and you'll see that the ACK is finally received at time 3880. So we've seen the basic mechanism of DIFS, back off, data, SIFS, ACK. We also see deferral. If we interrupt the DIFS, then we restart. But if we interrupt the back off, we continue completing the number of slots we haven't completed yet. So here we've done six of the 10. We've got four remaining. There are some more details to go through. What happens if different cases arise? We can still get collisions. How? What do we do in the response of collisions? We'll go through them next week and we'll try and finish on Wireless LAN Wednesday and Thursday next week.