What is CSMA Protocol?

The CSMA’s full form is carrier sense multiple access. It is a MAC layer protocol in a computer network (as per OSI Model), for accessing an underlying shared communication channel. e.g  LAN. In another tutorial, we have described another common channel access protocol, named  Aloha. CAMA differs from ALOHA in the way it works.  There is sensing the channel before starting any transmission, while aloha does not.

Sensing a channel reduces the chances of a collision. So more improved functionality over aloha. Let’s first understand what the CSMA or carrier sense multiple access means? Having two things first carrier sense and another multiple access.

What is carrier sense?

The carrier sense means, a device on a computer network, first will listen or sense to the channel, before transmitting a frame or message. This is different from the aloha, where there was no listening to the channel before transmitting a frame.

What is multiple access? 

In CSMA multiple access means, there can be multiple devices transmitting on a commonly shared channel. It is the same as aloha.

Versions of CSMA protocol:

There were different versions were developed. In each version of CSMA, a station or device, listen to the channel before sending a frame. The difference is in sending patterns.  The following describes the versions of CSMA.

Persistent or 1-persistent CSMA:

This is the basic and simplest version. When the device wants to transmit a frame over a common channel, the device starts sensing the channel. If the channel is free, devices transmit the frame, else keep sensing the channel. The probability of sending the frame is one when the channel is free. That’s why it names as 1-Persistent CSMA.

It looks that the 1-persistent is perfect with no collision. But this is not the case, still, there are chances of a collision.  Here are a few scenarios of collision.

  • When more than one station/device listens for the common or shared channel. Once the channel will get free, both devices detect the channel is free at the same time and start sending frames simultaneously.  Simultaneous send leads to the collision.
  • Another scenario may lead to a collision, because of the propagation delay. A network always has a  propagation delay, maybe very less but still not zero. Propagation delay is the time a signal takes to traverse from one station to another over the network.  For example, if a station starts sending a frame, but the busy signal is still one the way toward other stations. If at this point a station listens to the channel, it will find it free and will send the frame. Now there are two frames on the channel and a collision will occur.

Non-persistent CSMA:

  • The device starts sensing/listening to the channel.
  • If the channel is free, the device transmits the frame.
  • If the channel is not free, the device waits for a random time and starts the procedure again.

The Non-Persistent version has lesser chances of collision as compared to the 1-Persistent CSMA. But have a drawback of more delay in transmissions.

P-Persistent CSMA:

The P here means the probability.  In P-persistent CSMA a probability(P) is assigned to the channel. Probability is always between 0 and 1. This version of the CSMA algorithm takes advantage of both the above versions. P-Persistent applies to the slotted channel. The following describes the procedure.

  • All stations listen to the channel and there is an idle time slot.
  • When a channel is free, each listening station generates a random number(its own probability) between 0 and 1.
  • If the generated station probability is lesser than the channel probability(P), the frame is transmitted else there is a wait for the next time slot.
  • If the next time slot is idle, the station again transmits or waits for the next time slot.
  • The above process is repeated until the frame is successfully transmitted or the channel is busy.
  • If the channel is busy, the sending station waits for the next idle time slot and starts the procedure again.

Conclusion :

Till now we have learned an overview of CSMA protocol and various versions of the protocol. If still as a reader you feel something is not clear, add a comment.