What is the CSMA protocol in the computer network?
CSMA CD vs. CSMA CA.
CSMA stands for Carrier Sense Multiple Access. It is a way of transmitting a frame through underlying common channels (such as LAN). The protocol operates at the OSI model’s data link layer. Channel access is implemented via the MAC sublayer within the data link.
With CSMA, a node starts listening (sensing) to the medium (e.g., LAN) before transmitting a frame. The details are in CSMA Protocol.
CSMA CD and CA are another two improved versions of the protocol. In this tutorial, we will discuss both.
What is the CSMA CD protocol?
- In CSMA CD, the CD stands for collision detection.
- The sender ensures that no other station is transmitting before sending a frame. It starts to listen to the shared channel for this purpose.
- Once the channel is free, the station starts transmitting frames.
- While transmitting, the sender station starts listening to the channel to detect if there is any collision while communicating.
- If it detects the collision, the station stops transmitting, waits for a random time, and updates the retransmission timer.
- If the counter reaches the threshold, the frame is discarded.
Because of detecting collision earlier (while transmitting), the protocol provides faster transmission of frames.
What is the CSMA CA protocol?
The CA stands for collision avoidance. This means the protocol tries to transmit packets so that there are minimum chances of a collision. The CSMA-CA is for wireless networks. In a wireless network, a terminal only can see the Access Point (Wireless router). If a terminal starts transmission, it is tough for other nodes on the network to detect the activity. This is called the Hidden Node Problem. So chances of catching a collision are significantly less. Collision avoidance is a better option for optimizing CSMA for wireless LAN.
The following are the steps for a transfer in wireless LAN.
- A station starts listening to the channel.
- If the channel is not free waits for a random time and starts again.
- Once the medium is free, send a Request To Send (RTS) message to the Access Point(AP) and await an answer.
- If Access Point can allow the transfer, it sends Clear to Send(CTS) with yes to the sender. At a single time, AP can say yes to only one station.
- If CTS is with no, the sender needs to wait and try again after a random time.
CSMA CA vs. CSMA CD :
We have seen that each version of CSMA has a different purpose. But still, we can compare both. Following is a list of CA vs CD for CSMA.
- CSMA CA is most suitable for wireless networks, and CSMA/CD for a wired network.
- The CSMA CD gets active after a collision, while CSMA/CA is before the collision.
- In CSMA CA, a transmitting station first takes permission from a central device (AP), while in CSMA/CD, the station starts sending data as the channel is free.
- CSMA/CA is less efficient than CSMA/CD.