 We said in in communication networks We send data from a station to another station via a set of intermediate devices, which we call switches and There are different approaches for those switching devices to to forward the data through the network and we've mentioned circuit switching based of developed for telephone networks where we Make a call we place a call before we transfer data We set up the connection or the circuit we sometimes call it a connection or a circuit and then we transfer data and then we at the end of the previous lecture we introduced packet switching where we in circuit switching when we set up a connection we essentially have a Long link from source station all the way through to destination station and to transfer the data We can just Source transmit the data at the source computer Flows all the way through to the Destination computer. There's no concept of that's necessary with circuit switching But with packet switching we break that data into Smaller chunks we call packets and send them one at a time Why why do we need packet switching when we have circuit switching? Well, we finished on some example showing a network where A, B and C wanted to send a D and F through one shared link between switch one and switch two and We we made up some numbers to say that that link shared between switch one and switch two has a capacity of two units maybe two megabits per second and The links from A, B and C to the switch one have capacities of one one megabit per second Now if all three of the Sources want to send at the same time at full speed They all send at one megabit per second then of course we're going to overflow this link that our link cannot support three only support two and With circuit switching what we do is before we let A, B and C send their data They first set up a connection or circuit to the destination and that process of setting up the connection Involves this switch S1 checking. Can I support the connection from A to D? For one megabit per second well the switch would know what's currently reserved for this link to switch to if there's nothing currently reserved It supports the new connection from A to D then B connects to E and that's except Because we have a capacity of two and we currently have reserved for A to D So we can allow B to E But when C tries to connect to F Switch one is going to reject that connection request. It's going to say You're asking for one megabit per second, but my link Along the path of the destination this link to switch to I don't have enough capacity to support that So with circuit switching the connection from C would be rejected AMB Guaranteed one megabit per second Even if they don't use it they can That's reserved for them C cannot send anything That's the problem with circuit switching is that even though AMB Teed one megabit per second if they send less All right, that's the upper limit they can send but if they send less then we waste some resources If they send a small amount then the link between S1 and S2 goes unused and that's inefficient So with packet switching we send packets one at a time and Allows us at the switch say if we do not reserve any resources And under the conditions where AMB and C send at varying rates Sometimes a sends a lot Sometimes B and C is sending very little and then sometime later they may change so the amount that they want to send varies Then by sending it as individual packets and then at the switch one Gets those packets and sends them out on the link Assuming the total coming into the switch one is less than two then we can deliver all three of the sources later But for some periods of time when the totals of what's coming coming into as one exceeds to a Sending point six B is sending point eight C is sending point nine Then with packet switching what happens we save some of those packets which come in which we cannot send in a queue The other ones are sent out at two megabits per second those in the queue are then sent after that So when we have some some time available then we send those in the queue So eventually the data gets sent and This is very efficient Especially when a and B have varying sending rates because we only need a link from S1 to S2 of two minutes per second To support all three users Whereas with circuit switching we could only support two users The two users would get good performance, but our network would be inefficient So this is the main advantage of packet switching This network efficiency the disadvantage is that when a B and C do want to send at high rates Such that we do exceed the total of two The packets have to wait in the queue So one bad thing is that those packets will be delayed in the queue and this contributes to queuing delay From source to destination another delay component and the other problem is if If they're sending at a large rate for a long period of time eventually the queue may fill up Our queue is full of packets waiting to be sent. We send another one in we can't put it in the queue So the switching device S1 drops the packet our data is lost So we need ways to deal with that So that's packet switching versus circuit switching and the main advantage of packet switching and in the internet today We make use of packet switching the internet is built upon packet switching Because many of the applications we use in the internet have this nature of The amount that the user wants to send changes over time Sometimes your computer is sending a lot sometimes very little We there are two types of packet switching Datagram packet switching and virtual circuit packet switching Datagram packet switching is the simplest Source has dated a send split it into packets send them and Those packets are treated independently by the switches in the in this communications network Meaning if I send packet one two and three and the switch gets one two and three it doesn't Treat them as if they are connected with each other So it may take different decisions on how to treat the packets even though they're from the same source The packets normally have headers So we have data plus some overhead of a header to tell the switch where to send it who's the destination an alternative To datagram packet switching is to try and use the benefit of packet switching this network efficiency But also some of the benefits of setting up a circuit like reserving some resources in advance and That's where they arrive at virtual circuit packet switching like circuit switching before we send data we establish a connection and after sending data we tear down that connection and When we send our data will follow that same path where we've established a connection We'll go through a quick example of that. So we've gone through datagram packet switching We just send the packets they they go through the the network With virtual circuit packet switching before we send our packets We send a special packet to the destination saying I want to set up a circuit a virtual circuit or a virtual connection with you And once that they accept that then we start sending our packets The benefit of virtual circuit packet switching is that we can Again inform the switches on the on the path that we're about to transfer data They can Reserve or prepare capacity for the the packets that are coming coming So an example our source wants to send data with virtual circuit packet switching first a Circuit is set up or a connection So the packet is sent through the network and it chooses a particular path Once that path is set up then we send our data and it follows that same path each packet Goes along that same path Whereas with datagram packet switching they may traverse different paths Because in this case virtual circuit packet switching this switches. No This packet belongs to the connection that was established Between this source and destination and they know to send it on that direction This can be of benefit to say do things like a Provide some performance guarantees Set up a connection and we're going to guarantee you or try to provide a performance of one megabit per second for your data transfer or to give preferences to Some some source and destinations so you give priority to some data Compared to others all of the steves packets going through the network get high priority All of the students packets through the network get low priority as an example. This can support such features The problem with virtual circuit packet switching compared to datagram packet switching is it's more complex we need to set up a connection at the start and The switches along the path need to store some something in memory about that connection that can be Add significant complexity when we talk about in a large network We may have millions tens of millions of connections through a network not just one person sending data But hundreds of thousands of people sending data through the network We need to set up these connections all in advance and that that takes a lot of resources Where that's about all we're going to say about switching. I'll give two Two comparisons with respect to performance and then we'll move on Which ones used today well, they're all used in different scenarios, so telephone networks still use circuit switching Virtual circuit packet switching is used by some internet service providers or different technologies in large networks but a Very important one of the three is datagram packet switching because the internet that we use every day Is built around this simple protocol or simple technique of splitting our data into packets and sending them one by one independently of each other Datagram packet switching is used in the internet. So to finish, let's just compare them with two examples with respect to the performance especially timing First let's look at the packet switching approaches either virtual circuit or datagram and talk about how big the packet should be when we're sending across a pass and We'll go through four four cases of different packet sizes and we'll talk about well What's the the trade-offs that are involved here? The scenario we have in this example is we have a link or we have a path with three three links So we'll look at the three cat the four cases, but the scenario if you look down the bottom the path involves The source x Sending to switch a to switch B and then on to the destination y three links in this example so let's just note that we're trying to send data from x to y and For for this example, I'm going to put some numbers to that We don't need them, but it may make more sense when I add some numbers Let's say the links every link has a data rate of eight megabits per second Three links all the same data rate I'm just choosing the numbers so they're easy to calculate so we can do some quick calculations of transmission delay And let's say I want to send a total amount of payload total data from x to y is 1250 bytes That's how much I want to transmit from x to y and we're going to consider four scenarios four different packet sizes a data packet is made up of a header plus payload and We're actually going to consider four different payload sizes and to keep it simple will keep the the header fixed and we'll set it at hundred bytes so every packet contains a 100 byte header and Then we're going to consider four cases. Well if the payload is this size How long does it take to transmit this data from x through to y and that's what the four pictures will go through in the first case Let's assume that we have a large packet we have one packet pkt sure for packet and The payload of that packet is The full one thousand two hundred and fifty bytes So that's the first case we're going to deal with so what we're going to do is we take all of our data Put it in a packet attach 100 bytes and then send it from x to a when a gets that packet It's going to send it to be and when b gets the packet will send a y Does it take? For simplicity, let's ignore processing delay All right, there is processing delay, but we will not add it in here and even propagation delay Let's say the propagation delay the links are so short that the propagation delay is very very small So let's focus on transmission delay. What is the transmission delay of our packet? Well the numbers I've chosen. Hopefully Work out to be nice ones if I bring up my calculator our packet size we have a hundred bytes of header plus 1250 bytes of payload so that's the total packet size so convert the bits and What's our data rate 8 megabits per second from? x to a so divide by 8 megabits per second I want to find the transmission delay of a packet. It's just the packet size divided by the data rate Try to buy 8 megabits per second or buy 8 here gives me 1350 micro seconds That's why I chose 8 megabits per second because when we divide by 8 we get the exact same number as the packet size just in micro seconds not bytes The transmission delay of one packet from x to a is 1350 micro seconds and let's write that down so Let's look at our first picture The picture is showing the time it takes so time increases as we go down at time zero at the start Time zero here. We start transmitting The time it takes to transmit includes the time to transmit the header the blue box Followed by the data or payload the total time to transmit We finish at time one three five oh We just calculated the transmission delay for one packet. It's one thousand three hundred and fifty micro seconds This is from x to a when a gets this packet it looks at the header and Realizes okay. I need to send to be So then a starts transmitting that same packet to be and that's what the the next part of the diagram illustrates At that so we'll ignore any processing delay. So it's Quite small and the propagation delay. So we receive the packet at time one three five oh We start transmitting Transmit the header the payload it takes another one thousand three hundred and fifty to transmit brings us to 2700 just add them together Then B has received the packet and B transmits on to y taking another one thousand three hundred and fifty micro seconds So when does the data arrive fully at y? What is it four thousand fifty? We transmit from x to a and then from a to b and then from b to y and the time to transmit one packet takes 1350 so we have three transmissions three times one be five oh Total time to deliver the data from x to y is four thousand and fifty micro seconds Any questions that was just the setting up the scenario. That's the simple case Any questions on the numbers or what we're doing here? What were you doing is transmission delay? Assume propagation and processing is very small So what we want to look at is what if we change the payload size? What do we have a different size packet? Well, we can't figure we only have this amount of data So let's try smaller and that's what the next picture shows a case where we have a smaller payload and Then along does it take to transmit? Let's consider we have a payload size of half the original Case such that will have two packets transmit. There's a payload of six hundred and twenty-five bytes if We have one thousand two hundred and fifty bytes of total data to send and we set the payload in each packet to be Six hundred and twenty-five bytes then we need two packets We're gonna have to transmit packet one from x to a and then pack it to from x to a and the transmission time every packet has six hundred and twenty-five bytes of payload plus one hundred bytes of header Same as before One hundred plus six twenty-five gives us seven hundred and twenty-five bytes Sent at eight megabits per second will take us seven hundred and twenty-five micro seconds If we divide by eight million bits per second the data rate. So what happens? The timing we start at time zero We transmit the first packet the first half of the data it takes seven hundred and twenty-five and then x Immediately after transmitting the first one can start transmitting the second packet and take another seven hundred and twenty-five and finish at one four five oh In the meantime X sends the first packet to a At this time a has received the first packet and then it starts receiving the second packet But because a is a switch it has a link from x into a and a link from a to b a Can start transmitting this first packet to be at the same time as receiving the second packet from a from x So here at also time seven twenty-five. We see a is transmitting packet one To be and if we follow that through At time one four five oh a has received packet two and also transmitted packet one on to be a Starts on packet two B starts transmitting packet one on to y It takes another seven hundred and twenty-five We add on seven hundred and twenty-five and then to finish at this point in time B has received packet two B is already sent packet one to y so all that we need to do to finish is B sends packet two to y takes another seven hundred and twenty-five finishing it if you add up 2,900 microseconds What's the point here? What's the the conclusion we can make so far? Comparing the two cases with the large packet in this particular case The total time to transfer our data from x to y the same amount of total data Took four thousand and fifty microseconds With a packet half the size or a payload in the packet half the size it takes just 2,900 microseconds this second case is better We transfer the same amount of data from x to y in a shorter time Everyone can see why it's better Why do we get a shorter time? It's it's this Parallel Receiving one packet, but at the same time sending another on the next link We can't do that when we have a one large packet Because when we receiving the first one we've got nothing to send to send across the second link That's the problem of having that one large packet there by having two packets I get this scenario in some cases where I'm receiving one and sending another at the same time That's in these cases So we save time in total time to do that the next case is we have even smaller packets and We'll choose a size of 250 bytes if the payload is 250 bytes Total is 1,000 250 we need five packets Every packet has 250 bytes plus 100 bytes of header Taking us up to 350 bytes Giving us a transmission delay of 350 microseconds So we'll not write all the numbers, but we start transmitting at zero the first packet Then the second third fourth and fifth But while the second is being sent from x to a a is sending the first on to b and While the third packet is being sent from x to a a is sending the second packet on to b and b is sending the first packet on to y So we have these three parallel Transmissions three transmissions through the network happening at the same time Well to transmit one that takes 350 We can find the total time by just adding up how many transmissions so have one two three four five plus another one here and Another one here so seven Transmissions in total seven times 350 will bring us to the end Seven times 350 is 2,450 Even though we have five packets For it to send from x to a and then in five packets from a to b and five packets from b to y They're actually 15 transmissions in total some are happening at the same time So the total time is less than the previous two cases better again last case smaller packet 125 bytes per packet giving us 10 packets to send a transmission delay of 225 Remember we have the header 125 bytes of payload plus a hundred of header Same scenario arises we transmit the packets, but now we have 10 to send and quickly go through We see that we have some in parallel We transmit 10 Plus another two 12 times 225 is 2,700 the total time in this fourth case with the smallest packet of the four cases is 2,700 Worse than the third case the third case is the best in this example. It takes the least time Why is the fourth case no better than the third one? What's the problem? Why is case four worse than the third case? What is it? Why is four worse than three? You can you see in the picture you can what's happening in case four? Why does it take more time? Same amount of data being sent. It's still 1,250 bytes but You may notice that we have a larger proportion of the header to be sent We have ten headers to be sent Whereas in the previous case we only had five so We have this extra overhead of not transmitting the data Transmitting the header and that with smaller packets we spend more time transmitting header and it turned out in this case That making the packet small enough so that we have ten does not give any benefit Any more benefit than having a five packets. So we need to consider Have the packet small enough such that we can have parallel transmissions through the network through the path But haven't don't have a too small such that the header is too much So it depends upon What is the header size compared to the packet or the the total packet or the payload size? And it also will depend upon the link the number of links in the path in our example We had three if you had four links You have a different scenario We we really need enough packets to fill up all of the links in the path with two packets We had times where we were not transmitting on some links With five packets. We got times when we're transmitting on all links at the same time all three links But when we went up to ten we also were transmitting all three links at the same time But we spent a lot of time transmitting the the blue header in this case. That's the disadvantage So this is just an illustration in a network now We can still look at the delay from source to destination But the packet size may have an impact upon the total time to live to deliver our data Any questions on this example? This was just for packet switching The last thing we'll do to compare is to look at again look at the total time to do the data transfer But also include the connection setup so compare with the three approaches We will not go through calculations is in this one. I'll just explain in general again, we have Source wanting to send data to the destination some same amount of data in all three cases. There are three links again The nodes that they would one two three four not x a b y But three links and in the first picture we use circuit switching So this is for Middle picture we use virtual circuit packet switching and The last picture we use datagram packet switching and what we care about is Comparison of how long does it take from when I press start? I want to start my transfer. I I press start send send file From when the source nodes and start until the destination I receive the entire amount of data How long does that take and we're trying to compare those three approaches? And again, it will depend upon many factors, but we'll talk about the general trade-offs first in circuit switching Before we can actually send data we must set up the circuit or set up the connection So I press start here. I Don't send any data and a special message through the path to the destination that sends back a response and Then I can send my data So there's a delay in setting up the the connection or circuit in circuit switching and it's similar almost the same in Virtual circuit packet switching so both of these approaches have this initial delay this startup delay once they've set up the connection and the data can be sent now if we compare the data transfer phase for packet switching the the Virtual circuit packet switching where we have to say three packets both of them look the same here We send a packet like in the previous example We send a packet when it arrives in its entirety We can send it across the next link and then the next link and it depends upon the number of packets Now how long that will take? so the packet transfer for the data in The middle case of virtual circuit packet switching and the right case of datagram packet switching takes the same time Yeah, with virtual. Sorry with circuit switching the left case The way the virtual that circuit switching works is once we set up a connection. We don't use packets We just take the data like a file and transmit it at the source node and It goes to the first switch and essentially passes through that first switch and then goes on to the Second switch and passes through because those switches are configured whenever the data arrives. It just sends it immediately out It doesn't have to wait for the packet to be received in its entirety before it sends The signal essentially passes through the switch That's why we see the data here looks different for the packet transfer with Urquit switching it would take less time for the same amount of data There'll be overheads of the packets and Waiting for each packet in the two rightmost cases for circuit switching. There's no delay there. We just transmit the data So the question is which one takes less time from when I press start until we get the data at the Destination node The first two also have an act packet saying we're done Ignore that for now. We focus just on the time to take to get the data Well, it would depend on which one's faster. It would depend on how much data How many links how to set up the connection, but some gender we can observe First easy one virtual circuit packet switching will always take more time than datagram packet switching For the same amount of data under the same conditions With datagram packet switching, we just send the packets With virtual circuit packets, which when we set up the connection and then send the packets So there will always be an initial delay of setting up the connection here That is significant if we don't have much data to send Let's say I only have 100 bytes to send one packet to send not three or not 300 Then the delay of a third circuit packet switching is Call request call accept send one data packet a Large proportion of the total time is setting up the connection and that can be Bad for our overall performance I press start on my application It takes some time to set up the connection and then a very short amount of time to send my data I might as well just use datagram packet switching send the data straight away. It's much better for the total delay Now comparing to circuit switching Circuit switching versus virtual circuit packet switching are similar The main difference is with circuit switching the data transfer phase is much faster We don't have to wait for each packet and process and send it on and there's no headers Which we have in the packets So circuit switching can be faster when we have a large amount of data We just transmit it if we have a large amount of data We need many packets the more packets the more header we need to transmit So there's more overhead So circuit is good for a large amount of data when we continuously send another trade-off so we can observe here that there's some delay of setting up a connection and And that can be bad for performance if the amount of data we want to send is small But as the amount of data we want to send grows if the user data is very very large Then the time to set up the connection is just a small proportion of the total time and it's not a big problem for total performance So that's some of the trade-offs there with the different approaches Setting up a connection is okay if you've got a lot of data to send Not okay if you only have a small amount of data to send Using packets is good for network efficiency But introduces some overhead for the header and processing of the packets and I think we'll We'll finish on switching there We've looked at briefly that the different types of switching and some of the performance comparison There's a table that summarizes some differences between them But we will not go into this detail just to see the differences some we've talked about others are new but I'll let you browse through that We were not asked too much detail about the three switching techniques What we want to do though is come back to the original case of getting data from source station to destination and Solve a problem that we missed which is how do we choose a path from source to destination? Which is the next topic on routing