 So we can calculate the transmission delay. Note we have two types of frames. Data and AC. Data frame, 1,000 bytes of data, 20 bytes of header. Data rate, 1 megabit per second. The transmission delay of the data, we have 1,020 bytes, divided by 1 megabit per second. Squeeze that in. Why 1,020 bytes? 1,000 bytes of data, 20 bytes of header. We must transmit all of that. So that will give us how long it takes. Convert your bytes to bits. You get 8,160 bits. 8,160 bits divided by 1 million gives you 8,160 microseconds. 8,160 microseconds. You can calculate also the propagation delay. You know the link distance. You know the speed. We'll need that. So let's calculate it. Far. We've got 2 kilometer link. 2 by 10 to the power of 8 meters per second. Which is how many microseconds? Someone calculate for me. And it's nice to keep the same prefix, micro. It makes our calculations easier when we sum. 10 microseconds. Use your calculator fine. The other thing we'll need in a moment is we know that we send data from A to B. What does B send back to A? What does B send to A? Anyone? What does B send to A? What's the name of the frame? An act frame. How big is the act frame? Act frame is 20 bytes, so we can calculate the transmission delay of the act frame. We need that. So we'll calculate that here. 20 bytes. It's just header. There's no data. We've got about 1 megabit per second. What do you get? 160 microseconds. And the other delay we have, which is in the question, is the processing delay. B, whenever it receives a data frame, takes 1 microsecond to process that. And then it is ready for more. I will not write that. We'll draw it in a moment. So now let's start drawing our diagram of the stop and wait flow control and note the times that each step takes. This is the data frame and represents the transmission of the data frame. I want to note data 1, because we've actually got three data frames to send. Let's say that's the start of the process. So let's allocate the time and say that started at time 0 at this point. And we'll keep track of the time as we go. So time 0 is when everything starts. I will not write the units of microseconds just to save space. So 0 microseconds. Let's count in microseconds. I start transmitting the data frame at time 0. At what time have I finished transmitting? Start at 0, finish at time 8, 1, 6, 0. Easy. So think of this point here as 8, 1, 6, 0. We've finished transmitting at time 8, 1, 6, 0. What time does B fully receive data frame 1? 8, 1, 7, 0. The way to think of it is that at time 0 I start sending. The signal representing that first bit of the data frame comes out of my computer and starts propagating across the link. So that signal representing the first bit arrives at the destination B. What is it? 10 microseconds later. If it's transmitted at time 0 the first signal will be received at time 10. But then I send the second bit out of my computer and that propagates across. And from the perspective of when is the entire frame received I send the last bit at time 8, 1, 6, 0. That last bit or the signal representing that last bit comes out of my computer at 8, 1, 6, 0. And it propagates across the link and arrives 10 microseconds later so it arrives at 8, 1, 7, 0. And that's what we care about when does the last bit arrive. Because we cannot do anything with the frame until we've got the entire frame. Sometimes we may try and draw if I go back like in this case I tried to illustrate the first bit arrives at this time the last bit arrives here. But just to keep the diagram clear I will not draw the first bit arriving or most times I won't I may for this one but usually we care about the last bit because that's when the frame is fully arrived. So that's the one of interest. My diagram is not to scale. Yours does not have to be either. So that would be the arrival of the first bit more importantly the arrival of the last bit. First bit would arrive at time 10 because there's a propagation time from here to here of 10 microseconds the last bit would arrive at 8, 1, 7, 0. Then what happens? What does B do now? B just received the entire frame they start checking it and they process that frame checking the destination is correct checking the parity bit or other information using the data and it takes some time and in the question we said it takes one microsecond per frame. In other cases it would be different. So it takes one microsecond to process so 8, 1, 7, 1 after we've processed we can then send back the act saying I'm ready for more. So at 8, 1, 7, 1 I start transmitting my act and the act will take 160 microseconds to transmit. So we draw the transmission of the act act 1, it's the first act the number is not so important. When have we finished transmitting start at 8, 1, 7, 1 plus 160 brings us to 8, 3, 3, 1 that's this time and when does it arrive at A, another 10 microseconds later so the act fully arrives at A at time 8, 3, 4, 1 and then we've finished that single data frame transfer we can move on to the next one A is allowed to send the next piece of data it had 3 in this example transmits the next one and you'll see that it follows the same process assuming the timing is the same 8, 1, 6, 0 to transmit another 10 to propagate 1 to process 160 to transmit the act back plus another 10 to propagate then we'd receive the second act then we can move on to the next data frame but just focusing on the first one any questions about this exchange I will not draw the next two frames but it would be the same shape but instead of starting at time 0 we effectively start at time 8, 3, 4, 1 plus 8, 1, 6, 0 plus 10 plus 1, plus 160 plus another 10 and we'd get back to the reception of the second act when is the act for the third frame received without drawing it can you calculate when maybe easier when is the act for the second frame received when is the act for the second frame received think about it from the perspective how long did it take to transfer one frame and get an act back started at 0 took us 8, 3, 4, 1 microseconds and in the second frame it would be the same, nothing changes it's the same data size same propagation, same processing same act, transmission so in this example the second frame would take another 8, 3, 4, 1 microseconds bring it to 16,682 plus the third frame another 8, 3, 4, 1 in this simple example it's the same for each frame transfer one frame transfer takes 8, 3, 4, 1 microseconds and each subsequent takes the same amount of time and I will not draw or even try to scale the second one would be 2 times this and definitely not to scale the reception of the third act will be 3 times 8, 3, 4, 1 which is I have a number somewhere 25023 so without drawing the exchange or even keeping it to scale the third act would be received at this time now the question asks what was the throughput different ways to think about the throughput but the best way is to think what if there weren't just 3 frames but we kept sending frames what if we had 3, 4, 5 a million frames or an infinite number of frames being sent then we just repeat this pattern just keep repeating it think from A's perspective what is the rate at which A is sending original data again the data rate of our link is 1 megabit per second that is the rate at which A sends bits across the link but what we're interested in is what is the rate at which A sends original data over a long period of time look at A here's the data frame remember the data frame is made up of header plus data the data frame the part of it is real data there's a small part which is header the purple part I tried to illustrate that's the original data the other part is the header the 20 bytes of header so from A's perspective at what rate is it sending original data if we keep doing this forever so think about how much original data per period of time well for one frame transfer it takes 8341 microseconds how much original data it was 1000 bytes remember our frame was 1000 bytes plus 20 bytes of header so every frame transfer we deliver a we send 1000 bytes of original data and it takes 8341 microseconds the next frame transfer we deliver where we send the same amount of original data and it takes the same time so we keep going at this 1000 bytes every 8341 microseconds so that's the rate at which we send original data 1000 bytes divided by 8341 microseconds assume we keep going forever so A is sending 1000 bytes of real data every 8341 microseconds then then how much is B receiving well everything that A sends B eventually receives there's nothing lost there are no errors so if A is sending 1000 bytes every 8341 microseconds that means that B must be receiving 1000 bytes every 8341 microseconds because everything that is sent is received and you can actually check that and if you kept drawing this diagram you look at from when the first piece of data is received until the second one it would be 8341 microseconds and if you kept going every 8341 microseconds B would receive data in this case there's no data lost so everything that is sent must be received by definition of throughput throughput is at what rate do we receive original data 1000 bytes every 8341 microseconds and someone will calculate for me because I think I have the answer someone will calculate the exact value for me 1000 times 8 to convert the bits and divide by your time of 8341 959118 about 959000 bits per second what's the efficiency when we use this stop and wait protocol our link rate is 1 million bits per second we're delivering data at a rate of 959000 bits per second so the efficiency is 95.9% that is divide by our link data rate just a reminder the data rate so we have a link that we can send a million bits per second but we're on average only sending 959000 of real data 0.959 or as a percentage 95.9% so with this protocol we've got our link but there are some overheads involved we don't get 100% efficiency because we spend some time doing other things than sending original data so we can think the overhead in this case is 4.1% that is 4.1% of the time we're not sending original data across the link 95.9% of the time we are sending original data across the link what is the overhead well we may see it from the picture that is what contributes to the overhead look at this period of 8341 microseconds the frame transfer look at the purple period that's the transmission of the original data sometimes we're sending header that contributes to the overhead that's not the real data being sent and from A's perspective sometimes we're waiting that's overhead the longer we spend waiting the less efficient we'll be and we can do it the same from B's perspective it's receiving original data except when it's receiving the header that header reception is overhead and sometimes B is transmitting an act sometimes it's processing and I think if you draw the next data frame sometimes it's waiting for the next data frame so in terms of using the link we're only using it 95.9% of the time to send the real data and that's our measure of efficiency any questions on these calculations I think you should probably draw the diagram in full for the three frames just to be sure you see what's happening with that it repeats each time and the other thing to be make sure you're clear on is that if we're sending at this rate by the fact that we're not losing any data it must be me receiving at the same rate because everything that is sent is received nothing is lost and we don't receive more than what is sent that's not possible and hence we can get the throughput at the receiver the efficiency of the use of this protocol any questions we'll be back to our quizzes this week our assignment which be released either this week or next week will be on this beyond doing some experiments in groups to measure the efficiency and throughput under different situations so I'll give you some software to learn more about flow control and even error control I want higher efficiency how do I get it how do I get this to go up the efficiency you reduce the data rate okay you reduce the data rate but what does that change reducing the data rate will increase our transmission delay so not necessarily in some cases yes but I think from you see in the equation reducing the data rate would increase the efficiency except be careful reducing the data rate of both the ACK and the header but yes I think if you run through the numbers in most cases that would help if you look at this picture what else can we do think from the sender's perspective when does it waste time waiting for the ACK the sender think of it's transmitting the header that's wasting because if we had less header to transmit we would have smaller total time but the same amount of data would have higher efficiency so keep the header as small as possible but sometimes we can't control that the other time that the sender spends waiting is waiting for an ACK well again that is due to the propagation delay which we normally cannot control it's depending upon the link and ACK transmission time if we make the ACK transmission time smaller we'd wait less time and we get the response earlier giving us higher efficiency so we need to consider these different factors of propagation delay transmission time of data and ACK and the header size to determine how to maximize our efficiency and there are some trade-offs that we'll see at the time generally the larger the propagation delay with respect to our data transmission the less efficient we are did we get to the end I'll show you an example of that you don't have to calculate a draw but just the concept I will show you this again tomorrow but just to illustrate the trade-offs the first case on the left is a case and I haven't put numbers to it here's the transmission of the data and I've tried to highlight that as the green bar transmitting of the original data relative to the total time the red bar we want the green one to be large relative to the red bar that's more efficiency green is representing the time to transmit original data the red is the total time in our case the green bar length would have been 8000 microseconds and the red one 8341 we want the green one to be large compared to the red one here's a case where we increase the data size instead of a thousand bytes maybe 10,000 bytes small header one large data frame it makes the transmission time larger means we spend a lot of time transmitting original data and relative to that only a small amount of time waiting this center one center one is more efficient than the left one by increasing the data size and keeping everything else the same we can increase the efficiency increasing the payload which really means the original data or decreasing the data rate like you said decreasing the data rate increases our efficiency in this case with everything else is fixed the other way compare the center and the right one large data frame if we had a high propagation delay would be less efficient increased propagation delay in this case reduces the efficiency brings us down again the middle one is the best case in terms of efficiency so in general it's about we want a large transmission time relative to the propagation time we'll do some more analysis of that and give some more examples tomorrow and we'll show that one again what you'll do before tomorrow's lecture just confirm these calculations in your own mind make sure you're clear on how to come up with this there's always an exam question or a quiz question here's stop and wait here are the numbers tell me the time it takes to transfer the data or tell me the throughput let's stop there and continue tomorrow