 So we look at, we said yesterday there are tasks involved with getting data across a network as opposed to just individual links and one of those tasks will call switching. So we'll talk about that in this topic and the other one which is a little bit easier to understand is routing, finding the path, finding which set of links to go by. But before we talk about switching let's talk about what do we mean by a network, a communications network, we'll call it a switch communications network but I'll explain some of the terminology we'll use via this example, a simple network to illustrate the components. We have our end user devices around the outside, PCs, any computer that the human may use, servers, any device that we want to allow to communicate with other devices on the network. We may call these stations generally so whether it's a server or a mobile phone we can refer to it as a station. Other times we may call it a host. So we use the name station or host to mean the same thing that the devices that we want to allow to communicate but because we don't have links between every pair of stations for example station A and F there's no cable directly linking them then to communicate between A and F we need to send via other devices and these other devices are shown as the green boxes and we can call them nodes or specifically switching nodes and we'll see some other names in other contexts for these devices, these intermediate devices. Now at this stage we'll refer to them as just nodes, switching nodes or just switches. We'll see why switching comes into it in a moment. So the idea is if A wants to send data to F because it doesn't have a link directly to F it sends to some other node inside the network. So this cloud represents the the communications network made up of these nodes. The lines are links whether wired or wireless but some form of link and we can think that the stations attached to the network and these internal nodes deliver the data from one station to another. One of the problems we said was finding the path so now from sending data from A to F we need to send it via these internal switching nodes. Which ones to send via is one question. Do we send four seven six or four five six or four one two three five six to get from A to F? That is what we'll call routing, choosing the best path. And that's the next topic. To discuss this topic we'll assume that we can choose a path. We will not say how but let's assume that when we send data the path is chosen. It's already known. So we have stations that want to be able to communicate. We have a network of switching nodes which provide connections hopefully such that any station can communicate with any other station. And you see in this case that that's true. If any station wants to be able to communicate then they just send it to the network and there's always a path to each other station. Some aspects of this network so we've got stations, nodes. These nodes their goal is to just send data for other people. The stations may create data. They are the originators of the data. They may be the consumers of the data. They receive it and process it. Whereas the nodes their goal is just to forward data for other people. So they have different purposes in here. Sometimes they may overlap but often the nodes their only job is to receive from someone else and send to someone else. Typically the stations will connect into a node via a point-to-point link which is usually dedicated for that station. So A has a link into node 4 and that link is only for communications between A and node 4. No one else uses that link. The data from no other device travels across that link. Only data coming from A traverses this link or data destined to A traverses this link. That's why we say it's dedicated just for A this link. Whereas the internal links between nodes sometimes they will be using multiplexing. That is they'll carry data from multiple users across the single link. For example if A was sending data to F across the path 4, 5 and 6 and at the same time B wanted to send to E across the path 1, 4, 5, 6 then you're thinking at this link between 4 and 5 it would need to carry the data from two different users. It would need to carry the data from user A and also from the user B. What would commonly do is use multiplexing on this link such that when A and B send at the same time the data arrives at node 4 and that would combine it using FDM or TDM and send it to node 5 across the single link. So often multiplexing is used internal between the nodes. Usually dedicated point-to-point links are used from stations to nodes. An example maybe if you were using TDM let's say that the data rate of the link from A to 4 was 1 megabit per second and that was the case for all the station-to-node links 1 megabit per second whereas the internal links say from 4 to 5 maybe the data rate is 5 megabits per second so that it can send data from A to F at 1 megabit per second at the same time be sending data from B to E at 1 megabit per second and to do that this link needs to have a data rate larger than 1 megabit per second enough to support the data from both sources both users. So multiplexing would usually result in this being a much higher capacity link than the station-to-node links. So that's the network that we'll deal with or an example of the network we have node stations links what else can we say this network often is not fully connected so there's not necessarily links between every pair of nodes node 2 doesn't connect to node 7 node 6 does not connect direct to node 4 so that's a cost-saving measure and we don't necessarily need to have links from each node to every other node if you can imagine these nodes are spread across the country across Thailand are in different cities different locations then you connect usually nearby nodes in in a manner such that there are usually several paths between any pair of stations so I think in this case from A to F there are several different paths we can take and from B to E there are some different paths that can be taken and similar from other pairs of stations so that's desirable to have as few links as possible then it's cheaper but have enough links such that there are usually multiple paths between pairs of stations having multiple paths helps for redundancy something fails node 7 fails a can still send data to F by 4 5 and 6 so having multiple paths is useful there things like load balancing a is sending by the or someone is sending data 4 7 6 and the the capacity of the links and the nodes is starting to be reached that is the amount of data going through it is using all of the capacity so I may want to send their data via a different path which is less congested to balance the data not to have all the data going across one path but to balance it across different paths so that you get better performance so that's load balancing so we'd like to have multiple paths but few links to make it cheap so it's usually not fully connected that the technologies we're about to talk about switching and and the the issues we're dealing with often relevant for large networks wide area networks networks that cover cities between cities across a country and between countries it's not necessary something that we use at least we don't have a network this complex say inside our home we would only need one such switching node inside your home it's much simpler but in larger networks we may have a much more complex net situation so this just summarizes those concepts data is transmitted from source to destination through a network of switching nodes those green boxes those switching nodes don't care about the data they don't care that you're sending a voice communications a web page they just treat it as any type of data and their goal is to send it on to get to the destination we refer to the collection of those switching nodes as a communications network and the devices the end user devices are attached to that network and we can call them stations another thing we may call them is hosts or just end user devices usually the station to node links are dedicated they're just used by that station sending data from and to that station whereas node to node links may be multiplexed they carry the data from multiple stations at the same time and we don't usually have fully connected networks so the two main issues with how to communicate when we have such a network which path to take which is routing and another is well how do the nodes forward the data on different modes for how how to get the data through those nodes which will refer to a switching the idea is that we'll send data to one node if it knows the path you can see node 4 has three different output links for the data from a to f if it's going to go on the path 476 then you can think the data comes into 4 and it switches it out to node 7 yes if it was data going across a different path maybe a to e through the path 456 then that data will be switched to the link to node 5 so these devices we call switching nodes because they can think they have a switch in inside which tells it where to send the data on the output as it comes in and the way to do that there are really three different approaches for for dealing with the data delivery we call it switching and we'll go through those three approaches today the first approach is circuit switching who has a telephone at home not a mobile phone but a landline telephone anyone few people still have them okay or you I'm sure you've used them in the past so telephone networks have been around for a long time maybe a hundred years more than a hundred years so the telephone was invented I guess in the early 1900s late 1800s so telephone networks have been the main communication network in use compared to the internet which has only been around for about 40 years and we'll see that circuit switching was designed for and used in telephone networks when I say telephone networks I mean not necessarily mobile phone but or not using voice over IP but the home landline telephone so the concepts were of circuit switching as suited to telephone networks and in telephone networks what data do we send voice okay we're not sending web pages if we if you imagine a time before the internet and we just had telephones there were no web pages the data being sent was just voice people talking so we think the data or the application is to make a voice call so the networks were designed for transferring data which is voice they were extended to then support non-voice communications but the the main design was around transmitting voice so let's look at how circuit switching works the nodes in circuit switching connect the original source eventually through the final destination and this is what those green boxes look like in the old telephone networks so the green boxes in our network remember they data comes in they switch out to one of the output links in an old telephone network this is what a switch looked like the way that works say in a local neighborhood you have a telephone at home and there's a cable going from your home into a local telephone exchange so there's your cable you're the station connecting to the telephone exchange which is the node and everyone's home had cables going into that telephone exchange and what happens is if you want to call someone you pick up the phone and you tell the operator I want to call Steve and the operator connects so there's a port here that connects from your to your telephone line and a port to Steve's telephone line and what the operator does is basically connects them together with a cable connects them together so that now when you talk the signal carrying your voice travels across your telephone line from your home it goes into the telephone exchange and then it's hard to see but it goes into one of these cables and then out the other end and then it goes into the telephone line of the people the person you're talking to so that's the role of the switch it connects those two telephone lines yours and Steve's together and once that connected the data the voice just travels from the original source through the first link effectively through one of these cables and then on to the destination and with telephone systems that was an analogue signal and still is so when you talk an analogue signal was sent from your telephone across the cable to an exchange and then it would go across this cable and then out to the destination link and the result was once you'd made the call and you were connected as you talked it's as if you now have a link from your home into the destination destinations home the call call ease home the person you're calling and as you talk the signal that's generated just travels across your link through the switch and then direct through to the destination it's as if you have one long link in this case and that's what circuit switching does the first step is to set up that link to set up what we call a circuit from source all the way to the destination and once it's set up you can communicate today it's just done in a digital manner okay so that these are quite old but some of the switches in telephone exchanges are just computing devices that do the same thing but automated a circuit switch someone you what do you do you pick up the phone and then what do you do to call someone press the number what happens then there's some waiting for someone to respond and so what's happening in the meantime is when you press the number that triggers your phone to send a special signal to the telephone exchange effectively saying you want to call this person the number identifies the destination sends a special signal to the exchange and the exchange receives that and works out that okay I need to connect your telephone line to Steve's telephone line if you're trying to call me and it does it of course inside a computer in this case and connects or it starts to set up the connection and as it creates that it sends that special signal to Steve's telephone and what happens then it rings okay the the call ease telephone rings when it receives that signal and when they pick up the telephone then that sends a special signal back to the switch the switch now knows that the the person being called accepts that call sets up a connection or sets up that circuit so finalizes the connection between the two links and then sends the special signal back to the the callers phone and then they hear the the the sound going from ringing to now it's connected and then they can talk so that's how circuit switching works there's let's go to the three phases at the start before we send data we establish a circuit we call it a circuit because once those links are connected it's like we've connected a electrical circuit and we can send a signal all the way along that circuit a circuit sometimes we call it a connection we establish a circuit by sending some special messages from source through the nodes to the destination if the destination accepts the connection that is they pick up the the phone then a special message is sent back through the same set of nodes telling them that they've accepted the connection and telling them that they must finalize the establishment of this circuit and it gets back to you and that's when you can start communicating so we establish a circuit first which is really allocating some resources inside the nodes and for the links and then we can transfer data so in a telephone network that data you can talk so it can send a voice signal analog or digital so the same concepts can be applied for non telephone networks and at the end when you're finished talking you may hang up your phone which sends a special disconnect message to the nodes saying those nodes can remove the circuit they no longer need to connect from this link to this link and that disconnect will terminates the circuit terminates the phone call for example so three phases establish a circuit transfer data and then disconnect we're not going to cover the details of how you do that in a telephone network or in other networks just the concepts now an important point with circuit switching is that it's you can think it's all done at the signal level that is especially telephone networks and analog signal is sent across the cables to the nodes which tell them to set up that circuit and once the circuit set up that analog signal is transmitted across each link to the destination yes a motor remember a modem it was about converting your computer digital data into an analog to transmit so you'll say your dial-up modem or even your ADSL modem connects via the telephone network with a dial-up modem it's like making a phone call you dial in you make a phone call from your computer to an ISPs really receiving computer so yes that was using circuit switching with ADSL it uses circuit switching well there's only with ADSL it's different ADSL it's just from your home to the the local exchange and then it no longer uses the telephone network then your computer data goes out to the internet so with a dial-up then it was using circuit switching with ADSL it's it's changed a bit but you don't need a modem for circuit switching just your own home telephone does that for you once you establish a circuit there's a link from source all the way to destination even though it goes via multiple links the way that the circuit is set up when you transmit a signal at the source the circuit is set up so that signal will flow through all links and get to the destination as it was transmitted let's let's have a look at some examples and see some details some more examples about a telephone system don't worry too much about the names of these blue boxes so the example here is that we have some people their home telephones and this first blue box this end office is a telephone exchange so there are telephone exchanges spread across the city usually to cover a particular neighborhood in particular area so all the people living in that area have a line going into their local telephone exchange here it's called an end office and in other neighborhoods there are other telephone exchanges and of course alright first example a wants to call be a has a link into the local exchange so does be so when a makes the call it sends a special message to the local exchange which recognizes the person that calling be is also on this local exchange so the this is the switching node okay the local exchange is the device which does the switching and what it does is it effectively creates a connection between a's link and B's link or it sets up the connection tells be so these phone rings when and be accepts sends back a special message and that's when the connection is a finally established once the connections established when the person that can telephone a talks the telephone takes your audio and sends a analog signal that analog signal goes across this cable into the exchange think it goes across this internal cable and then comes out across this cable to be so it's as if we now have a link all the way from a through to be and we just send a signal and it goes right through that link if C wants to call D then it's a little bit more complicated because D is not on the same exchange they're in a different neighborhood so there's a hierarchy of telephone exchanges in this case this intermediate exchange connects the two neighborhood local exchanges for the same concept C sends a special message to the local exchange saying I want to call D the local exchange recognizes from the phone number that it will need to go to the the higher level intermediate exchange which covers say the city and that goes via a link here it's called the trunk line or a trunk link and the intermediate exchange recognizes D is that this local exchange so starts to establish a connection sends it through to D when D answers a special message comes back and as that message comes back it tells this local exchange connect D to this trunk and here connect these two trunks together and as the message comes back connect this truck to C's line C knows that D is answered and now when C talks the analog signal goes across here through this exchange through the trunk line and flows all the way through to D again as if we have one long cable going from C all the way through to D that's the idea there in in real telephone networks there's a much larger hierarchy so you have local exchanges exchanges in cities between cities and so on so there's a global hierarchy of telephone exchanges a little bit about the trunk line again the terminology is not important for this course we're not studying telephone networks but just to explain the concept this trunk line would be shared by all the users at this local exchange okay here's an exchange maybe there are 100 people connected into the first exchange so when they make calls to people on other exchanges their data must travel across this one trunk line so we would use multiplexing here this line would carry the data from multiple users at the same time as opposed to having a single line for every possible user so the idea is that when we establish a circuit we must have enough resources to support that circuit to support the connection let's say there are 100 people on this telephone exchange and that this trunk line has a capacity to support say 50 telephone calls at a time okay so each telephone call consumes some of the resource of the nodes and of the line so there's enough capacity here enough bandwidth to support let's say 50 telephone calls at the same time but there are 100 people here so what happens when you establish a circuit when C calls D that exchanges or more more generally the switching nodes allocate resources for that circuit saying okay if this connection is accepted then I'll guarantee that we'll have enough capacity to support this this circuit this phone call especially on the trunk lines so this device would do a check when the connection is tried to be established it would check is there enough capacity on this trunk line to support one more voice call if yes then it proceeds and each node would check that this node would check is there enough capacity across this trunk to support our new voice call from C to D if so everything proceeds and the connection is established if not the connection is not established so let's say currently there are 50 people already making a call via this trunk line to somewhere else then C tries to call D what happens C there's a special message sent to the local exchange at this local exchange that recognizes C wants to call D it needs to use this trunk line currently this trunk line has 50 calls in progress the capacity is 50 voice calls so the connection requests from C must be rejected and this exchange or switching nodes sends back a special response saying no you cannot connect maybe you get some network busy signal on your phone not necessarily the destination being busy okay so sometimes you try and call someone you get a special sound that indicates that they on your mobile you get a message but you on a landline you get a special sound indicating that you cannot call that that person because they are busy similar there's the concept that the network may be busy C tries to call D but they get some indicator saying that the network somewhere along the line there's not enough capacity to support your phone call the calls rejected you may may get that maybe in busy periods maybe around New Year if you try and call people it's possible that the network doesn't have enough capacity to to support one more call and that's a problem using this approach it's both an advantage and disadvantage the advantage is that we establish a circuit once it's established the resources in that path are guaranteed they're allocated for a seated cork to D but if if the capacity is currently full it means we cannot start a new connection so it's good for what the people who have started the call are guaranteed to be able to transfer their voice but it may be a problem if we reach full capacity we cannot have any new connections and that becomes a problem if someone makes a call but doesn't transfer any data it can be inefficient let's look at another aspect let's try and illustrate one other thing of circuit switching here's a simpler network a wants to station a wants to communicate with station B and there are two switching nodes in between so the path is from a to 1 to 2 to be once the circuit is established I will not draw that but once the circuit is established a transmits a signal and with circuit switching we deal with analog signals being transmitted I'll try and draw what happens once the circuit is established we can think internal for node 1 there's a link between the link from a to 1 and from 1 to 2 and similar internal to node 2 it connects those two links together the result is that when the data is transmitted and if we look at analog data then a transmits an analog signal if I try and draw that some sine wave okay that transmits along this line what happens when it gets to node 1 well node 1 knows that anything that comes in on this line as a signal comes in it knows because the circuit was established to send that same signal essentially through the node and out onto this line and it keeps going and it arrives at node 2 the signal the analog signal because the circuit's been established it knows that anything that comes in on this line from 1 which originated from a needs to go through here and out on this line and that's my sine wave and eventually received by b the establishment of the circuit allows a signal to traverse all the way from a to b through the nodes and it's as if there's now a link all the way from a to b that's the result of circuit switching from amb's perspective once the circuit is established from the data perspective it's as if we have one link all the way through okay of course there are two nodes in there but their role are just to receive the signal and transmit the signal across the next link so from the signal perspective a transmits and b receives so in terms of timing well transmission delay depends upon how much data we have to send and how fast we send and importantly propagation delay it's as if we just have one cable from a to b so circuit switching creates a link from a through to b and now the performance just depends upon the characteristics of that that link created from the circuit so in telephone networks this data would be your voice but it has been used for other non-voice applications as well and the way that the resources are allocated is that this link or the circuit once it's established is dedicated for the user's amb if a doesn't transfer transfer anything if it's if a makes a phone call but stops talking so no one's talking then the link is still established no one else can use it and that's one of the disadvantages of circuit switching the advantage is that once the circuits established it's guaranteed that amb can use that no one else can use it the disadvantage is if if it's established but amb are not sending any data then it's inefficient because we have this link or this circuit here but no one's using it and the way with circuit switching works is no one is allowed to use it once it's reserved for amb so circuit switching I think they are the main concepts that we need to be aware of a path is established before the data transfer begins and in doing that in establishing the circuit that the nodes check do we have enough capacity to support this new circuit depends upon the application as to how much is needed so they if there is then they reserve that and a reservation is that this capacity across this link is reserved for these two users no one else can use it it's what a reservation means so we check if there's enough capacity if there is then we accept the circuit if not we we reject the circuit this works well with voice traffic so it was designed for telephone networks where voice was transmitted the reason it works well is because with voice the amount of data that A sends to B and similar B sends back to A is quite predictable when someone's talking on the phone one user talks for about 30% of the time 30 or 40% of the time the other person is talking about 30 or 40% of the time and the other times are no one's talking maybe you're waiting for the other person to talk so from many years of using telephone networks the people the telecom companies measure those statistics and they know quite accurately how much data needs to be sent they know that voice occupies a bandwidth of about four kilohertz they know how much time spent is spent talking so they know and can predict how much capacity is needed especially across trunk lines the result is that once you establish your voice call you can talk clearly to the other person so designed for voice traffic sending voice data it doesn't work so well for non-voice applications like internet applications with voice the amount of data being sent is predictable or quite quite stable what about when your web browsing for example think of your computer when your web browsing over a period of say 10 minutes how much data does your computer send or receive or maybe easier when does your computer send a message when your web browsing again when you click on a link so you click on a link that triggers your computer to send a request some web pages of course have some automatic refreshing and updating so that triggers data to be sent but with web browsing what happens is usually maybe you click on a link and then you spend tens of seconds maybe a few minutes reading the page looking at it so during that time nothing's being sent so with web browsing and many other internet based applications there's usually a lot of traffic needed to be sent a lot of data and then nothing for a large period of time and then another burst of data and then nothing because you click on another link and so on and it's quite unpredictable okay a different person visiting a different website will generate a different amount of data so circuit switching is not so good for that because with circuit switching before we send data we establish a connection and we reserve resources no one else can use them but then if we start to send our web browsing data across that connection then a lot of the time we're not using it only for a small portion of time do we send actual data other time we're reading the web page and not sending and that's wasting that connection wasting the resources so it's not well suited to our typical internet data applications where is it used public telephone networks so the telephone network across the world private telephone network so say inside our campus we have telephones linked together and a private exchange a private switching node and some private is a spelling mistake data networks especially or a large example is banks so think of a bank which has branches across the country it has some central office for keeping all the records and it has ATMs thousands of ATMs a private data network many banks in the past build private data networks that they connect the branches and ATMs together such that instead of sending voice across that network they send transaction logs events from those different locations to keep track of what's happening so they'd have a network which would connect from ATMs and branch offers back to a central office but nowadays circuit switching is only really used in telephone networks no new networks really take advantage of it for data communications because it's not well suited for applications where the amount of data sent varies over time this is just another example with a call to through different switching nodes so with circuit switching and we'll compare it to the other approach in a moment but with circuit switching we'll see we reserve resources for a duration of a connection that's good in that the resources are guaranteed for that pair of users so we get guaranteed quality think of if we use circuit switching today in the internet if we did then think that from your computer you create a circuit through to the YouTube web server okay you're guaranteed to be able to transfer a 10 megabits per second for the duration of that circuit which means when you're streaming the video it's always going to be at 10 megabits per second no one else can use that capacity it's guaranteed and allocated for you so it'd be reserved through the network that would give you high quality the delay would be quite small the delay depends really of now upon how long the link is and how fast we transmit it doesn't depend so much about the intermediate nodes with circuit switching quality is good but very inefficient if I establish a circuit I reserve 10 megabits 10 megabits per second but then I don't use it for five minutes from the network perspective there's 10 megabits per second of capacity unused for five minutes for example I stream a video then I go on and do something else that doesn't require that capacity so very inefficient another small thing with circuit switching is that the devices use the same technology of the same speed think of when you call someone on the telephone then inside that circuit switching network both telephones transmit and receive the same form of signal a four kilohertz analog signal circuit switching is used in telephone networks but it does not good for internet applications so in I guess the 60s and 70s as people realize that they want to allow computer applications to send data across a network they develop new approaches and the new approach is called packet switching and that's what's used today in the internet in packet switching now think of your internet application has some data to send from one station to another so here's our two stations we have a network they'll be switching nodes inside but from the application and for the stations perspective they have some data that we want to send we break it into smaller chunks called packets and the same way that when we looked at flow control and error control we took our data and split it into frames a packet's just a different name and we send one packet at a time into the network the switching nodes deliver those packets to the destination and there are two different variants of how to deliver them the packets usually contain a header to indicate who does this packet belong to who's it going to and also in what order does this packet come in in the application data a sequence number for example so we'll we will look at the two variants for how to send the the packets through the network and then talk about well why using packets is it better than using circuit switching what advantage does it have there are two types of packet switching datagram packet switching and virtual circuit packet switching let's look at datagram packet switching first and then we'll through an example and the example is we have a source station a destination station and it has some data to send and the green circles are the switching nodes and the links between them and what the source station does is it breaks the data the original data into multiple packets another name for those packets is datagrams so they have many different names frames in some cases generally packets sometimes we refer to them as datagrams and we break it in this example into three different packets packet number one two and three and the source station sends to the first node in order first sends packet one packet two packet three and then that node will send those packets to the next node and it will follow some path through the network the nodes will choose the path we haven't touched upon how yet so sometime later let's say this first node sent the three packets to this second node and packets one and two are then being sent down to this node in the middle packet three is still being sent to the second node at some time later one important issue with datagram packet switching is the packets may take different paths and that's here packets one and two which belong to the same original set of data took this path through the middle node and in this example packet three took a different path so that's possible in datagram packet switching because in this case the nodes treat the packets independently what that means is if I'm a node I receive a packet I look at the destination alright it needs to go to this computer and I make a decision to send it to the some next node thinking it will get to the destination the next packet I get I do the same thing but I don't care about the previous decision so I receive packet number two okay who's the destination let's send to the next node and then I receive another packet and I make a decision and it may turn out over time that this node chooses to send some packets in this direction and some in another direction just because those three packets belong to the same piece of original data the internal nodes don't care about that they treat the packets independently the advantage being that that makes it very simple the nodes receive a packet send they don't need to keep track of past packets the result being is that if packets can take different paths some packets may arrive before the others in the sequence so packet three by chance arrives before one and two because it took a different path maybe this path the links are much faster and the delay is much smaller such that the packet gets there first so the result is that this last station a last node in this case puts them back into order before it sends on to the destination so it must reorder so that's a disadvantage of datagram packet switching in that we must deal with the fact that some packets may arrive out of order and put them back back into order and that's what's used in the internet today so the internet uses a protocol called IP the internet protocol and it uses this concept the source sends packets to the nodes and each node as it receives an IP packet it looks at the destination who does this need to go to decides to send it on to a next node and they don't care about the the previous packets and it makes it very simple and one of the reasons why the internet became so popular because of the simplicity of that protocol for sending data why why do packets help compared to circuits what was the problem with circuit switching now compact itself what was the problem with circuit switching look any election notes it's written there why what's the problem and then we want to know well why use packets what's the first what's the problem with circuit switching or a problem right but forget about packets for a moment what's the problem with circuit switching what is a problem we highlighted a disadvantage again it can be inefficient in using the resources okay with circuit switching a good thing is that we establish or we reserve resources so think of every link when we establish a circuit some resources are reserved across that that's good because I'm guaranteed to get some level of performance but it's bad in the cases that if if for a short period of time I'm not sending anything I've got nothing to send then in circuit switching those resources cannot be used by anyone else and that becomes inefficient you can think there's a link as a capacity of 10 megabits per second I reserve 1 megabit per second no one else is allowed to use that one of that 10 megabits per second it's reserved for me or for my connection if I've got no day to descend still no one else can use it that's the problem with circuit switching or a problem how does packet switching help in that case so that's a problem with circuit switching why can packet switching help alleviate that problem fix that problem well the idea is that if we break our data into packets and we think over a particular link if there are many people trying to send data with circuit switching each pair of users would have to reserve a part of the capacity but if at some point in time no one is using that no one is sending data it's inefficient with packet switching the idea is that as multiple users are sending packets if one user has nothing to send then it's likely that the packets of the other user can be sent and utilize that link resource so it can be more efficient let's see if we can illustrate that I won't be very good but we'll try some picture to try and illustrate that or a simple example let's say we have we'll focus on a particular link we do here's one node and we'll have another node I'll explain this in a moment this is node one this is node two and we have many users wanting to send so a b and many others wanting to send the others over here let's say c d and so on and we have a link so the scenario will focus on a particular link between two nodes inside a network this link needs to carry the data from many users from a say through to see from be through to D and others at the same time with circuit switching let's put some numbers to this to make it maybe easier to understand let's say the capacity of this link is 10 megabits per second with circuit switching we often talk about say voice calls but it's for us I think it's easier to think in terms of data rate megabits per second as a capacity that's the link capacity capacity as an eye and let's say for simplicity for the numbers that every we're going to use circuit switching first and then when someone wants to create a circuit they need to reserve one megabit per second so they need to reserve one megabit per second so with circuit switching first think of every application that creates a circuit asks for one megabit per second how many circuits can we support on this link 10 okay what would happen let's say a creates a circuit to see b to D so they've reserved two megabits per second once we have 10 there we've reserved 10 in total 10 different circuits when another person wants to create a circuit they send a special message it gets here and this node one would reject and say no my link has capacity for 10 if I've reserved 10 at this point in time a request for more resources will be rejected so with circuit switching that's how we allocate resources now the problem is if we have 10 10 circuits reserved let's say currently we have 10 circuits open so we've reserved the 10 full 10 megabits per second the problem is that with circuit switching is even though this is reserved if a is sending no data to see they've reserved us a connection but they're sending no data and similar maybe be has reserved a connection but he's sending no data to D then really the link has a capacity of 10 megabits per second but at some point in time maybe we're only using 8 megabits per second because even though some of reserved capacity they're not using it and that's a waste that's the disadvantage of circuit switching because what could happen if the 11th user came along if the current use was 10 sorry if the current use was 8 out of the 10 if the 11th user come up came along then it would make sense to allow them to use that link but it's not possible with circuit switching because it's reserved and allocated so how can packet switching help us in this case well I don't know how to draw up but these users same case the applications want to send one megabit per second but they don't reserve it say we still have a capacity of 10 megabits per second but with packet switching each user sends packets from their link into node one as my packets drawn there and similar be is sending packets at different times into node one and so other users and what node one does is takes those packets and sends them out to node two packets from different users and sends them to node two the idea is that currently maybe there are 10 10 users sending at 1 megabit per second so a is sending at 1 megabit per second b is and so on there are 10 different users sending packets at 1 megabit per second then everything would be okay because our link has a capacity of 10 megabits per second 10 users sending in to node one at 1 megabit per second node one can send out at 10 megabits per second and that would be okay if if now there were 10 users sending at say slightly less 800 kilobits per second 10 users sending at 800 kilobits per second what comes out across the link if we're 10 sending in at 800 kilobits per second what comes out is 8 megabits per second so during the stages when the users are not sending so much even though they may want to send most the time 1 megabit per second if they send less then they become spare capacity so if there are 10 users sending at 800 kilobits per second the amount we use is 8 megabits per second and we have 2 megabits per second of spare capacity so an 11th user could then send some packets in and the packets for the 11th user could use up that spare capacity and maybe the 12th user so if we don't reserve resources with packet switching what it allows us to do is especially in cases when the users are not sending at the maximum in this case at 1 megabit per second that the spare capacity can be allocated to other users it's hard to illustrate but you can think okay if if B is not sending then it means that we've got some spare capacity on this link and we can use the packets from some other user the 11th user can be sent when B is not sending the idea is that with many internet applications the rate at which packets are sent varies over time sometimes A is sending a lot sometimes are sending nothing and sometimes B is sending a lot sometimes are sending nothing so over time if we're lucky what we get is that for most of the time maybe is a period when A is sending nothing so we can send B's packets and when B is sending nothing we can send A's packets so we can more efficiently share that capacity amongst the users now there's a problem that arises what if there are 11 users sending 1 megabit per second what happens there's no reservation but 11 users start their application to transfer data and they're all sending 1 megabit per second into node 1 what happens well 11 megabits coming in capacity of 10 megabit per second going out not all packets can come out well for a short period of time at least they can be queued here put them in a queue and make them wait until we have some capacity to send them out so that's works well in the case when there's a maybe a small burst of sending for most of the time there's only 10 users sending at a low rate but then there's a small time when say 11 users sending at the maximum rate 1 megabit per second so we can't of course send it all out so some of the packets would be queued here and wait a little bit and then maybe A slows down and then those queued packets can be sent in the spare capacity so with packets we can adapt in a much more dynamic way so that spare capacity can be used when when it's available and in the case that we reach capacity then the packets will be delayed a little bit they'll be queued and that's where we get queuing delay with circuit switching we just reserve no one else can use it very good for those users but very inefficient when our data sending rates vary that maybe it's not the best illustration of the difference but hopefully you pick up with packet switching we can send packets from different users and use up the capacity in a more efficient way than if we allocate in circuit switching and it works very well on the internet because in the internet many of the applications send at varying rates sometimes I send a lot then I send nothing when I'm sending nothing you can send your packets and over for a large number of users that averages out to be quite efficient so datagram packet switching split our data into packets send them one at a time there's an alternative called virtual circuit packet switching use packets and have the same advantages in that we can be more efficient in using the link but try to pretend to be like circuit switching so we create virtual circuits remember with circuit switching with real circuit switching before they send data they establish the circuit there's a special message to establish the circuit amongst that set of nodes in datagram packet switching there's no such process we just send the packets with virtual circuit packet switching we establish a virtual circuit first say from one source to a particular destination and then send the packets and one difference that we see with this example let's say our source station has already established this circuit or this virtual circuit along this path then in virtual circuit packet switching the packets that the source sends follow that same path always they will not take a different path which is different from datagram packet switching and that the packets may go in different directions this has the advantage in that a the packets take the same path so we're we're likely to get reliable or predictable performance as opposed to sending in many different paths and also has the advantage is that we inform these nodes in advance that we're going to send packets through them so they can allocate resources in datagram packet switching when a node receives a packet it didn't know it was coming so it's very simple with datagram packet switching but there's no advanced notice that you're going to receive you know one megabit per second for the next five minutes with virtual circuit packet switching we get some advanced notice at the nodes that there will be packets coming from this source for some duration we can plan better what's the problem with virtual circuit packet switching compared to datagram packet switching what's the disadvantage the other links are not used that is we always use this one path that can be a problem in that if this path becomes busy okay it's because there's also packets so be careful this path may still have packets from other users it's just that the packets from this pair of users take this path but if becomes busy then we cannot redirect quickly the packets to another path yes correct other problems there's a delay upon startup you want to transfer data with virtual circuit packet switching and also with circuit switching we first send this special message to the destination and get a response back then we send our data with datagram packet switching I just immediately send data so the delay upon startup can be an issue next week though we'll just summarize some of those advantages for today next week we'll look at some issues of packet size and this will look at this example in a bit more depth but this is a some timing and you see on the left circuit switching in the middle virtual circuit packet switching on on the right datagram packet switching there's a delay to set up the connection take some time to get our special message from source to destination and the response back then we send data same with virtual circuit packet switching take some time before we send the data with datagram packet switching just send the data immediately that's good because there's no delay upon startup we'll do a little bit more analysis of that next week and do some calculations there and I think we'll stop there so next week we'll return to those two slides about the timing do some example calculations and then summarize some of the trade-offs between these three switching techniques