Open In App

Carrier Sense Multiple Access (CSMA)

Last Updated : 01 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Carrier Sense Multiple Access (CSMA) is a method used in computer networks to help devices share a communication channel without interfering with each other. Before a device sends data, it listens to the channel (or senses the carrier) to check if it’s free. If the channel is busy, the device waits until it becomes idle. This helps prevent data collisions, which can happen when two devices try to send data at the same time.

CSMA is widely used in networking technologies like Ethernet and Wi-Fi. It works at the data link layer and was designed to reduce the chances of network traffic collisions, making communication smoother and more efficient. By checking the medium before transmitting, devices using CSMA improve overall network performance.

Types of CSMA Protocol

There are two main types of Carrier Sense Multiple Access (CSMA) protocols, each designed to handle how devices manage potential data collisions on a shared communication channel. These types differ based on how they respond to the detection of a busy network:

  1. CSMA/CD
  2. CSMA/CA

Vulnerable Time in CSMA : Vulnerable time is the short window in which there's a risk of collision between two devices trying to send data on the network at the same time. In CSMA-based networks like Ethernet or Wi-Fi, each device listens to the channel before transmitting. If the channel seems free, the device waits a tiny moment and then begins sending.

However, another device might also sense the channel as free at the same time, and they both may start transmitting causing a collision. This small time window, where such collisions can still happen even after sensing, is called the vulnerable time.

CSMA
Propagation Time

Vulnerable Time = Propagation Time (Tp)
This is the time it takes for a signal to travel from one device to another.

Carrier Sense Multiple Access with Collision Detection (CSMA/CD)

In this method, a station monitors the medium after it sends a frame to see if the transmission was successful. If successful, the transmission is finished, if not, the frame is sent again. 

CSMACD
Collision

In the diagram, starts sending the first bit of its frame at t1 and since C sees the channel idle at t2, starts sending its frame at t2. C detects A's frame at t3 and aborts transmission. A detects C's frame at t4 and aborts its transmission. Transmission time for C's frame is, therefore, t3-t2 and for A's frame is t4-t1. So, the frame transmission time (Tfr) should be at least twice the maximum propagation time (Tp). This can be deduced when the two stations involved in a collision are a maximum distance apart. 

Process: The entire process of collision detection can be explained as follows: 

  1. Start and Initialize: Set the number of attempts (K) to 0.
  2. Check Channel: Use a persistence method (1-persistent, p-persistent, or non-persistent) to sense the medium.
  3. If channel is free, the device tries to transmit data.
  4. If a collision occurs, it: Sends a jamming signal to inform others. Increases the attempt count (K = K + 1). Chooses a random backoff time based on K (Tb = R * Tp), where R is a random number.
  5. If K exceeds the max attempts (Kmax), the transmission is aborted.
  6. If there's no collision, the transmission is successful.

Throughput and Efficiency: The throughput of CSMA/CD is much greater than pure or slotted ALOHA.  

  • For the 1-persistent method, throughput is 50% when G=1.
  • For the non-persistent method, throughput can go up to 90%.

Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA)

CSMA/CA is a technique used mainly in wireless networks to avoid collisions when multiple devices try to send data. Unlike wired networks where a device can detect collisions easily, in wireless networks, most of the energy goes into transmitting, so a device cannot sense if a collision has happened during transmission. To solve this, CSMA/CA prevents collisions instead of detecting them, making it ideal for technologies like Wi-Fi.

Strategies Used in CSMA/CA :

  1. Inter Frame Space (IFS): After the channel becomes idle, the station waits for a short fixed time to avoid sudden collisions shorter IFS means higher priority.
  2. Contention Window: The station picks a random slot within a time window to wait before transmitting, helping spread out transmissions and reduce collision chances.
  3. Acknowledgments (ACKs): The receiver sends back an ACK if data is received correctly; if not received in time, the sender assumes failure and tries again.

Overall, CSMA/CA balances the need for efficient use of the shared channel with the need to avoid collisions, leading to reliable and fair communication in a wireless network.

Process: The entire process of collision avoidance can be explained as follows:  

  1. Initialize Attempt Counter: Set the number of transmission attempts, K = 0.
  2. Check if Channel is Idle: Listen to the channel; if it’s busy, keep checking until it’s idle.
  3. Wait Interframe Space (IFS) Time: After the channel is idle, wait for the IFS period to ensure fairness.
  4. Check Idle Again After IFS: If the channel is still idle after IFS, proceed; otherwise, restart from Step 2.
  5. Generate Random Backoff: Choose a random number R between 0 and 2K - 1 for backoff slots.
  6. Wait for R Time Slots: Defer transmission by waiting for R time slots to avoid collisions.
  7. Transmit Frame: After the backoff, send the data frame.
  8. Wait for Acknowledgment (ACK): Wait to see if an ACK is received from the receiver.
  9. ACK Received: If Yes then Transmission was successful; end process , or if No then Go to Step 10.
  10. Check Retry Limit:
    If K > Kmax, abort transmission (too many attempts).
    If K ≤ Kmax, increment K by 1 and go back to Step 2.

