Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction to CSMA 
2.
Access Modes 
2.1.
1-persistent
2.2.
Non-persistent
2.3.
P-persistent
2.4.
O-persistent
3.
Protocol Modifications
3.1.
Carrier-sense multiple access with collision detection
3.2.
Carrier-sense multiple access with collision avoidance
3.3.
Carrier-sense multiple access with Collision Resolution
3.4.
Virtual time CSMA
4.
Frequently Asked Questions
4.1.
On which Principle carrier sense multiple access(CSMA) is based?
4.2.
What do you mean by carrier sense?
4.3.
What is the slotted ALOHA protocol?
5.
Conclusion
Last Updated: Mar 27, 2024

Carrier Sense Multiple Access(CSMA)

Computer Networks

Introduction to CSMA 

Carrier-sense multiple access (CSMA) is a type of media access control (MAC) protocol in which a node confirms that there is no other traffic on a shared transmission channel, such as an electrical bus or a band of the electromagnetic spectrum, before sending.

Before commencing a transmission under CSMA, a transmitter uses a carrier-sense method to determine if another transmission is in progress. Before attempting to transmit, it tries to detect the presence of a carrier signal from another node. If a carrier is detected, the node waits for the current transmission to finish before commencing its own. Multiple nodes can send and receive data on the same media using CSMA. All other nodes linked to the medium receive transmissions from a single node.

Collision-detection (CSMA/CD),Collision-avoidance (CSMA/CA), and collision-resolution techniques are all variations on basic CSMA.

Access Modes 

Different CSMA variants use different algorithms to determine when transmission onto the shared medium should begin. A significant distinguishing trait is aggressiveness or persistence with which these algorithms initiate communication. A more aggressive algorithm can start transmitting faster and use a higher percentage of the medium's available bandwidth. This usually comes at the cost of a higher risk of colliding with other transmitters.

1-persistent

1-persistent CSMA is a transmission algorithm that is very aggressive. The transmitting node detects whether the transmission medium is idle or busy when ready to send. It transmits immediately if it is inactive. If the transmission medium is busy, it continuously senses it until it becomes idle, at which point it sends the message (a frame) unconditionally (i.e., with probability=1). In a collision, the sender waits a random amount of time before repeating the procedure. In CSMA/CD systems, such as Ethernet, 1-persistent CSMA is employed.

Non-persistent

A non-aggressive transmission algorithm is a non-persistent CSMA. The transmitting node detects whether the transmission medium is idle or busy when it is ready to transmit data. It sends immediately if it is idle. If the channel is busy, it immediately skips to the final random waiting step of 1-persistent CSMA before repeating the entire logic cycle: it does not continue to check the busy channel in the hopes of getting its signal through, hence the name. Compared to 1–persistent, this strategy reduces the likelihood of collision and results in higher overall medium-throughput, but at the cost of longer initial latency.

P-persistent

The transmitting node detects whether the transmission medium is idle or busy when it is ready to transmit data. It transmits immediately if it is idle. If it is busy, it continuously senses the transmission medium until it becomes idle, at which point it transmits with probability p. If the node does not broadcast (which has a 1-p chance), it waits for the next available time slot. If the transmission medium is not congested, it transmits with the same probability p. This probabilistic hold-off continues until the frame is eventually transferred or the medium becomes busy once more (i.e., some other node has already started transmitting). In the latter situation, the node repeats the entire logic cycle (which began with sensing the transmission medium to determine if it is idle or busy). In CSMA/CA systems, such as Wi-Fi and other packet radio systems, p-persistent CSMA is employed. It's important to note that p = 0-persistent CSMA is not the same as non-persistent CSMA. Both can only transmit when the channel is idle at the start of the procedure, but their behavior on a busy channel differs: non-persistent CSMA doesn't try to detect the channel and repeats its logical cycle, whereas p = 0 is forced to wait in an infinite loop (since it has zero probability of transmission even the channel goes back to being idle).

O-persistent

A supervisory node assigns a transmission order to each node. Nodes wait for their time slot in line with their allocated transmission sequence when the transmission channel is idle. The node that is assigned to broadcast first does so right away. The node in charge of transmitting the second must wait for a one-time slot (but by that time, the first node has already started transmitting). Nodes keep an eye on the medium for transmissions from other nodes and change their allocated order as soon as one is discovered (i.e., they move one position closer to the front of the queue).CobraNet, LonWorks, and the controller area network all use O-persistent CSMA.

Protocol Modifications

The original 1-persistence and p-persistence techniques frequently produce the broadcast storm problem when broadcasting over automobile ad hoc networks. Engineers devised three modified ways to boost performance: weighted p-persistence, slotted 1-persistence, and slotted p-persistence.

Carrier-sense multiple access with collision detection

CSMA/CD is a protocol that improves CSMA performance by terminating transmission as soon as a collision is detected, reducing the time necessary for a retry. Ethernet uses the CSMA/CD protocol.

Carrier-sense multiple access with collision avoidance

Collision avoidance is utilized in CSMA/CA to increase CSMA performance. Transmission is deferred for a random interval if the transmission medium is sensed busy before transmission. This random interval minimizes the chance that two or more nodes waiting to transmit may start transmitting at the same time when the detected transmission ends, minimizing the chance of a collision. Wi-Fi uses the CSMA/CA protocol.

Carrier-sense multiple access with Collision Resolution

To avoid collisions, CSMA/CR employs priority in the frame header. The Controller Area Network makes use of it.

Virtual time CSMA

VTCSMA is a protocol used in harsh real-time systems to avoid collisions caused by nodes transmitting signals at the same time. It prioritizes messages based on their due dates using two clocks.

Frequently Asked Questions

On which Principle carrier sense multiple access(CSMA) is based?

The "Listen Before Talk" (LBT) is the principle of CSMA/CA. This indicates that before the station can start transmitting, the line must be verified to determine if it is free ("idle").

What do you mean by carrier sense?

A continuing activity of a data station in a local area network to detect whether another station is broadcasting.

What is the slotted ALOHA protocol?

ALOHA is a medium access control (MAC) protocol for data transfer across a shared network channel developed by the Computer Network. Several data streams originating from several nodes are exchanged across a multi-point transmission channel using this protocol.

Conclusion

In this article, we learned about an introduction to CSMA, what are the access modes of CSMA, and are protocol modifications in it.

I hope you understand the carrier sense multiple access(CSMA). 

Recommended Readings:


Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, etc. on Coding Ninjas Studio.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.

Until then, Keep Learning and Keep Coding.

Live masterclass