Topologies, Routing and Deadlock
Shared by: siz19146
Topologies, Routing and Deadlock Various speeds of networks 1Gb 100Mbb BUS LAN 10Mb MAN 1Mb WAN 100Kb 10Kb EXCH 1Kb 0.1m 1m 10m 100m 1Km 10Km 100Km1000Km Figure – Recap of speeds Speed of LANs The raw transmission rate of LANs are high, typically being in the 1-1000 Mbps range. On some LANs (eg Open System LANs) every device has the potential of connecting to any other device on the LAN. Smaller LANs typically operate on a Slave/Master basis with slave PCs clustered around a shared master filestore system. Network Sharing A fundamental feature of many LANs is the network itself is shared. The physical network medium is shared by many machines. In a traditional network, each machine is usually wired into a switching device. For example, your telephone is connected to your local switching office. Low Error Rates/Low Cost On LANs, network errors are expected to be relatively few when compared with larger networks. LANs are relatively inexpensive when compared to the cost of the equipment that connects to it. However, Each Network Interface Unit (NIU) still costs in the region of £80-£200. WAN A WAN (Wide Area Network) is a network that is spread over multiple sites (>30Km). WANs are not limited in size (they can even cross the world). Public facilities (such as the public switched telephone network) are extensively used. However, this means that the rate at which data is sent is limited by the bandwidth of these facilities. WAN vs. LAN When comparing WANs with LANs, the main difference is in the data transmission rates. Delay and error rate parameters are also relevant to some applications. We can view the technical facilities offered by a WAN as a subset of those offered by a LAN. What a WAN offers is long distance connectivity. Implementation of a Computer Network How easy a network is to use depends on the sophistication of the software provided. The most basic level of netware provision is to only have programs designed for specific tasks such as file transfer. More sophisticated systems incorporate network facilities in the operating system of the computer (thus network operations become a coherent part of the user interface). The Most Sophisticated type of Software Provision The highest level of refinement is to regard each computer as part of a single distributed operating system. This level of sophistication allows the user to access files, programs, utilities and resources as if they were on his or her own computer. Network Specifications A network implies that all the computer can communicate with each other. This requirement can be met in a number of ways but there are certain basic principles common in most networks. Network Structure Each host computer communicates via a Network Interface Unit (NIU). By host computer we mean computers on which users can run applications. The term node is often used for the intelligent interface that is part of each host computer (or sometimes for the host computer itself). The term node can also be used to mean another computer with which the host communicates (such as a server or a router). Network Topology The term topology refers to the way in which the nodes of a network are connected. The topology of a network will effect its performance (it terms of speed) and its cost (both short and long term). Cost/resource considerations and the environment in which the network is to be used often determines the choice of topology. Switching Networks/Broadcast Networks We can distinguish networks by the way in which they transmit data. WAN usually use switching networks to send data from source to destination nodes. LANs, however, often use broadcast networks because they are cheaper to build and maintain. Broadcast networks send all the data to all nodes (which must out listen for the data meant for them). Common Topologies Common topologies are: – MESH – STAR – BUS – TREE – RING – BACKBONE Mesh Topology A mesh topology is a network in which the connections between nodes is random. Fully connected Network Random Network with 7 with 5 nodes nodes Mesh topologies include fully connected networks and random networks (e.g. Internet). Redundant connections in random networks ensure that alternative routes exist for data. Fully Connected Networks Fully connected networks are the fastest types of networks since each device directly connects to every other device. There is no time delay due to switching. If there are N hosts in the network, we need N(N-1)/2 bi-directional connections (e.g. 20 hosts needs 190 connections). This is far too many connections (most of which will be idle most of the time). Sharing Connections Without a fully connected network, connections between nodes must be shared. One way to do this is to allow nodes to switch data through a random network. We can view a random network as interconnecting star networks. Data is passed through this network, via intermediate nodes, until it arrives at its destination. Star Networks A star network consists of a special central node (or hub node) to which host computers or terminals are connected. Special Central Node Any host computer can connect to any other host computer via the hub. Star Networks The hub switches messages through to the appropriate destination. The hub may also provide a translation service for devices with different protocols. Star Networks are vulnerable, however. If the hub fails then the network fails. Star Networks may require a lot of cabling and can be expensive to install. Bus Networks A bus network consists of a single medium (typically 5 pair twisted-wire cable) to which all the host computers are connected. Host Computers Bi-directional medium Network Terminator Interface Units Packets are broadcasted on the medium to all nodes on the network. Contention The is an obvious danger that two host computers may attempt to use the network medium simultaneously. This problem is called contention and is a problem with all Bus topologies. The nodes must employ Medium Access Protocols, which function in conjunction with other nodes, to permit access only at times when the medium is free. Tree Networks A tree network (as used in LANs) is a variant of the Bus topology. Root Node Host Computers Communications Link Nodes are connected in a tree structure and messages are broadcast across whole tree. Tree Networks Tree topologies have the advantage that they are easy to expand. Furthermore, if a fault occurs, the effected branch can be easily isolated so that the rest of the network is not effected. The disadvantage is that signals can be reflected from the ends of branches and cause interference. For this reason, Tree Networks are usually run at lower speeds. Ring Topology A Ring network consists of nodes connected to each other to forma a closed loop. Host Computers Data Flow ACTIVE CABLE Nodes accept data from neighbouring nodes in the form of packets. Ring Topology Operation The NIUs (or, in some cases, the hosts themselves) act as repeaters for the packets being forwarded. This means that the Ring can be expanded to any size (although more hops will be required to get the packets to their destinations). One big advantage of Ring Topologies is that contention is avoided since each repeater knows if it has to forward an existing packet or is free to accept a new one. Dealing with Contention Contention is dealt with by either using a slotted ring system or a token-passing ring. With the slotted ring system, blank fixed sized frames are passed around the network. These frames get filled in with data as they pass a node that wishes to transmit. The frame goes around the entire network and is copied by the destination node as it passes. Token-Passing Ring A token-passing ring is similar to a slotted ring except that a ‘token’ frame is passed around the ring. If a ‘token’ arrives at a node, it can be exchanged for a data packet. The data packet is sent around the entire network and is copied by the destination node as it passes. When the packet comes back to the sender, the sender puts the token back on the network. Removing Packets/Frames A frame, or packet, will circulate around the network until removed. In some networks it is the destination node that removes it. In other networks it is the sender that removes it. The advantage of getting the sender to remove the frame is that it allows data to be broadcast to any number of nodes. Housekeeping If, for some reason, a frame is not removed by the sender it will circulate forever and reduced the efficiency of the Ring network. This is not a problem with Bus networks since terminators (or Head Ends) absorb unwanted packets. Devices called monitors are responsible for housekeeping by marking frames as they pass. If a marked frame comes back round to the monitor, it is then removed. Backbone Network A backbone network connects many smaller networks via devices called bridges. This type of network is easy to expand and isolates local traffic. Transmission of Data A network implies that we wish to transmit data from one node to other nodes. In switched networks, we can use four switching methods: – Circuit Switching (e.g. POTS technology) – Message Switching – Packet Switching – Virtual Circuits (e.g. ATM technology) Circuit Switching We have already seen circuit switching in POTS and it is the same in computer networks. A connection from node A to node B is established and the full bandwidth of that connection is available for communication. The connection remains in place for the duration of the computer conversation. Time Sequence Diagram for Circuit Switching We can use a time sequence diagram to see the order of events in circuit switching. node switch switch node A Establish 1 2 B Connection Establish Connection Establish Connection t Acknowledge Acknowledge i Connection Acknowledge Connection m e Connection Send Data Relay Data Relay Data Send Data Relay Data Relay Data Close Connection Close Connection Close Connection Message Switching Message switching sends complete messages from node to node until they reach their destination. Because messages are of variable length, they time delay for delivery is variable. This makes message switching unsuitable for interactive traffic. Large messages can also cause congestion and overflow switches with small memory. Time Sequence Diagram for Message Switching The events in message switching occur as follows: node switch switch node A 1 2 B Send Send small Message Relay Message Message Relay Message t i m Send large e Message Send Message Relay Message Relay Message Packet Switching Packet switching is similar to message switching except that the messages are broken up into small datagrams called packets (about 1Kbyte in length). Because packets are smaller than messages, they do not suffer the same delays as messages do. This makes packet switching better for interactive traffic. Time Sequence Diagram for Packet Switching Host A node switch switch node Host B A 1 2 B Transmit Send Message broken Packet 1 Packet 1 Small into packets with Packet 2 Packet 1 distinct sequence Packet 2 Packet 1 Message numbers Packet 3 Packet 2 Packets Packet 1 Packet 3 Packet 2 reassembled into Packet 2 Received Packet 3 message using Packet 3 Small t Packet 3 sequence i numbers to order Message m Transmit Packet 1 e Packet 1 Packet 1 Packet 2 Packet 1 Packet 2 Message broken Send Packet 1 Packet 2 Packet 3 Packet 3 into packets with Large Packet 2 distinct sequence Packets Packet 2 Packet 3 Packet 4 Message Packet 3 Packet 4 numbers Received reassembled into Packet 3 Packet 4 Packet 5 Large message using Packet 4 Packet 5 sequence Packet 4 Packet 5 Packet 6 Message numbers to order Packet 5 Packet 6 Packet 5 Packet 6 Packet 6 Packet 6 The time delay between sending first packet and its delivery is much less. Virtual Circuit A Virtual Circuit is similar to packet switching with the exception that all the packets follow the same route. The route, or virtual circuit, is established in a similar way as a connection of a circuit switched network. The difference is that connections are shared between many virtual circuits. Time Sequence Diagram for Virtual Circuit (LLC-2) Host B Host A node switch switch node A Establish 1 2 B L_connect_req Connection Establish Connection Establish Connection L_connect_req tim Acknowledge L_connect_ e Acknowledge Connection confirm Acknowledge Connection Indicate Status L_connect_ L_connect_ Connection Indicate Status indication confirm Indiate Status L_connect_ indication Send Data L_data_ Relay Data connect_req L_data_ Relay Data connect_req L_connect_dat L_connect_dat Confirm Data Confirm Data a_confirm a_confirm Confirm Data Indicate Status L_connect_ L_connect_ indication Indiate Status Indicate Status indication L_disconnect_ req Close Connection Close Connection Close L_disconnect_ Connection req L_disconnect_ L_disconnect_ Disconnect Disconnect confirm confirm Disconnect Network Control In a switched network, we need to have mechanisms for controlling the movement of data. There are three main aspects to Network Control: – Routing – Flow Control – Error Control Routing Routing is the process of directing data around the network. Ideally we want to direct as much data from the source to the destination with the minimum delay. How well this can be done depends a great deal on the topology of the network . In a simple network (such as a star topology) there is little difficulty. Routing in a Mesh Network Routing becomes complicated in a random mesh network (as widely used in WANs). One widely used method uses routing tables to decide the best direction to send data. 2 5 End Device 1 End Device B 3 A Routing Table for 4 6 Node 1 Routing Table for A5 3 2 Node 3 A2 2 A5 5 6 3 A6 4 A2 5 1 … … 3 A6 6 5 … … … … Packet Destination Next Node Address Alternative Next Node Routing Packets (or Frames) Packets (or Frames) enter the network with a destination address field and a source address field. At each node, the destination address is used to look up an entry in a routing table. The routing table tells the node which is the preferred direction to send the data. A alternative direction is usually also provided in case the first is unavailable. Routing Tables The routing tables obviously need to be filled in. There are a number of approaches for doing this. There are two basic classes of routing algorithm: – shortest-path algorithms try to find the least cost path between source and destination. – bifurated routing algorithms attempt to evenly spread out the load across the entire network. Effects of Routing on Quality of Service (QOS) Routing effects two Quality of Service (QOS) parameters: transit delay and throughput. Networks are often described in terms of common qualitative and quantitative parameters known collectively as QOS parameters. QOS parameters are worth a brief discussion in themselves. Quality of Service There are 8 parameters commonly used to describe networks (typically WANs). – Connection establishment delay is the time it takes between a request for a connection from host A to host B and receiving confirmation. – Connection establishment failure probability is the chance that a connection is not confirmed within a reasonable time. – Throughput is the amount of user data (usually in bytes) successfully transmitted from A to B every second. Quality of Service – Transit delay is the time between sending data and it being received by the destination host. – Residual error ratio is the proportion of packets that are lost or garbled. – Protection is how easy it is for a third party to listen to or corrupt data in the network. – Priority is if it is possible to earmark some connections as having a greater priority than others. – Resilience is the probability that a connection is terminated due to congestion or network faults. Quality of Service for LANs Although LANs can use the same parameters for Quality of Service, their small size and general reliability means that greater emphasis is placed on parameters such as priority. Measuring Throughput and Transit Delay We can measure throughput and transit delay by examining acknowledgements sent back to the source host from the destination host (this is called feedback). The number of acknowledgements received back in a second will tell us the throughput and the difference in the time fields of the packet (or frame) and the acknowledgement tells us the transit delay. Feedback in Flow Control To avoid congesting various parts of the network, the number of packets offered to any sub-net should match its throughput. Delay Offered Flow Control Throughput Routing Load Rejected Load Feedback can be used to dynamically control the number of packets (or frames) given to the sub-net. This is flow control. Transit Delay vs. Throughput Ideally we want the throughput to equal the offered load. Excessive offered loads result in a portion of the packets (or frames) being rejected (either discarded or sent via an alternative route). Achieving maximum throughput in a network often comes at the cost of greater transit delay. Flow control is usually designed to find a balance between them. Effects of Good Routing While precise balance between throughput and transit delay is determined by flow control, the effects of good routing within a network are to improve throughput and reduce transit delay. More Flow Delay Control Pressure (microseconds) Poor Routing Good Routing Throughput (packets per second) Deterministic Routing If the routing tables used by the nodes are fixed, then the routing method is known as fixed routing or deterministic routing. Here routing tables are change only occasionally (typically when there has been a change to the network). Any modifications to the tables are usually managed centrally or from regional centres. There is an advantage to this since routes can be assigned to users as they log on. Adaptive Routing An improved scheme is to use traffic flow data on neighbouring nodes in order to dynamically decide the best route to send packets (or frames). This approach reduces the chance of packets being rejected. The snag is that the traffic flow data itself has to be transmitted and this traffic reduces the amount of user data that can be sent. Isolated Adaptive Routing Despite the snag adaptive routing is used in many WANs. One form of adaptive routing measures queue sizes and (together with a weight) chooses to use alternative routes on a probabilistic basis. Weight = 3 F F Primary Route (3+1) The ratio of F F E (W1+E1): A Output either route is taken B Queues (W2+E2) E is used. E=Empty E E F Secondary Route (1+3) F=Full F Weight = 1 Distributed Adaptive Routing A different algorithm is used in ARPANET. Here the object is to find the path of least delay under the prevailing conditions. The average delay for each of the neighbouring nodes is measured and, every 10 seconds, this information in propagated to other nodes. In this way, a dynamic database is formed of the current fastest route in the local area of the network. Distributed Adaptive Routing The delay incurred as a result of the updating process can be considerable. If one packet is used by each node during each time period to update its routing table, then the cost can very high. In earlier versions of ARPANET, updates were performed every 0.67 seconds. This used up about 50% of the network capacity. Now they are performed every 10 seconds only when there are significant changes. Flooding We can dispense with a formal systematic routing algorithm altogether by using flooding or random routing techniques. In flooding, every packet is sent down every connection to a node except the one on which the packet was received. This ensures that the data gets through to every node and will arrive in the shortest time. This type of routing produces an excessive amount of traffic, however. Random Routing In random routing, the choice of output path is any path on which the packet (or frame) did not arrive. The choice is made randomly and so ensures that traffic is evenly spread across the network. The only problem is that the packet may take a long time to find the destination node. Flow Control and Congestion Flow Control simply means the methods used to keep network traffic moving. This means taking measures to avoid sending packets (or frames) towards bottlenecks in the network. If more traffic offered to part of the network that it can handle, then buffers in it will overflow and packets will be lost. Congestion is when part of a network has so many packets, none of them can move at all! Flow Control and Transit Delays Flow control is often used on host machines to hold back the transmission of packets until the network is able to accept them without risking congestion or overflow. This keeps the traffic on the network down but does not reduce the transit delay since the delay is simply shifted to the host machine rather than the network. The only way to avoid dissatisfaction is to ensure there is sufficient network capacity. Keeping Users Out Another way to avoid overflowing the network is to prevent user from logging in when the network is near to full capacity. This approach tends only to cause another type of dissatisfaction. When delays do become to long, things just get worse: – packets (or frames) get discarded – the timers on hosts run out and they retransmit. A Brief Word about Timers In many data link protocols, the source host expects to receive acknowledgements (ACK or NAK signals) from the destination host when packets (or frames) arrive. If this does not happen within a certain time then the source host assumes that the packet was lost or corrupted in transit and retransmits the packet. • Note: ACK means that the packet was received intact and NAK means that it was not (please retransmit the packet). Time Sequence Diagrams for Timer Host A Host Host Host Node Node Node Node B A B Send Frame Relay Frame Send Frame Relay Frame Relay Frame Frame Lost 2Propagatio T 2Propagation n delay I delay Relay Send Retransmit m Relay ACK/NAK ACK/NAK Frame e ACK/NAK Relay Frame Retransmit if Relay Frame Relay Frame NAK Relay Frame Send ACK Relay ACK Relay ACK ACK (or NAK) arrives back in time ACK (or NAK) does not arrive back Buffer Overflow Consider a situation where two sessions are passing packets through the same node. End Device X Slow Link 2 Fast Link 5 End Device 1 B End Device A 3 4 6 End Device Y Node 3 will temporarily store the packets it receives in its buffers. Buffer Overflow Imagine now that the buffer is full. The node will only be able to accept a new packet once it has sent an old one. Now imagine that one of the incoming links is 10 times faster than the other one (not an uncommon situation). Every time a space is made in the butter, the node is 10 times more likely to accept a new packet from the faster link. Connection Blocked by Buffer Overflow The effect is to almost block the other connection since most of its packets will be rejected by the central node. This problem can be overcome by using more complex nodes that have separate buffers for all the incoming links and sends packets out with equal priority (say by using a round-robin selection from each buffer). Deadlock Another problem that can cause congestion in a network is that of deadlock. Imagine two nodes, P and Q, are transmitting packets to one another. Now imagine that both their buffers are full. P Q (Full) (Full) Both are unable to receive packets so no packets move. Finally…..Overcoming Deadlock This is a simple example of deadlock. There may be many nodes involved (typically in cycles) where each is unable to transmit packets to the next. We can overcome this by having separate buffers for different priority packets. The more links a packet travels over, the greater its priority. Deadlocks do not occur because it is unlikely that packets will overflow all the buffers. If a packet gets a priority greater than n-1 then the packet is discarded (it is assumed to have travelled in a loop). This also ensures that a deadlock cannot occur. Another (less certain method) is to allow deadlocks to occur and regularly discard very old packets to try to clear them.