Better to know some
... than all
Switching is the generic method for establishing a path for point-to-point communication in a network. It involves the nodes in the network utilizing their direct communication lines to other nodes so that a path is established in a piecewise fashion . Each node has the capability to 'switch' to a neighboring node (i.e., a node to which it is directly connected) to further stretch the path until it is completed.
One of the most important functions of the network layer is to employ the switching capability of the nodes in order to route messages across the network. There are two basic methods of switching: circuit switching and packet switching. These are separately discussed below.
In circuit switching, two communicating stations are connected by a dedicated communication path which consists of intermediate nodes in the network and the links that connect these nodes. What is significant about circuit switching is that the communication path remains intact for the duration of the connection, engaging the nodes and the links involved in the path for that period. (However, these nodes and links are typically capable of supporting many channels, so only a portion of their capacity is taken away by the circuit.)
When the two hosts initiate a connection, the network determines a path through the intermediate switches and establishes a circuit which is maintained for the duration of the connection. When the hosts disconnect, the network releases the circuit. Circuit switching relies on dedicated equipment especially built for the purpose, and is the dominant form of switching in telephone networks. Its main advantage lies in its predictable behavior: because it uses a dedicated circuit, it can offer a constant throughput with no noticeable delay in transfer of data. This property is important in telephone networks, where even a short delay in voice traffic can have disruptive effects.
Circuit switching main weakness is its inflexibility in dealing with computer oriented data. A circuit uses a fixed amount of bandwidth, regardless of whether it is used or not. In case of voice traffic, the bandwidth is usually well used because most of the time one of the two parties in a telephone conversation is speaking. However, computers behave differently; they tend to go through long silent periods followed by a sudden burst of data transfer. This leads to significant underutilization of circuit bandwidth.
Another disadvantage of circuit switching is that the network is only capable of supporting a limited number of simultaneous circuits. When this limit is reached, the network blocks further attempts for connection until some of the existing circuits are released.
Packet switching was designed to address the shortcomings of circuit switching in dealing with data communication. Unlike circuit switching where communication is continuous along a dedicated circuit, in packet switching, communication is discrete in form of packets. Each packet is of a limited size and can hold up to a certain number of octets of user data. Larger messages are broken into smaller chunks so that they can be fitted into packets. In addition to user data, each packet carries additional information (in form of a header) to enable the network to route it to its final destination.
A packet is handed over from node to node across the network. Each receiving node temporarily stores the packet, until the next node is ready to receive it, and then passes it onto the next node. This technique is called store-and-forward and overcomes one of the limitations of circuit switching. A packet-switched network has a much higher capacity for accepting further connections. Additional connections are usually not blocked but simply slow down existing connections, because they increase the overall number of packets in the network and hence increase the delivery time of each packet.
Two variations of packet switching exist: virtual circuit and datagram. The virtual circuit method (also known as connection-oriented) is closer to circuit switching. Here a complete route is worked out prior to sending data packets. The route is established by sending a connection request packet along the route to the intended destination. This packet informs the intermediate nodes about the connection and the established route so that they will know how to route subsequent packets. The result is a circuit somewhat similar to those in circuit switching, except that it uses packets as its basic unit of communication. Hence it is called a virtual circuit.
The datagram method (also known as connectionless) does not rely on a reestablished route, instead each packet is treated independently. Therefore, it is possible for different packets to travel along different routes in the network to reach the same final destination. As a result, packets may arrive out of order, or even never arrive (due to node failure). It is up to the network user to deal with lost packets, and to rearrange packets to their original order. Because of the absence of a reestablished circuit, each packet must carry enough information in its header to enable the nodes to route it correctly.
The advantage of the datagram approach is that because there is no circuit, congestion and faulty nodes can be avoided by choosing a different route. Also, connections can be established more quickly because of reduced overheads. This makes datagram's better suited than virtual circuits for brief connections. For example, database transactions in banking systems are of this nature, where each transaction involves only a few packets.
The advantage of the virtual circuit approach is that because no separate routing is required for each packet, they are likely to reach their destination more quickly; this leads to improved throughput. Furthermore, packets always arrive in order. Virtual circuits are better suited to long connections that involve the transfer of large amounts of data (e.g., transfer of large files).