 And to compare them, I'm going to show a few different examples. So with switching is a way to deliver data through a network via our intermediate nodes where those intermediate nodes are switches or switching nodes. And the different ways in which we can set up that path and deliver the data across the path, across the set of switching nodes. And we mentioned on Monday we had circuit switching and packet switching and circuit switching based on, well, developed for telephone network. So it's been around for a long time where we set up a connection and that gives us a path all the way from source to destination. And once we set up a circuit, this connection, we can send our signal along there and the intermediate switching nodes are configured such that the signal effectively passes straight through. So the end result is that with circuit switching, it's like having one long link from source through to destination. There's some complexities of multiplexing and so on but that's the end result from the user with circuit switching. Circuit switching works well with a constant amount of data being sent over some period of time because we reserve resources. If you reserve the resources, that is the capacity of the links, the capabilities of the devices, of the switching nodes, means you're guaranteed to be able to use that capacity when you want to send your data. That's good for your data transfer but it can be bad in terms of efficiency of the network because you reserve 10 megabits per second but if you only use 1 megabit per second, 1 out of 10, then with circuit switching no one else can use that remaining 9, that spare capacity. So if you reserve a certain amount in circuit switching but don't use that, then the rest is wasted. That's the problem with circuit switching. And packet switching tries to overcome that by allowing the unused capacity to be used by others and we do that by breaking the data into packets. One, so in packet switching we had two types. We had datagram packet switching and virtual circuit packet switching. Coming back to this idea of reservations, an analogy that people use is to talk about road networks like the roads which we drive on. And circuit switching, consider the case where you have some VIPs travelling from one location to another. So for example, a member of a royal family, some high-ranking politician, what do they do when they need to drive somewhere? They close down the road with which those people are going to travel on. So we have public roads, but when some VIP needs to travel somewhere, then what often happens, and we've all seen it, I think that in advance, the police will close down the intersections so that cars can't join that road where the VIPs are going to travel on. And when the VIPs come, then they just travel straight through the intersections along the road at whichever speed that they're going, 120 kilometres an hour or whatever, whatever the road enables. So that's maybe we can equate to circuit switching. What happens to get the people from A to B, from source to destination, think of the intersections as the switching nodes. They allow you normally to switch the data into different directions. So what happens is that in advance, we configure the intersections so that the data that we're going to send is going to go straight through those intersections. We reserve the road for that specific data transfer for those people. So the road is reserved for that transfer of people. What it means is, so we set up that connection and when we're waiting for people, the VIPs to travel along that road, no one else can use the road. And you may have to sit and wait at an intersection while someone else has, well, the VIPs are travelling through. So no one else can use the road, which is good for those people who are, the VIPs who are travelling, because they can go from A to B with no stops at the intersections, no delay at the switching nodes, and transferred at the full data rate. It's bad for the people who have to wait at the intersections while that road is closed down. So reserving the resources is good for the data transfer, the quality of that data transfer, but bad from other people's perspective who cannot use the road when it's unused because it's been reserved. So that's a case of circuit switching. Maybe a case of datagram packet switching would be just you and I need to go from A to B, or a group of people, say all the students from SIT need to drive into the city. We just get in our own cars and we drive following our own path. Someone may take a different path than I take. So our packets, our cars, can go in all directions from the same source to the same destination. And of course when we get to intersections there may be some delay, because other cars are going in other directions. So that delay slows down our total time to get from A to B. So with packet switching we send our packets separately representing the data and at the switching nodes they must be processed, causing some delay. What advantage do we get with packet switching compared to circuit switching? So what's good with packet switching? We've got a bad thing in terms of we now need to send our data in separate packets. What benefit can we get? It can be more efficient, especially when the, again, the amount of data needs to be sent varies over time. With circuit switching we reserve the path, no one else can use it while it's reserved. With packet switching, we don't necessarily reserve the path, we send our packets and what happens is if some people are sending lots of packets, where others are sending a few packets, then if the network is built correctly then in most cases all of those packets can still be delivered across the path. And at another time when someone's sending very little and another person needs to send a lot, then again by sending individual packets that switching nodes can combine or consider all incoming packets and utilize the output link by sending everyone's packets across that same output link. And that's hard to explain. I've got another example to try and illustrate that. You don't have this, but just follow along. Here's a simple network. The squares are our stations and the circles are our switching nodes, a simple network. And for the main part we'll focus on the top one sending to the bottom one, the source and destination. Let's consider circuit switching first. What happens? So let's just focus on this path, we've chosen this path. In circuit switching we need to first establish the circuit, set up the path. We send some special message, a short message to the first switching node. When it receives that it configures the switch in preparation that this circuit is going to be established. So there's something done at the switch saying that there's potentially going to be a path from source through to destination to the switch. And forwards this sometimes called a request message, a call request message, connection request message to the next switch which says okay there's likely to be a connection from A through to B. And then when the destination receives it if everything's okay it sends back a response. It accepts this request and sends back a response. Sends back a short response saying I accept this connection and as that passes through these switches these switches confirm that we are going to have a connection or a circuit from this source to this destination. And they set themselves up and we saw in one of those early pictures in the operator of the telephone exchange they connect this input or this line into this line inside the switch. Of course there's complexities of doing that but conceptually we connect those lines together and the response comes back and same at this intermediate, at this switching node it configures to connect this line to this line. This is just the connection setup. Now we have a connection. This is circuit switching. Now we want to send the data. So the source starts sending data and in the concept of packets we just transmit the data that we have. In fact usually we think about it as a signal. We take our data and we send a signal out of here and that signal passes all the way through the switching node to the destination. So we start transmitting some data it comes out of the computer and it keeps coming out and think of that data in circuit switching simply passes through the switching nodes because all the switching node does because it's already configured anything coming in here is configured to go directly out here and simply passes that data through onto the output link and it passes through the network through those intermediate links the switching nodes and is received at the destination. In fact once we've set up the circuit with circuit switching remove these switching nodes and consider this as just one long link. If you want to look at the total delay to deliver that data well it depends upon the distance and the speed at which we can send the data so transmission and propagation delay there's very little usually we assume zero processing delay inside the switches because the signal just comes in and goes directly out so it's as if the switches are not there once we've set up a circuit. The problem with this is that although I have it coming back to our network we just looked from the top one sending to the bottom one then maybe other stations wanted to send across this network at the same time the problem with circuit switching as we said is that we reserve the capacity even if we've set up a connection and A or the source is not sending data to the destination at this point in time no one else can use the resources reserved for that connection so it's inefficient from that perspective. Let's look at packet switching and I'll use virtual circuit packet switching as an example same network but let's consider packet switching in virtual circuit packet switching we simply use packets now and try to behave like circuit switching so same source and destination we still set up a path a virtual circuit by sending a request saying I want to connect to this destination similar to before except this request message is processed here and it stores some information that in advance it's possibly going to be a virtual circuit from source to destination we accept that request send back a response and in fact the packet switches store in memory some information saying from now on anything coming from this source to this destination if I receive a packet with a source address of this one and the destination address of this one when I receive a packet I will send it for this switches perspective send it on this link so they store some information to tell them the source address, destination address and where to send it next so we set up a path or a virtual circuit and then we start transferring data and now we break that data into packets so we think the data that the source has to send we break into three packets just to keep it simple and they have many more and we send those packets one at a time there may be some delay between sending the first packet and sending the second packet depends when we have the data available that is if the application generates some data to be sent then that's the first packet and then a few milliseconds later has some more data to send maybe that's the second packet so I'm trying to show that there may be some time between sending those packets they are sent from the source to the switching node and the switching node receives a packet it must process that packet and at least what it must do is look at the header I haven't drawn the header but there's a header for this packet inside the header should be the source address and destination address so what this switching node does in packet switching is looks at the header sees that the destination is here and compares to what it stored previously when we set up that connection and determines ok the destination is here it's coming from this source I know I must send that in this direction not out here, not out here so processes which take some time with circuit switching the processing of the data is almost zero it's very fast of course the time to process the data depends upon the packet depends upon what's in the packet but also not shown here there may be packets coming from other directions at the same time there may be packets coming into this switch from this direction, from this direction so in fact the time to process that blue packet that arrives depends not only on that packet but on what others are sending so there may be a large delay there and then we send it out and we just send those packets through the network and because of the varying delay in the switching nodes this one there may be some increased delay or time between the first and the second packet now so we transmit the first packet a little bit later we send the second packet across the link and in fact you can think across this link that we're inefficient all the time we're transmitting the first packet and then there's some delay before we send the second packet we'd like to be sending packets all the time across the link and then we deliver them eventually to the destination let's consider now in our network we have another virtual circuit setup from this source to this destination this red one, it's been set up already I won't go through the setup process and the source the red one wants to send two packets through the destination in the same way with packet switching it generates the packets, transmits them and at a similar time our blue source starts transmitting its packets and they arrive they start to arrive at this first switching node at the same time the red ones and the blue ones come into the switching node on two different links so the switching node looks at the headers who is the source, who is the destination and determines in fact in this case it needs to send them all out on this link and in fact the benefits of packet switching arise now in that even if there's a small amount of data coming from one we can combine what we send out on this link we can combine the packets from both the sources so we can transmit let's say the first packet from the blue one then the red packet then a blue packet and so on so from this output link we're actually transmitting packets all the time or very close to there's a small gap here that's more efficient utilization of that link because when I just had the blue one transmitting we saw there were some gaps here when we transmitted across this link but if there's someone else who also wanted to send packets then if we're lucky what can happen is that we can get to transmit all those packets one after another across this output link fully utilizing the link that's good if I have some link I want to be sending across it all the time because if I'm not that's inefficient so it works out in most cases with packet switching because sources have different amounts to send in some instant the blue source has a lot of packets to send the red one has a little a few packets and then maybe a second later the blue one has just a few packets to send the red one has many packets to send then they send those packets and if they need to traverse the same link then if our network is built well and designed well then usually we can be sending packets all the time across this link sometimes we're sending a lot of the blue packets and a few red ones other times we're sending a lot of the red packets and a few blue ones but again fully utilizing that link or increasing the utilization increasing the efficiency the second switching node simply receives a packet looks at the header determines where to send it the red ones it knows need to go in this direction the blue ones in this direction and they're delivered to the destination so this is an example of virtual circuit packet switching the same concept supply with datagram packet switching except we don't set up a connection in advance but we still have an advantage of by using packets smaller chunks of data then when users are sending a lot and some other users are sending very little we can combine their data and efficiently utilize the links and overall efficiently utilize the entire network with circuit switching if a user reserves a connection but sends very little then what they're not using is wasted and that's inefficient and that's really the summary of those three switching techniques I don't show datagram packet switching here it's the same as the blue and red one except we don't have a path set up in advance maybe the packets take different paths it's possible with datagram packet switching any questions on these three switching techniques let's go back to our lectures let's compare the three from the perspective of how long it takes to transfer the data circuit switching on the left virtual circuit packet switching in the middle datagram packet switching on the right and it's showing that the total delay or the total time to transfer data in the first two cases we need to set up a connection there's slightly different ways in which that's performed but the basic approach is that we send a request a short request message from source to destination which responds with some in this case a call accept or a connection accept request a message and similar with virtual circuit packet switching we send some call request packet and responds with a call accept packet saying we accept we're prepared to receive the data whereas with datagram packet switching we don't do this connection setup we just send the data immediately there's no delay of setting up this connection at the start with datagram packet switching for the data transfer with data with circuit switching we don't have packets we just transmit the data and we can think the data just goes through each switch until it's received by the destination so there's no delay inside the switches or very very small delay so you can think that we have one piece of data we transmit it this is the transmission delay there's some propagation delay the propagation delay of the path is really the propagation or the sum of the propagation delay of each of the links if it takes 10 milliseconds to propagate from the cross each link then it takes 30 milliseconds to propagate across the path but when we use packet switching we transmit a packet one at a time and the switching node will not transmit on the output link until it's fully received that packet and processed it by looking at the header it's received a packet it's received at this point there may be some small processing delay then we transmit packet one on the second link it's received and transmitted across the third link and similar with packets 2 and 3 and we see that with virtual circuit packet switching and datagram packet switching the data transfer phase is the same there's no difference which one's fastest it's time to transfer our data in this case we see datagram packet switching is fastest is it always alright it depends, good compare these two compare datagram packet switching with virtual circuit packet switching under the same conditions datagram packet switching is always faster because the only difference is that assuming we have the same amount of data and the same size packets this time is the same as this time but with virtual circuit packet switching we have an additional time to set up the connection so my computer wants to send data with virtual circuit packet switching at time zero I want to send data what happens first is I send a request get back a response and then send the data so there's this extra delay of setting up the virtual circuit always with virtual circuit packet switching now so datagram packet switching has a smaller delay than virtual circuit packet switching what about then circuit switching versus datagram packet switching which one takes less time what does it depend upon okay good it depends upon the size of the data and roughly under the same conditions well what's the delay for datagram packet switching time to transmit data but also we have this delay of headers inside the packets we have to transmit them and we have this delay that we cannot transmit the first packet until we've fully received it so there's some delay there delay inside the switching nodes which is not present in the data transfer for circuit switching in circuit switching no header just send the data all the way through so the data transfer phase of circuit switching will be faster than that with the packet switching techniques but circuit switching has this additional delay at the start of setting up the connection so which one is faster well it will depend upon how much data we need to transfer if you can imagine that the data we have a lot of data to transfer that is if I drew this again the data to transfer went all the way down there then the time to set up the connection is just a small percentage of the total time whereas with packet switching if we have many many packets to send there's a lot of overhead of headers so circuit switching the total time can be less in that case depending on the amount of data normally if we have a lot of data to send setting up a connection is not so much of a problem but if you only have a small amount of data to send then setting up a connection is a waste of time that's the general trade off in the internet most of our applications today we often send think of web browsing and then receive a response we may access the same web server again or we may access other web servers so it generally doesn't make sense to set up a connection just to transfer say a single packet to a server get a single response back and then close that connection because the overhead of setting up the connection is quite significant and in fact in the internet datagram packet switching is used and in most networks there are some cases where virtual circuit packet switching is used in wide area networks but in general for the internet especially from the perspective of the internet protocol which we'll cover datagram packet switching is the technique chosen this compares the three switching techniques some of them we haven't discussed and we will not, you can read through let's just highlight some of the main concepts between the three circuit switching we set up a dedicated transmission path that is we set up a circuit from source to destination and it's reserved for that data transfer there's a path that is there's a physical connection from source through to destination it's not the case with packet switching even in virtual circuit packet switching although we set up a virtual circuit we're processing packets one at a time we don't have a physical path from source to destination reserved packet switching transmission of packets which routing will return to later so we talked about routing with the delay circuit switching and virtual circuit packet switching have some set up delay call set up delay there's small transmission delay almost zero with at their switching nodes circuit switching but with this packet switching techniques we have this delay of transmitting a packet that's larger than for circuit switching what happens if things go wrong if in circuit switching we try to connect to a destination and that destination is busy then we may get some response back saying the destination is busy we don't have that concept in datagram packet switching in data it may not be delivered we may get some notification our data wasn't delivered and similar to circuit switching virtual circuit packet switching we may try and connect it's possible that the destination says no I cannot set up a connection deny the connection importantly what happens when we have a lot of data a lot of information to send across the network with circuit switching yesterday if our resources are reserved and someone else wants to make a phone call that phone call is blocked it's not set up so we have the concept of call blocking in circuit switching it may be the same in virtual circuit packet switching we if we have some measure of resources we try to set up a new connection then we may have to block that connection but importantly in circuit packet switching as more people send data what normally happens is that inside our switches as more people are sending data there's a larger delay inside these switching nodes because if the blue one is sending data in and everyone else is also sending data into this switching node the switching node can only process one packet at a time others will have to wait or queue they'll have to wait in a queue for the first packet to be sent so the delay at the switching nodes increases as the amount of data needed to be sent increases in packet switching the queuing delay increases something about the size of the nodes not so important for us this one, the second or last one is key in circuit switching the word used here, bandwidth but fixed resources allocated for the data transfer with packet switching we dynamically use those resources, the bandwidth the capacity fixed is good from the perspective of the people who want to send data they get guaranteed performance but it's bad in terms of network efficiency when those people vary the amount of data they want to send that's why dynamic use of the resources is better for efficiency and that's all I want to cover on switching the way to get data across a network from source to destination the one thing that we skipped when we talked about networks is we said that we send data across some path across a set of links we often have multiple different paths to choose from how do we choose which path to use and that's our next topic routing how do you choose the path to take from the source to the destination I want to drive from here into the centre of Bangkok go shopping at Paragon what path do I take I'm sure many of you have driven into some places in Bangkok which path do you take how do you drive into Bangkok or your friends expressway, why it's the fastest way if we have so one way to choose the path to take there are many paths of course to drive into say Paragon then there are many different roads we could take many different paths we could take so how do we choose which one to take the next area we could use is well in some cases there are expressways or highways which you can use or toll roads let's use them because they don't have so many intersections and in general the cars can travel faster I'm a cheap person I don't want to spend money on a toll road what else can I do we're driving let's say we're driving I'm cheap I've got no money don't go up go under the tollway in some parts there's a road but that road is not always present from here into Paragon then sometimes we have to take some side roads how do I choose which ones to take then why not here we are at SIT and here's Bangkok why not drive up and out to the east and come down there how do I choose the path to take shortest path shortest path in what measured in what one way to measure one way the shortest distance I've got a map I've got google maps here accurate what I can do is get a ruler and measure what's the actual distance from A through to B and scale that up to kilometres and then we'll look at individual sections of roads as we come up to an intersection we may have to turn and work out what's the distance if I take this path 40 kilometres if I take a different path it's 45 kilometres choose the path with the least distance there's one way why not why not traffic sometimes at some of the intersections there's a lot of traffic that is there's cars coming from on your direction from the opposite direction and from the side directions which means that that intersection I must stop at the stop lights and wait for three minutes so the more traffic on that path the longer delay I'm going to have there may be another way to choose a path would be to select a path which has no traffic or very little traffic the least traffic let's have a look at these are some of the results that google maps returned this morning the first path it showed me here here it says the distance 31.4 kilometres so let's say that's the distance of each of the segments the traffic is blue line the normal time 30 minutes so google has done some calculation if we travel at normal speed across each of those road segments the time it would typically take is 30 minutes but it gives me a bit more information in current traffic this was 8am this morning it says 46 minutes google is a little bit smarter the time to be the same it has some information about the current traffic conditions so and then it actually has three options of paths the second option distance of 32.6 kilometres typical time 36 minutes current 1 hour 5 minutes a different path and then this one 39.5 kilometres further larger distance 56 minutes current time less than the second one if we consider the traffic and a fourth one I select the option here avoid the tolls I don't have the money it gives me some options and here was one distance 35 kilometres current time 58 normal time 41 minutes in in our road network we need ways to choose the path to take to get from A to B in our computer network our communications network we also need ways to choose the path to take from source station to destination station via those switching nodes which links do we go via the general process is called routing we need to choose a route or choose a path so we have algorithms to choose the best route and when I say best well there are different criteria for measuring best and we've just mentioned some of them the distance in terms of kilometres well same can be applied for communications network choose a route for my data to go from here through to the US well maybe there's path that go up via Tokyo there's one to Singapore and through south east Asia across the Pacific there's a path that goes via Europe choose the path which has the least distance there's one criteria for choosing a path through a network coming back to our road network Google has calculated some typical times okay 31 kilometres going back to our first one 31.4 kilometres 30 minutes typical time but in current traffic 46 minutes if I go back the map now so this was at 8am look at it now it's 9.30am 10am the distance is it going to be the same yes the distance doesn't change for this path the typical time will probably be the same because I think that's the time that is calculated based upon the distance and the road speeds in current traffic time most likely will be different okay because now past 9am maybe there's less traffic on the roads and they calculate it to be say 40 minutes not 46 minutes choosing the best path of course we have different criteria for choosing the best path like distance amount of traffic cost do we avoid the toll or not but another thing that's important is in some cases the information that we use to choose the best path how up to date it is okay so in this case the 30 minutes time is probably a time that is typical with very little traffic but Google is getting responses how do they get it well maybe they get it from traffic reporting stations from the city traffic cameras get some information about where the congestion is and that feeds back in and then updates the current traffic time I don't know how often it updates maybe every 30 minutes every 1 hour it may depend upon where the information comes from yeah okay from from users information from users and where they are so there's different sources for where that information may come from the rate at which we get updates is choosing the best path because if we update this in current traffic every 1 minute it's an accurate representation of the current traffic there's a traffic jam 5 minutes ago at 1 intersection which increases this from 46 minutes up to 50 minutes then that may allow me to choose a better path so the more frequently we get updates of what's happening in the network the more more chance I can choose the best path if this in current traffic updated once per day it wouldn't be very useful because during a day during that 24 hours the traffic varies a lot the congestion varies in different locations so the frequency of the updates is very important and look the source of those updates where did the information come from did it come from different points in the network and what cost was involved of collecting that information is important we said we may want to choose a path which has low cost, low financial cost another criteria so that's an example for road networks the same applies with communication networks and that's our topic on routing how do we choose a route through a switched communication network and from now on we're going to focus on packet based networks, packet switching but the same similar concepts for routing also apply for circuit switching but the examples we'll use will be for packet switching here's our network from before so to get from A through to D which path or route do we take so we use the word path or route to mean the same thing that's the problem that we're trying to solve what's the best path from A through to D well the answer, choose the best path ok well then we need to define what do we mean by best what criteria do we have to define best of course we want the best path but what do we mean by that so what do we mean by best how to choose that note that in our example with 6 stations with 7 switching nodes there are several paths here there are not many to choose from not a difficult problem to choose the best path in this case but in a real network across a country between countries even within cities the number of devices, stations switching nodes links it can be very high so the connectivity is much more complex in the examples and in fact you cannot easily just look at the picture of the network and choose the best path you need some algorithms to calculate it for us so what do we mean by best and how do we choose the best path once we define best what algorithms do we have available when there are many possible paths choose the best one we're going to focus on routing packet switch networks but it's the same essentially in circuit or packet switch networks so coming back we'll see that we need to define what is best and we need some algorithm to choose the best path a routing algorithm some general requirements of some routing algorithm needs to be correct so a routing algorithm takes as an input the source and the destination and returns as an output the best path between source and destination so if the source is A destination is B a routing algorithm must return a path between A and B it cannot return a path from A to C that would be incorrect that's almost obvious we don't want a routing algorithm that doesn't get us to the destination it should be simple because we'll see that we need to implement this routing algorithm in different nodes it must do some processing simplicity is a way towards getting things which are easy when we implement and cheap the algorithm needs to choose a path from source to destination some other requirements should be robust that is the example of robustness is that we choose a path from A to B and then we notice the network there are some errors or there are problems in the network then we should be able to adapt and choose a better path if it becomes available so do some adaptation as the network operates so even when things are not working well when we have errors it should still work stability is almost a conflicting requirement with robustness stability says that we don't want to switch between paths too frequently I have a path from A to B and I'm using that path to send my data and then another path becomes available which is slightly better than the current one and we switch to use that other path and start sending the data there but then the previous path becomes better again because the network conditions are changing so I switch back to that previous path and I keep switching between paths and sending my data sometimes on this path sometimes on another path that can become a problem because our data can start to be reordered and we have different delays on each path we can say we get an unstable path we keep changing paths we want to select the best path but we don't want to switch between paths too often and it depends upon our requirements of our applications as what is too often stability don't change paths too often in fairness change paths when needed to overcome errors or problems we need some trade off between those two choose optimal paths ok we've said that choose the best path efficiency we'll come back to fairness efficiency the process of choosing a path will see requires exchanging some information across the network in the process of the process of Google Maps selecting these three best paths what did it need to know it needed to know the map of the streets it needed to know information about the the speeds along each of the roads that you can travel on and importantly it needed to know something about the current traffic conditions so it could give an estimate of at this point in time how long will it take now to collect information about the current traffic conditions there's some overhead because somehow we need to collect that information we want to minimise that overhead in collecting information but still we want to have up to date information so efficiency is about when we collect all the information to determine our path we want to minimise the amount of processing we do when we collect that information and also minimise the amount of overhead that we transmit across our network but still choose the best path so there are again some trade-offs here we cannot just say don't collect any information because it may mean we don't choose the best path fairness is a hard one to to given an example it may turn out in some cases with routing algorithms that some stations can get better paths than others which means if station A to D always gets the routing algorithm always chooses a better path than what station C to F gets then it's unfair for one pair of source destination so there can be extreme cases of that where a routing algorithm gives us is efficient, robust and stable but it may mean that for some sources their data always goes across very long paths and takes a long time but for others it takes a short time across very good paths so we want to avoid that and try and treat all stations the same and be fair amongst them I think we'll see examples of optimal paths efficiency especially and these two as we go through we will not see an example of fairness so we want some algorithm that will choose a path from A to B which meets these requirements let's introduce some terminology so we can give some examples we have links between nodes so now we talk about nodes, switching nodes simply nodes we have a link between them a direct connection between them actually let's explain them on this example here are six switching nodes there may be stations attached to them but let's say we have a network of six switching nodes N1 through to N6 we have links between those switching nodes so there's a link from N1 to N4 there's also a link from N4 to N1 often we have links in both directions a link is a direct connection between two nodes a path or a route is a connection between two nodes which may have one or more links so a path give me a path from N1 to N4 a path from N1 N4 is direct any others N1 to N4 give me one example there are many others N1, N2, N4 that's a path usually we define a path by the set of nodes we traverse there are multiple paths from N1 to N4 N2, N1, N2, N4 N1, N4 N1, N3, N4 so they are paths they may contain one or more links to traverse one link is to make one hop we often measure hops talk about hops this is one hop to go from N1 to N6 on the path 1, 4, 5, 6 there are three hops we often talk about hops we traverse along that path what we've got next a neighbor a neighbor of a node is the node which are the other nodes which this node has direct connections to that has links to N1 has three neighbors the neighbors of N1 N2, N3 and N4 because N1 has links to those three nodes so we have neighbors and for each link we assign some cost and they are the numbers shown on these arrows so the arrows are the links the numbers are the costs of those links the costs of sending data across that link now here cost does not mean financial cost it's a general cost we have to define what it means so when we say the cost to send from N1 to N4 is 1 and to send from N1 to N2 is 2 well it doesn't mean 1 bar, 2 bar it may mean a financial cost but in general it may mean to do with many different metrics delay throughput we'll see more metrics as we go through so we assign some general cost to the links the cost may be different in each direction it's possible so it costs 1 unit to send to N4 but for N4 back to 7 it costs 7 units so it's possible and a topology when we talk about a network topology it's the arrangement of those nodes and links this is one network topology if I removed this link here that would be a different network topology if I added another node and some links that's a different network topology with the arrangement of links and nodes what our routing algorithm should do is or what we generally do in routing is find the least cost path from source to destination from N1 to N6 the least cost of a path is the sum of the cost of the links on that path so that's what we define so each link has a cost the cost of a path is the sum of the cost of the links along that path what's the least cost path from N1 to N4 there are multiple paths give me one least cost path this is an easy one the direct link from N1 to 4 the link cost is 1 the path cost is 1 if we went N2 and N4 the path cost would be 2 plus 2 would be 4 we want to choose the path with the least cost in some cases from N1 to N6 least cost path N1, N4, N5, N6 has a cost of 1 plus 1 plus 2 is 4 from N6 to N1 maybe are you sure you actually need to check all the paths it's not obvious I think from from N6 to N4 if we went N6 to N1 6541 has a cost of 4 plus 1 plus 7 is 12 another path 6 to 5 to 4 to 2 to 1 has a cost of 4 plus 1 plus 2 which is 7 plus 3 is 10 any lower cost path than 10 6 to 5 to 3 5 then to N1 is 13 it's not obvious to choose the least cost path here even with such a simple network one of the smallest networks you'll see you cannot just look at it and choose the least cost path imagine the network now has 100 nodes thousands of links many possible paths so we need some algorithm to calculate the least cost path what is an algorithm that you know you've done it before most of you have I know you remember maybe Dr. Booneerit may have taught or someone else in 1st or 2nd year Dijkstra's algorithm so there are different algorithms that given this information follow some steps and we'll always find the least cost path Dijkstra's algorithm is one Bellman Ford is another algorithm so there are different algorithms to take the network topology and we'll return the least cost path we're not going to cover those algorithms most of you have covered them before in earlier courses but we'll accept that there are some algorithm that can do it for us we don't have to manually do it we can calculate a computer can compute it so our aim given some topology choose a route choose a path with the least cost that's easy if we have this topology then we apply some algorithm and it returns the answer let's come back to some things what performance criteria do we use to select the path where do those numbers of the costs come from so there are different ways to select there are different sources of those numbers the number could mean a financial cost it could mean something related to delay something throughput and in fact can be other things like associated some cost to do with the security of using that path so there are different performance criteria that we can use when is a path selected that is I have some data I have a packet to send do I select a path for every packet that I want to send or do I select a path every year so there are different choices there and they have some impacts on performance which nodes are responsible responsible for selecting the path which nodes select the path is it the source node that chooses a path all the way through the destination or maybe all nodes are involved in choosing the path from source to destination or maybe there is one central node some special server there are again different options which nodes provide information about the network status so if these costs these numbers here are to do with the current delay across a link or a portion of the network they may change over time the delay may vary over time it may depend upon the delay at nodes even so the delay of a link we may count processing, transmission propagation and even queuing delay so if the the cost varies over time then we should to choose the best path get some update about the current value well which nodes provide that updated information which nodes provide information about the current costs and the usage of the network even the topology the topology may change today I have six nodes tomorrow there is a new node added to the network so we need to get that information about the new topology so that we can calculate the best path and how often do we get that information that's important so we need to answer these questions in different ways for addressing these questions and this slide gives some answers to some of those questions and we will discuss them to finish today performance criteria how do we what does this number 1, 7 and so on what do these costs represent well they can represent different things number of hops so a simple cost metric that we can use number of hops so in fact if we use number of hops each link would have a cost of 1 on our diagram all links are cost of 1 and then we choose a path with the least number of hops that's a very simple way and commonly used in some networks another criteria may be financial cost choose the path which is going to be cheapest for us to send our data because there is a financial cost of sending data across links especially if you're connecting across multiple different a multiple if you're connecting across networks operated by different companies so there may be some cost of using their network so consider that when you choose the path delay is another common one choose the or assign cost to links which represents the delay of sending our data across that thing because in many applications to send data from source to destination we care about minimizing the delay choose the path which gives us the shortest time to transfer or to send a single message from A to B so the delay of the link to do with transmission propagation, queuing and processing delay is commonly used another one may be throughput I care about transferring a lot of data across the link across the path from source A to destination B then if we can assign costs which are related to the throughput choose a path which gives us the highest throughput so there are examples of some performance criteria that we use to assign cost to links we need some way to get a number a cost to a link once we've got that we can assign cost path there are others one may be security may be political factors consider routing through throughout the world you have a company in two different countries and it's the laws of those one of the countries you're operating in so you cannot send confidential data via some third country because of political factors so in that case you could potentially choose a route that bypasses a country bypasses some region because you don't consider that region to be secure you don't trust it for example so there are other factors that can be used here but these are the common ones when is a path selected well commonly if we're using datagram packet switching per packet is one option but in fact the path may not change across multiple packets so when we want to send an individual packet we use some information to determine who to send it to if we're using virtual circuit packet switching per session or whenever we set up the connection then the process of setting up the connection we choose a path and then all of our packets belonging to that session or connection follow that same path so these are some examples of when do we choose where we want to send a packet or packets belonging to an entire session which nodes are responsible for selecting the path so the decision place all three basic approaches each node plays a role so some distributed approach where all nodes have a say which path is used back to our example if N1 has some information so one approach could be let's simply send if we have calculated least cost paths then N1 knows the least cost path to N6 is via 4 then what N1 does is sends the packets to 4 N4 knows the destination is 6 and if N4 knows that the least cost path to 6 is to 5 then it sends to 5 so each node is having a role in choosing where to send the packet and each node needs to collect information to find out what is the least cost path so a distributed approach where all nodes have a role another approach could be a centralized approach where this one special computer may be not shown here some central server that calculates least cost paths and is used whenever we want to send data maybe that's suitable in small networks what was the other one source originating node the source node chooses the path and an example may be the source chooses the best path N1456 and it sends a packet and inside that packet it includes the path information so in the header it says this packet must traverse 45 and go to 6 so it sends it to 4 4 all it does is reads the packet and follows the packet instructions which says send to 5 so that's an example of the path is chosen by the source and the other nodes along the way just follow the information of the path that was chosen by the source the source routing is possible let's briefly mention the last two and then we'll finish and let's give a couple of examples where does the information about the network come from? assuming the costs may change over time so at this point in time the costs are this 5 minutes later the costs and the links may have changed in that case to choose the best path we need to collect that information about the updated costs so where does that information come from? where does the updates come from? well the worst case is don't collect any information or don't collect any information local means we don't have any source of information the best case would be all nodes any updates at each node is made available to every other node and all links but there are some intermediate cases for example use just local information local for example the information local to N1 N1 should know about its links N1 doesn't know about the links to node 6 but the links connected directly to N1 and the costs of those links would say is local to N1 so if this link changes from cost 2 to cost 5 N1 knows about that if we consider local information if the link from 5 to 6 changes from 2 to 20 N1 doesn't know about that immediately it's not local information it would need to somehow collect or someone would need to send that information to it so if you just use local information it's quite easy because you always have access to that adjacent node that is neighbour node what we could do is that N1 knows about its links the neighbours of N1 being 2, 3 and 4 they know about their links they could send some information to N1 about their links so the link from 4 to 5 changes from 1 to 10 the cost of that link N1 doesn't immediately know about that change because it's not connected but if N4 sends a message to N1 saying my link from 4 to 5 has changed from 1 to 10 then now N1 knows about that change so if we can collect information from our neighbour nodes we can learn more about the changes in the network and the best case is to connect collect information from all nodes every node every one minute sends a special message to N1 saying these are my current links as a result N1 has an updated view of the network so there are trade-offs with each of those let's stop now what we're going to do next week we'll come back and look at these network information source network information update timing talk about the trade-offs and give a few more examples with our simple network of how these may work so we'll go through some examples what happens when the cost change how often we can update and where do we get that information from we'll continue that next week