In simple terms, both hubs and switches are used to connect devices, as shown below.
However, hubs work differently from switches in their operations (that is in how they send packets).
How does a hub work?
When a hub is connected as shown above to all computers, then data is broadcast to all the devices connected. For example, consider the diagram below.
Suppose that computer A needs to send data to computer C.
Then it first sends data to the hub, where all the devices are connected, and then the hub will send this data to all the devices. Simply, a hub does not filter the addresses and sends a packet it receives to all the devices connected to it as shown below.
Every computer checks the destination address of the packet and if the destination address of the packet match with that of the computer, the packet is accepted. Therefore, this is not an efficient approach of exchanging data. Furthermore, this nature of data sharing leads to sharing the bandwidth available among the connected devices and if there is a heavy exchange of data takes place between two computers compared to others, then other computers will be subjected to a low usage of the remaining bandwidth.
How does a switch work ?
A switch works initially in the same way as that of a hub but a switch learns where to send data after consecutive exchanges.
For example, consider the same exchange between computer A and computer C above.
Initially the switch also sends data packets to all the devices available as shown below.
Then the switch learns which computer accepted data packets and now learns that any packet whose destination is to a specific computer (in this case computer C), should be directed on that specific path. Therefore, next if computer B wants to send packets to C, then packets will be directed only to C.
This is an efficient method of data exchange as data is not sent to all the devices.
However, implementing switches is somewhat complex as compared to setting up a hub. Moreover, hubs operate in the physical layer of the OSI model (discussed in another blog post) while switches operate in the data link layer.
Therefore, hubs are easy to implement and economical but are less intelligent compared to switches.
Comments
Post a Comment