The Wayback Machine - https://web.archive.org/web/20240905161325/https://www.geeksforgeeks.org/carrier-sense-multiple-access-csma/
Open In App

Carrier Sense Multiple Access (CSMA)

Last Updated : 25 Jun, 2023
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

This method was developed to decrease the chances of collisions when two or more stations start sending their signals over the data link layer. Carrier Sense multiple access requires that each station first check the state of the medium before sending. 

Prerequisite - Multiple Access Protocols

Vulnerable Time:

 Vulnerable time = Propagation time (Tp)

The persistence methods can be applied to help the station take action when the channel is busy/idle.  

1. 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. 

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: 

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%.

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

The basic idea behind CSMA/CA is that the station should be able to receive while transmitting to detect a collision from different stations. In wired networks, if a collision has occurred then the energy of the received signal almost doubles, and the station can sense the possibility of collision. In the case of wireless networks, most of the energy is used for transmission, and the energy of the received signal increases by only 5-10% if a collision occurs. It can’t be used by the station to sense collision. Therefore CSMA/CA has been specially designed for wireless networks. 

These are three types of strategies: 

  1. InterFrame Space (IFS): When a station finds the channel busy it senses the channel again, when the station finds a channel to be idle it waits for a period of time called IFS time. IFS can also be used to define the priority of a station or a frame. Higher the IFS lower is the priority.
  2. Contention Window: It is the amount of time divided into slots. A station that is ready to send frames chooses a random number of slots as wait time.
  3. Acknowledgments: The positive acknowledgments and time-out timer can help guarantee a successful transmission of the frame.

 Characteristics of CSMA/CA :

  1. Carrier Sense: The device listens to the channel before transmitting, to ensure that it is not currently in use by another device.
  2. Multiple Access: Multiple devices share the same channel and can transmit simultaneously.
  3. 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.
  4. Acknowledgment (ACK): After successful transmission, the receiving device sends an ACK to confirm receipt.
  5. Fairness: The protocol ensures that all devices have equal access to the channel and no single device monopolizes it.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.

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:  

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:

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

Disadvantages of CSMA:

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

Comparisonof various protocols:

Protocol Transmission behavior  Collision detection method  Efficiency  Use cases
Pure ALOHA  Sends frames immediately  No collision detection  Low Low-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


Previous Article
Next Article

Similar Reads