Key features of CSMA/CA

  • Carrier Sense: The device listens to the channel before transmitting, to ensure that it is not currently in use by another device.
  • Multiple Access: Multiple devices share the same channel and can transmit simultaneously.
  • Collision Avoidance: If two or more devices attempt to transmit at the same time, a collision occurs. CSMA/CA uses random backoff time intervals to avoid collisions.
  • Acknowledgment (ACK): After successful transmission, the receiving device sends an ACK to confirm receipt.
  • Fairness: The protocol ensures that all devices have equal access to the channel and no single device monopolizes it.
  • Binary Exponential Backoff: If a collision occurs, the device waits for a random period of time before attempting to retransmit. The backoff time increases exponentially with each retransmission attempt.
  • Interframe Spacing: The protocol requires a minimum amount of time between transmissions to allow the channel to be clear and reduce the likelihood of collisions.
  • RTS/CTS Handshake: In some implementations, a Request-To-Send (RTS) and Clear-To-Send (CTS) handshake is used to reserve the channel before transmission. This reduces the chance of collisions and increases efficiency.
  • Wireless Network Quality: The performance of CSMA/CA is greatly influenced by the quality of the wireless network, such as the strength of the signal, interference, and network congestion.
  • Adaptive Behavior: CSMA/CA can dynamically adjust its behavior in response to changes in network conditions, ensuring the efficient use of the channel and avoiding congestion.

Types of CSMA Access Modes

There are 4 types of access modes available in CSMA. It is also referred as 4 different types of CSMA protocols which decide the time to start sending data across shared media.

  1. 1-Persistent: It senses the shared channel first and delivers the data right away if the channel is idle. If not, it must wait and continuously track for the channel to become idle and then broadcast the frame without condition as soon as it does. It is an aggressive transmission algorithm.
  2. Non-Persistent:  It first assesses the channel before transmitting data; if the channel is idle, the node transmits data right away. If not, the station must wait for an arbitrary amount of time (not continuously), and when it discovers the channel is empty, it sends the frames.
  3. P-Persistent: It consists of the 1-Persistent and Non-Persistent modes combined. Each node observes the channel in the 1Persistent mode, and if the channel is idle, it sends a frame with a P probability. If the data is not transferred, the frame restarts with the following time slot after waiting for a (q = 1-p probability) random period.
  4. O-Persistent: A supervisory node gives each node a transmission order. Nodes wait for their time slot according to their allocated transmission sequence when the transmission medium is idle. 

Advantages of CSMA

  • Increased Efficiency: CSMA ensures that only one device communicates on the network at a time, reducing collisions and improving network efficiency.
  • Simplicity: It is a simple protocol that is easy to implement and does not require complex hardware or software.
  • Flexibility: It is a flexible protocol that can be used in a wide range of network environments, including wired and wireless networks.
  • Low cost: It does not require expensive hardware or software, making it a cost-effective solution for network communication.

Disadvantages of CSMA

  • Limited Scalability: CSMA is not a scalable protocol and can become inefficient as the number of devices on the network increases.
  • Delay: In busy networks, the requirement to sense the medium and wait for an available channel can result in delays and increased latency.
  • Limited Reliability: It can be affected by interference, noise, and other factors, resulting in unreliable communication.
  • Vulnerability to Attacks: It can be vulnerable to certain types of attacks, such as jamming and denial-of-service attacks, which can disrupt network communication.

Comparison of Various Protocols

ProtocolTransmission behavior Collision detection method Efficiency Use cases
Pure ALOHA Sends frames immediately No collision detection LowLow-traffic networks
 
Slotted ALOHA Sends frames at specific time slots No collision detection Better than pure ALOHA Low-traffic networks
 
CSMA/CD Monitors medium after sending a frame, retransmits if necessary Collision detection by monitoring transmissions High Wired networks with moderate to high traffic
CSMA/CA Monitors medium while transmitting, adjusts behavior to avoid collisions Collision avoidance through random backoff time intervals High Wireless networks with moderate to high traffic and high error rates

Next Article
Article Tags :

Similar Reads