Network Switching
Network Switching
Network Switching
Switching is process to forward packets coming in from one port to a port leading
towards the destination. When data comes on a port it is called ingress, and when
data leaves a port or goes out it is called egress. A communication system may
include number of switches and nodes. At broad level, switching can be divided into
two major categories:
Connectionless: The data is forwarded on behalf of forwarding tables. No
previous handshaking is required and acknowledgements are optional.
Connection Oriented: Before switching data to be forwarded to destination,
there is a need to pre-establish circuit along the path between both endpoints.
Data is then forwarded on that circuit. After the transfer is completed, circuits
can be kept for future use or can be turned down immediately.
Circuit Switching
When two nodes communicate with each other over a dedicated communication path,
it is called circuit switching.There 'is a need of pre-specified route from which data
will travels and no other data is permitted.In circuit switching, to transfer the data,
circuit must be established so that the data transfer can take place.
Circuits can be permanent or temporary. Applications which use circuit switching
may have to go through three phases:
Establish a circuit
Transfer the data
Disconnect the circuit
Circuit switching was designed for voice applications. Telephone is the best suitable
example of circuit switching. Before a user can make a call, a virtual path between
caller and callee is established over the network.
Message Switching
This technique was somewhere in middle of circuit switching and packet switching.
In message switching, the whole message is treated as a data unit and is switching /
transferred in its entirety.
A switch working on message switching, first receives the whole message and
buffers it until there are resources available to transfer it to the next hop. If the next
hop is not having enough resource to accommodate large size message, the message
is stored and switch waits.
Packet Switching
Shortcomings of message switching gave birth to an idea of packet switching. The
entire message is broken down into smaller chunks called packets. The switching
information is added in the header of each packet and transmitted independently.
It is easier for intermediate networking devices to store small size packets and they
do not take much resources either on carrier path or in the internal memory of
switches.
Packet switching enhances line efficiency as packets from multiple applications can
be multiplexed over the carrier. The internet uses packet switching technique. Packet
switching enables the user to differentiate data streams based on priorities. Packets
are stored and forwarded according to their priority to provide quality of service.
Circuit Switching-
This switching technique operates in the following three phases-
1. Establishing a circuit
2. Transferring the data
3. Disconnecting the circuit
1. Establishing A Circuit-
In this phase,
A circuit is established between the two ends.
Circuit provides a dedicated path for data to travel from one to the other end.
Resources are reserved at intermediate switches which are used during the
transmission.
The intermediate switches are connected by the physical links.
2. Transferring The Data-
After the circuit is established,
The entire data travels over the dedicated path from one end to the other end.
3. Disconnecting The Circuit-
After the data transfer is completed,
The circuit is torn down i.e. disconnected.
Total Time-
Message Switching-
In message switching,
There exists no dedicated path to transfer data.
The entire message is treated as a single data unit.
The message is then forwarded from hop to hop.
Store and Forward is an important characteristic of message switching.
The message carries a header that contains the full information about the destination.
When any intermediate switch receives the message, it stores the entire message.
The message is stored until sufficient resources become available to transfer it to the
next switch.
When resources become available, the switch forwards the message to the next
switch.
Advantages-
Point-01:
It improves the channel efficiency over Circuit Switched Network.
In circuit switched network, the channel is blocked for two ends only.
But here, more devices can share the channel.
Point-02:
It is helpful in reducing traffic congestion.
The message may be temporarily stored in the route and then forwarded whenever
required.
Point-03:
It is helpful in setting the message priorities due to store and forward technique.
Disadvantages-
Point-01:
It requires enough storage at every switch to accommodate the entire message
during the transmission.
Point-02:
It is extremely slow due to store and forward technique.
Also, the message has to wait until sufficient resources become available to transfer
it to the next switch.
Packet Switching-
In packet switching,
The entire message to be sent is divided into multiple smaller size packets.
This process of dividing a single message into smaller size packets is called
as packetization.
These smaller packets are sent after the other.
It gives the advantage of pipelining and reduces the total time taken to transmit the
message.
Optimal Packet Size-
If the packet size is not chosen wisely, then-
It may result in adverse effects.
It might increase the time taken to transmit the message.
So, it is very important to choose the packet size wisely.
Example-
Consider-
There is a network having bandwidth of 1 MBps.
A message of size 1000 bytes has to be sent.
Packet switching technique is used.
Each packet contains a header of 100 bytes.
Out of the following, in how many packets the message must be divided so that total
time taken is minimum-
1. 1 packet
2. 5 packets
3. 10 packets
4. 20 packets
NOTE
While calculating the total time, we often ignore the propagation delay.
The reason is in packet switching, transmission delay dominates over propagation delay.
This is because each packet is transmitted over the link at each hop.
Let us analyze each case one by one.
Case-01: Sending Message in 1 Packet-
In this case, the entire message is sent in a single packet.
Size Of Packet-
Packet size
= 1000 bytes of data + 100 bytes of header
= 1100 bytes
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 1100 bytes / 1 MBps
= 1100 x 10-6 sec
= 1100 μsec
= 1.1 msec
Total Time Taken-
Total time taken to send the complete message from sender to receiver
= 3 x Transmission delay
= 3 x 1.1 msec
= 3.3 msec
Case-02: Sending Message in 5 Packets-
In this case,
The entire message is divided into total 5 packets.
These packets are then sent one after the other.
Data Sent in One Packet-
Data sent in one packet
= Total data to be sent / Number of packets
= 1000 bytes / 5
= 200 bytes
Size Of One Packet-
Packet size
= 200 bytes of data + 100 bytes of header
= 300 bytes
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 300 bytes / 1 MBps
= 300 x 10-6 sec
= 300 μsec
= 0.3 msec
Time Taken By First Packet-
Time taken by the first packet to reach from sender to receiver
= 3 x Transmission delay
= 3 x 0.3 msec
= 0.9 msec
Time Taken By Remaining Packets-
Time taken by the remaining packets to reach from sender to receiver
= Number of remaining packets x Transmission delay
= 4 x 0.3 msec
= 1.2 msec
Total Time Taken-
Total time taken to send the complete message from sender to receiver
= 0.9 msec + 1.2 msec
= 2.1 msec
Case-03: Sending Data in 10 packets-
In this case,
The entire message is divided into total 10 packets.
These packets are then sent one after the other.
Data Sent in One Packet-
Data sent in one packet
= Total data to be sent / Number of packets
= 1000 bytes / 10
= 100 bytes
Size Of One Packet-
Packet size
= 100 bytes of data + 100 bytes of header
= 200 bytes
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 200 bytes / 1 MBps
= 200 x 10-6 sec
= 200 μsec
= 0.2 msec
Time Taken By First Packet-
Time taken by the first packet to reach from sender to receiver
= 3 x Transmission delay
= 3 x 0.2 msec
= 0.6 msec
Time Taken By Remaining Packets-
Time taken by the remaining packets to reach from sender to receiver
= Number of remaining packets x Transmission delay
= 9 x 0.2 msec
= 1.8 msec
Total Time Taken-
Total time taken to send the complete message from sender to receiver
= 0.6 msec + 1.8 msec
= 2.4 msec
Case-04: Sending Data in 20 Packets-
In this case,
The entire message is divided into total 5 packets.
These packets are then sent one after the other.
Data Sent in One Packet-
Data sent in one packet
= Total data to be sent / Number of packets
= 1000 bytes / 20
= 50 bytes
Size Of One Packet-
Packet size
= 50 bytes of data + 100 bytes of header
= 150 bytes
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 150 bytes / 1 MBps
= 150 x 10-6 sec
= 150 μsec
= 0.15 msec
Time Taken By First Packet-
Time taken by the first packet to reach from sender to receiver
= 3 x Transmission delay
= 3 x 0.15 msec
= 0.45 msec
Time Taken By Remaining Packets-
Time taken by the remaining packets to reach from sender to receiver
= Number of remaining packets x Transmission delay
= 19 x 0.15 msec
= 2.85 msec
Total Time Taken-
Total time taken to send the complete message from sender to receiver
= 0.45 msec + 2.85 msec
= 3.3 msec
Observations-
When data is sent in 1 packet, total time taken = 3.3 msec
When data is sent in 5 packets, total time taken = 2.1 msec
When data is sent in 10 packets, total time taken = 2.4 msec
When data is sent in 20 packets, total time taken = 3.3 msec
Conclusion-
We conclude-
Total time decreases when packet size is reduced but only up to a certain limit.
If the packet size is reduced beyond a certain limit, then total time starts increasing.
From the given choices,
Sending the message in 5 packets would be most efficient.
In other words, packet size = 300 bytes would be the best choice.
Types of Packet Switching-
Packet switching may be carried out in the following 2 ways-
1. Virtual Circuit Switching
2. Datagram Switching
Virtual Circuit Switching-
Virtual circuit switching operates in the following three phases-
1. Establishing a circuit
2. Transferring the data
3. Disconnecting the circuit
1. Establishing A Circuit-
In this phase,
A logical connection is established between the two ends.
It provides a dedicated path for data to travel from one to the other end.
Resources are reserved at intermediate switches which are used during the
transmission.
2. Transferring The Data-
After the connection is established,
The entire data travels over the dedicated path from one end to the other end.
3. Disconnecting The Circuit-
After the data transfer is completed,
The connection is disconnected.
Datagram Switching-
In datagram switching,
There exists no dedicated path for data to travel.
The header of each packet contains the destination address.
When any intermediate switch receives the packet, it examines its destination
address.
It then consults the routing table.
Routing table finds the corresponding port through which the packet should be
forwarded.
Virtual Circuit Switching Vs Datagram Switching-
The following table shows a comparison between virtual circuit switching and
datagram switching-
Virtual Circuit Switching Datagram Switching
The first packet during its transmission-
1) Informs the intermediate switches that
The first packet does not perform
more packets are following.
any such task during its
2) Reserve resources (CPU, bandwidth and
transmission.
buffer) for the following packets at all the
switches on the way.
The packets are never discarded at The packets may be discarded at
intermediate switches and immediately intermediate switches if sufficient
forwarded since resources are reserved for resources are not available to
them. process the packets.
It is a connection oriented service since It is a connection less service since
resources are reserved for the packets at no resources are reserved for the
intermediate switches. packets.
All the packets follow the same dedicated All the packets take path
path. independently.
Data may appear out of order at the
Data appears in order at the destination since
destination since the packets take
all the packets take the same dedicated path.
path independently.
It is highly reliable since no packets are It is not reliable since packets may
discarded. be discarded.
It is costly. It is cost effective.
Only first packet requires a global header
which identifies the path from one end to
All the packets require a global
other end.
header which contains full
All the following packets require a local
information about the destination.
header which identifies the path from hop to
hop.
ATM (Asynchronous Transfer Mode) uses IP Networks use datagram
virtual circuit switching. switching.
Virtual circuit switching is normally Datagram switching is normally
implemented at data link layer. implemented at network layer.
PRACTICE PROBLEM BASED ON PACKET SWITCHING TECHNIQUE-
Problem-
In a packet switching network, packets are routed from source to destination along a
single path having two intermediate nodes. If the message size is 24 bytes and each
packet contains a header of 3 bytes, then the optimum packet size is-
1. 4 bytes
2. 6 bytes
3. 7 bytes
4. 9 bytes
Solution-
Let bandwidth of the network = X Bps and 1 / X = a
Option-A: Packet Size = 4 Bytes
In this case,
The entire message is divided into packets of size 4 bytes.
These packets are then sent one after the other.
Data Sent in One Packet-
Data size
= Packet size – Header size
= 4 bytes – 3 bytes
= 1 byte
Thus, only 1 byte of data can be sent in each packet.
Number Of Packets-
Number of packets required
= Total data to be sent / Data contained in one packet
= 24 bytes / 1 byte
= 24 packets
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 4 bytes / X Bps
= 4a sec
Time Taken By First Packet-
Time taken by the first packet to reach from sender to receiver
= 3 x Transmission delay
= 3 x 4a sec
= 12a sec
Time Taken By Remaining Packets-
Time taken by the remaining packets to reach from sender to receiver
= Number of remaining packets x Transmission delay
= 23 x 4a sec
= 92a sec
Total Time Taken-
Total time taken to send the complete message from sender to receiver
= 12a sec + 92a sec
= 104a sec
Option-B: Packet Size = 6 bytes
In this case,
The entire message is divided into packets of size 6 bytes.
These packets are then sent one after the other.
Data Sent in One Packet-
Data size
= Packet size – Header size
= 6 bytes – 3 bytes
= 3 bytes
Thus, only 3 bytes of data can be sent in each packet.
Number Of Packets-
Number of packets required
= Total data to be sent / Data contained in one packet
= 24 bytes / 3 bytes
= 8 packets
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 6 bytes / X Bps
= 6a sec
Time Taken By First Packet-
Time taken by the first packet to reach from sender to receiver
= 3 x Transmission delay
= 3 x 6a sec
= 18a sec
Time Taken By Remaining Packets-
Time taken by the remaining packets to reach from sender to receiver
= Number of remaining packets x Transmission delay
= 7 x 6a sec
= 42a sec
Total Time Taken-
Total time taken to send the complete message from sender to receiver
= 18a sec + 42a sec
= 60a sec
Option-C: Packet Size = 7 bytes
In this case,
The entire message is divided into packets of size 7 bytes.
These packets are then sent one after the other.
Data Sent in One Packet-
Data size
= Packet size – Header size
= 7 bytes – 3 bytes
= 4 bytes
Thus, only 4 bytes of data can be sent in each packet.
Number Of Packets-
Number of packets required
= Total data to be sent / Data contained in one packet
= 24 bytes / 4 bytes
= 6 packets
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 7 bytes / X Bps
= 7a sec
Time Taken By First Packet-
Time taken by the first packet to reach from sender to receiver
= 3 x Transmission delay
= 3 x 7a sec
= 21a sec
Time Taken By Remaining Packets-
Time taken by the remaining packets to reach from sender to receiver
= Number of remaining packets x Transmission delay
= 5 x 7a sec
= 35a sec
Total Time Taken-
Total time taken to send the complete message from sender to receiver
= 21a sec + 35a sec
= 56a sec
Option-D: Packet size = 9 Bytes
In this case,
The entire message is divided into packets of size 9 bytes.
These packets are then sent one after the other.
Data Sent in One Packet-
Data size
= Packet size – Header size
= 9 bytes – 3 bytes
= 6 bytes
Thus, only 6 bytes of data can be sent in each packet.
Number Of Packets-
Number of packets required
= Total data to be sent / Data contained in one packet
= 24 bytes / 6 bytes
= 4 packets
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 9 bytes / X Bps
= 9a sec
Time Taken By First Packet-
Time taken by the first packet to reach from sender to receiver
= 3 x Transmission delay
= 3 x 9a sec
= 27a sec
Time Taken By Remaining Packets-
Time taken by the remaining packets to reach from sender to receiver
= Number of remaining packets x Transmission delay
= 3 x 9a sec
= 27a sec
Total Time Taken-
Total time taken to send the complete message from sender to receiver
= 27a sec + 27a sec
= 54a sec
Observations-
From here,
Total time taken when packet size is 4 bytes = 104a sec
Total time taken when packet size is 6 bytes = 60a sec
Total time taken when packet size is 7 bytes = 56a sec
Total time taken when packet size is 9 bytes = 54a sec
Result-
Time taken is minimum when packet size is 9 bytes.
Thus, Option (D) is correct.
No reordering is No reordering is
Reordering is required
required required
All the packets take the All the packets take the All the packets may not
same path same path take the same path