Efficiency of CSMA/CD
Prerequisite - Introduction to Ethernet, Basics of CSMA/ CD Carrier sense multiple access with collision detection (CSMA/CD) - The CSMA method does not tell us what to do in case there is a collision. Carrier sense multiple access with collision detection (CSMA/CD) adds to the CSMA algorithm to deal with the collision. In CSMA/CD, the size of a fra
3 min read
Java | CDMA (Code Division Multiple Access)
CDMA is a channelization protocol for Multiple Access, where information can be sent simultaneously through several transmitters over a single communication channel. It is achieved in below steps: A signal is generated which extends over a wide bandwidth. The code which performs this action is called spreading code. Later on, a specific signal can
6 min read
Random Access Iterators in C++
After going through the template definition of various STL algorithms like std::nth_element, std::sort, you must have found their template definition consisting of objects of type Random-access Iterator. So what are they and why are they used?Random-access iterators are one of the five main types of iterators present in C++ Standard Library, others
6 min read
Multiple-Processor Scheduling in Operating System
In multiple-processor scheduling multiple CPU's are available and hence Load Sharing becomes possible. However multiple processor scheduling is more complex as compared to single processor scheduling. In multiple processor scheduling there are cases when the processors are identical i.e. HOMOGENEOUS, in terms of their functionality, we can use any
7 min read
RSA Algorithm using Multiple Precision Arithmetic Library
Public Key Cryptography is also known as Asymmetric Cryptography is the type of cryptography which involves the usage of two keys namely Public Key and Private Key. The Public Key of the receiver is used to encrypt the plaintext by the sender while the Private Key of the receiver is used to decrypt the encrypted message and hence can be decrypted o
4 min read
Lex program to take input from file and remove multiple spaces, lines and tabs
FLEX (Fast Lexical Analyzer Generator) is a tool/computer program for generating lexical analyzers (scanners or lexers) written by Vern Paxson in C around 1987. Lex reads an input stream specifying the lexical analyzer and outputs source code implementing the lexer in the C programming language. The function yylex() is the main flex function which
2 min read
Round the given number to nearest multiple of 10 | Set-2
Given a large positive integer represented as a string str. The task is to round this number to the nearest multiple of 10. Examples: Input: str = "99999999999999993"Output: 99999999999999990 Input: str = "99999999999999996" Output: 100000000000000000 Approach: A solution to the same problem has been discussed in this article which will not work fo
10 min read
Basic Calculator Program Using Java
Create a simple calculator which can perform basic arithmetic operations like addition, subtraction, multiplication, or division depending upon the user input. Example: Enter the numbers: 2 2 Enter the operator (+,-,*,/) + The final result: 2.0 + 2.0 = 4.0ApproachTake two numbers using the Scanner class. The switch case branching is used to execute
2 min read
Features of C Programming Language
C is a procedural programming language. It was initially developed by Dennis Ritchie in the year 1972. It was mainly developed as a system programming language to write an operating system. The main features of C language include low-level access to memory, a simple set of keywords, and a clean style, these features make C language suitable for sys
3 min read
Java Arithmetic Operators with Examples
Operators constitute the basic building block to any programming language. Java too provides many types of operators which can be used according to the need to perform various calculations and functions, be it logical, arithmetic, relational, etc. They are classified based on the functionality they provide. Here are a few types: Arithmetic Operator
6 min read
For Loop in Java
Loops in Java come into use when we need to repeatedly execute a block of statements. Java for loop provides a concise way of writing the loop structure. The for statement consumes the initialization, condition, and increment/decrement in one line thereby providing a shorter, easy-to-debug structure of looping. Let us understand Java for loop with
7 min read
Data encryption standard (DES) | Set 1
This article talks about the Data Encryption Standard (DES), a historic encryption algorithm known for its 56-bit key length. We explore its operation, key transformation, and encryption process, shedding light on its role in data security and its vulnerabilities in today's context. What is DES?Data Encryption Standard (DES) is a block cipher with
15+ min read
Introduction to Internet of Things (IoT) - Set 1
IoT stands for Internet of Things. It refers to the interconnectedness of physical devices, such as appliances and vehicles, that are embedded with software, sensors, and connectivity which enables these objects to connect and exchange data. This technology allows for the collection and sharing of data from a vast network of devices, creating oppor
9 min read
Basics of Computer and its Operations
Introduction : A computer is an electronic device that can receive, store, process, and output data. It is a machine that can perform a variety of tasks and operations, ranging from simple calculations to complex simulations and artificial intelligence. Computers consist of hardware components such as the central processing unit (CPU), memory, stor
12 min read
Block Cipher modes of Operation
Encryption algorithms are divided into two categories based on the input type, as a block cipher and stream cipher. Block cipher is an encryption algorithm that takes a fixed size of input say b bits and produces a ciphertext of b bits again. If the input is larger than b bits it can be divided further. For different applications and uses, there ar
5 min read
Carrier Sense Multiple Access (CSMA)
This method was developed to decrease the chances of collisions when two or more stations start sending their signals over the data link layer. Carrier Sense multiple access requires that each station first check the state of the medium before sending. Prerequisite - Multiple Access Protocols Vulnerable Time: Vulnerable time = Propagation time (Tp)
6 min read
Generations of Computer
Introduction: A computer is an electronic device that manipulates information or data. It can store, retrieve, and process data. Nowadays, a computer can be used to type documents, send an email, play games, and browse the Web. It can also be used to edit or create spreadsheets, presentations, and even videos. But the evolution of this complex syst
5 min read
vector::push_back() and vector::pop_back() in C++ STL
Vectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container. vector::push_back() push_back() function is used to push elements into a vector from the back. The new value is inserted into the vector at the end, after the cur
4 min read
Carry Look-Ahead Adder
The adder produce carry propagation delay while performing other arithmetic operations like multiplication and divisions as it uses several additions or subtraction steps. This is a major problem for the adder and hence improving the speed of addition will improve the speed of all other arithmetic operations. Hence reducing the carry propagation de
5 min read
Phases of a Compiler
Prerequisite - Introduction of Compiler design We basically have two phases of compilers, namely the Analysis phase and Synthesis phase. The analysis phase creates an intermediate representation from the given source code. The synthesis phase creates an equivalent target program from the intermediate representation. A compiler is a software program
7 min read
Introduction of Compiler Design
The compiler is software that converts a program written in a high-level language (Source Language) to a low-level language (Object/Target/Machine Language/0, 1's). A translator or language processor is a program that translates an input program written in a programming language into an equivalent program in another language. The compiler is a type
9 min read
Introduction of Theory of Computation
Automata theory (also known as Theory Of Computation) is a theoretical branch of Computer Science and Mathematics, which mainly deals with the logic of computation with respect to simple machines, referred to as automata. Automata* enables scientists to understand how machines compute the functions and solve problems. The main motivation behind dev
3 min read
goto Statement in C
The C goto statement is a jump statement which is sometimes also referred to as an unconditional jump statement. The goto statement can be used to jump from anywhere to anywhere within a function. Syntax: Syntax1 | Syntax2 ---------------------------- goto label; | label: . | . . | . . | . label: | goto label; In the above syntax, the first line te
3 min read
Python Virtual Environment | Introduction
A Python Virtual Environment is an isolated space where you can work on your Python projects, separately from your system-installed Python. You can set up your own libraries and dependencies without affecting the system Python. We will use virtualenv to create a virtual environment in Python. What is a Virtual Environment?A virtual environment is a
4 min read
Difference Between Structure and Union in C
Structures in C is a user-defined data type available in C that allows to combining of data items of different kinds. Structures are used to represent a record. Defining a structure: To define a structure, you must use the struct statement. The struct statement defines a new data type, with more than or equal to one member. The format of the struct
4 min read
Dynamic Method Dispatch or Runtime Polymorphism in Java
Prerequisite: Overriding in java, Inheritance Method overriding is one of the ways in which Java supports Runtime Polymorphism. Dynamic method dispatch is the mechanism by which a call to an overridden method is resolved at run time, rather than compile time. When an overridden method is called through a superclass reference, Java determines which
5 min read
SQL Functions (Aggregate and Scalar Functions)
SQL Functions are built-in programs that are used to perform different operations on the database. There are two types of functions in SQL: Aggregate FunctionsScalar FunctionsSQL Aggregate FunctionsSQL Aggregate Functions operate on a data group and return a singular output. They are mostly used with the GROUP BY clause to summarize data.  Some com
4 min read
Rail Fence Cipher - Encryption and Decryption
Given a plain-text message and a numeric key, cipher/de-cipher the given text using Rail Fence algorithm. The rail fence cipher (also called a zigzag cipher) is a form of transposition cipher. It derives its name from the way in which it is encoded. Examples:  EncryptionInput : "GeeksforGeeks "Key = 3Output : GsGsekfrek eoeDecryptionInput : GsGsekf
15 min read
Command Line Arguments in Java
Java command-line argument is an argument i.e. passed at the time of running the Java program. In Java, the command line arguments passed from the console can be received in the Java program and they can be used as input. The users can pass the arguments during the execution bypassing the command-line arguments inside the main() method. Working com
3 min read
Data Abstraction and Data Independence
Database systems comprise complex data structures. In order to make the system efficient in terms of retrieval of data, and reduce complexity in terms of usability of users, developers use abstraction i.e. hide irrelevant details from the users. This approach simplifies database design.  Level of Abstraction in a DBMSThere are mainly 3 levels of da
4 min read
Article Tags :
Practice Tags :