The Wayback Machine - https://web.archive.org/web/20241005205349/https://www.geeksforgeeks.org/back-off-algorithm-csmacd/
Open In App

Back-off Algorithm for CSMA/CD

Last Updated : 01 Oct, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Prerequisite – Basics of CSMA/ CD, Collision Detection in CSMA/CD 

Back-off algorithm is a collision resolution mechanism which is used in random access MAC protocols (CSMA/CD). This algorithm is generally used in Ethernet to schedule re-transmissions after collisions. If a collision takes place between 2 stations, they may restart transmission as soon as they can after the collision. This will always lead to another collision and form an infinite loop of collisions leading to a deadlock. To prevent such scenario back-off algorithm is used. Let us consider a scenario of 2 stations A and B transmitting some data: 

 After a collision, time is divided into discrete slots (Tslot) whose length is equal to 2t, where t is the maximum propagation delay in the network. The stations involved in the collision randomly pick an integer from the set K i.e {0, 1}. This set is called the contention window. If the sources collide again because they picked the same integer, the contention window size is doubled and it becomes {0, 1, 2, 3}. Now the sources involved in the second collision randomly pick an integer from the set {0, 1, 2, 3} and wait for that number of time slots before trying again. Before they try to transmit, they listen to the channel and transmit only if the channel is idle. This causes the source which picked the smallest integer in the contention window to succeed in transmitting its frame. So, the Back-off algorithm defines a waiting time for the stations involved in collision, i.e. for how much time the station should wait to re-transmit.

Waiting time = back–off time
Let n = collision number or re-transmission serial number.
Then,
Waiting time = K * Tslot
where K = [0, 2n – 1 ]

Example -Case-1 : Suppose 2 stations A and B start transmitting data (Packet 1) at the same time then, collision occurs. So, the collision number n for both their data (Packet 1) = 1. Now, both the station randomly pick an integer from the set K i.e. {0, 1}.

  • When both A and B choose K = 0 –> Waiting time for A = 0 * T slot = 0 Waiting time for B = 0 * T slot = 0 Therefore, both stations will transmit at the same time and hence collision occurs.
  • When A chooses K = 0 and B chooses K = 1 –> Waiting time for A = 0 * T slot = 0 Waiting time for B = 1 * T slot = T slot Therefore, A transmits the packet and B waits for time T slot for transmitting and hence A wins.
  • When A chooses K = 1 and B chooses K = 0 –> Waiting time for A = 1 * T slot = T slot Waiting time for B = 0 * T slot = 0 Therefore, B transmits the packet and A waits for time T slot for transmitting and hence B wins.
  • When both A and B choose K = 1 –> Waiting time for A = 1 * T slot = T slot Waiting time for B = 1 * T slot = T slot Therefore, both will wait for the same time T slot and then transmit. Hence, a collision occurs.
Probability that A wins = 1/4
Probability that B wins = 1/4
Probability of collision = 2/4

The back-off algorithm in CSMA/CD is used to manage collisions in Ethernet networks. If you’re preparing for GATE and want to thoroughly understand how collision detection and resolution work in computer networks, the GATE CS Self-Paced Course provides an in-depth look at CSMA/CD, along with other essential networking protocols.

Case-2: Assume that A wins in Case 1 and transmitted its data(Packet 1). Now, as soon as B transmits its packet 1, A transmits its packet 2. Hence, collision occurs. Now collision no. n becomes 1 for packet 2 of A and becomes 2 for packet 1 of B. For packet 2 of A, K = {0, 1} For packet 1 of B, K = {0, 1, 2, 3} 

Probability that A wins = 5/8
Probability that B wins = 1/8
Probability of collision = 2/8

So, the probability of collision decreases as compared to Case 1. 

Here are some of its key features:

When a collision occurs, the transmitting device waits for a random amount of time before retransmitting the packet. The random delay helps to prevent multiple devices from retransmitting their packets simultaneously and causing another collision.

The random delay time is determined using an exponential back-off algorithm. The delay time starts at a minimum value and doubles after each collision, up to a maximum value. The maximum delay time is usually set to 1024 slot times, where a slot time is the time it takes for a signal to travel from one end of the network segment to the other.

The back-off algorithm is implemented in hardware on the network interface card (NIC) of each device. When a collision is detected, the NIC generates a random number between 0 and 2^n-1, where n is the number of collisions that have occurred. The NIC then multiplies the random number by the slot time to determine the delay time before retransmitting.

If the maximum number of retransmissions is reached without successful transmission, the device gives up and reports a transmission error.

Advantage –

  • Collision probability decreases exponentially.
  • Improves network performance: Back-off algorithm reduces the number of collisions and retransmissions, thus improving the overall network performance.
  • Increases channel utilization : By reducing the number of collisions, back-off algorithm increases the channel utilization, leading to better use of network resources.
  • Reduces delays: By reducing the number of collisions, back-off algorithm reduces the waiting time between transmission attempts, resulting in lower delays.
  • Fairness: The back-off algorithm ensures that all nodes in the network have an equal chance to access the channel, which promotes fairness in the distribution of network resources.
  • Adaptability: The back-off algorithm is adaptable to changing network conditions. When the network is busy, it increases the waiting time before retransmission attempts, and when the network is idle, it reduces the waiting time, thus ensuring efficient use of network resources.
  • Scalability: The back-off algorithm is scalable, as it can be used in networks of any size, from small local networks to large wide-area networks.
  • Energy Efficiency: By reducing the number of collisions and retransmissions, the back-off algorithm reduces the energy consumption of network nodes, which is particularly important in battery-powered devices such as mobile phones and IoT devices.
  • Robustness: The back-off algorithm is robust, as it can handle a high number of nodes trying to access the channel simultaneously without causing the network to crash or degrade in performance.

Disadvantages –

  • Capture effect: Station who wins ones keeps on winning.
  • Works only for 2 stations or hosts.
  • Increased overhead : Back-off algorithm adds additional overhead to the network due to the need to wait for a random time before retransmitting a packet.
  • Complexity : Back-off algorithm is a complex algorithm that requires a high level of implementation complexity.
  • Vulnerability to attacks : Back-off algorithm is vulnerable to certain attacks, such as denial-of-service (DoS) attacks, where an attacker can manipulate the random time intervals to cause the network to stop functioning.
  • Limited Performance: While the back-off algorithm can improve network performance in low- to medium-load scenarios, it may not be effective in high-load scenarios where the number of nodes trying to access the network is very high.
  • Inefficient in Time-Sensitive Applications: The back-off algorithm may not be suitable for time-sensitive applications, such as real-time video streaming or voice over IP (VoIP), where even a slight delay can cause significant problems.
  • Limited Scalability: While the back-off algorithm can be used in networks of any size, it may become less effective in larger networks where the number of nodes trying to access the channel simultaneously is very high.
  • Sensitivity to Distance and Interference: The back-off algorithm is sensitive to distance and interference, as nodes that are physically closer to each other may have a higher probability of colliding and may require longer random waiting times.
  • Limited Support for Quality of Service: The back-off algorithm does not provide support for quality of service (QoS), which is an important feature for many networking applications, such as video streaming, voice over IP (VoIP), and online gaming.

GATE Practice Question –

  1. GATE-CS-2004 | Question 90
  2. GATE-CS-2016 (Set 2) | Question 34
  3. GATE-IT-2004 | Question 85


Previous Article
Next Article

Similar Reads

Implementation of a Back-off Algorithm for CSMA/CD
Prerequisite - Back-off Algorithm for CSMA/CD Ethernet network may be used to provide shared access by a group of attached nodes to the physical medium which connects the nodes. These nodes are said to form a Collision Domain. When there is data waiting to be sent, each transmitting NIC also monitors its own transmission. If it observes a collision
5 min read
Write Through and Write Back in Cache
Prerequisite - Multilevel Cache Organisation Cache is a technique of storing a copy of data temporarily in rapidly accessible storage memory. Cache stores most recently used words in small memory to increase the speed at which data is accessed. It acts as a buffer between RAM and CPU and thus increases the speed at which data is available to the pr
3 min read
Differentiate between Write Through and Write Back Methods
Prerequisite - Write Through and Write Back in Cache During a read operation, when the CPU determines a word in the cache, the main memory is not included in the transfer. Thus, there are two ways that the system can proceed when the operation is a write. 1. Write Through Method : The simplest method is to update the main memory with every memory w
2 min read
Difference Between Go-Back-N and Selective Repeat Protocol
Both the Go-Back-N Protocol and Selective Repeat Protocol are the types of sliding window protocols. The main difference between these two protocols is that after finding the suspect or damage in sent frames go-back-n protocol re-transmits all the frames whereas the selective repeat protocol re-transmits only the frame which is damaged. What is the
4 min read
Sliding Window Protocol - Go Back N (GBN)
The Sliding Window Protocol is a method used in computer networks to manage the flow of data between two devices, ensuring that data is sent and received in the correct order. There are two types of sliding window protocol Go-Back-N (GBN), and Selective Repeat (SR). In Go-Back-N, the sender can send multiple data packets without waiting for an ackn
7 min read
Microsoft Interview Experience | Set 172 (Off-Campus for SDE 1)
An employee( alumnus of our college ) had taken CVs of interested students from CSE and IT department. A few students were shortlisted for the online round. Round 1 ( CoCube Online Round ) Question 1: Basic question on Strings. Cake walk completely. Question 2: Easy question on Linked List. Adding two numbers. Read https://www.geeksforgeeks.org/sum
5 min read
Amazon Interview Experience March 2019 (Off-Campus -Cloud Associate 1)
Received a Mail from off-campus recruiter, to take a online test for the role of cloud support associate 1. Had Registered and applied in Amazon website . Round 1: Online Test : duration 1.5 hours . Contained 4 sections . General Aptitude, Technical round 1( concepts of OS, Computer Networks, DBMS, all of them in depth ), Technical round 2((Concept
3 min read
What is a Scroll Lock Key? Uses and How to Turn it Off?
Scroll Lock key is used to control the scrolling of text on the screen in some software applications. Despite being less relevant today, some programs, especially spreadsheet software like Microsoft Excel, still use it. In Excel, turning on Scroll Lock allows you to scroll through the spreadsheet with the arrow keys without changing which cell is s
5 min read
Banker's Algorithm in Operating System
Prerequisite - Resource Allocation Graph (RAG), Banker’s Algorithm, Program for Banker’s Algorithm Banker's Algorithm is a resource allocation and deadlock avoidance algorithm. This algorithm test for safety simulating the allocation for predetermined maximum possible amounts of all resources, then makes an “s-state” check to test for possible acti
15 min read
Probabilistic shortest path routing algorithm for optical networks
Data transfer operations is a crucial aspect in case of networking and routing. So efficient data transfer operations is a must need, with minimum hardware cost (Optical Cables, WDM Network components, Decoders, Multiplexers) and also in the minimum time possible. Thus, the need is to propose an algorithm that finds the shortest path between two no
5 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
Algorithm for Dynamic Time out timer Calculation
Prerequisite – Computer Network | TCP Timers Calculating Time out timer (TOT) at transport layer is tricky as propagation delay is not constant i.e. path may change continuously and traffic is dynamic. So, static TOT cannot be used at TCP. And unnecessarily retransmitting the same data packet multiple times may cause congestion. Solution for this i
3 min read
Cristian's Algorithm
Cristian's Algorithm is a clock synchronization algorithm is used to synchronize time with a time server by client processes. This algorithm works well with low-latency networks where Round Trip Time is short as compared to accuracy while redundancy-prone distributed systems/applications do not go hand in hand with this algorithm. Here Round Trip T
8 min read
Berkeley's Algorithm
Berkeley's Algorithm is a clock synchronization technique used in distributed systems. The algorithm assumes that each machine node in the network either doesn't have an accurate time source or doesn't possess a UTC server.Algorithm 1) An individual node is chosen as the master node from a pool node in the network. This node is the main node in the
6 min read
Iterative algorithm for a forward data-flow problem
Overview :The purpose of this article is to tell you about an iterative algorithm for forward data-flow problem. Before starting, you should know some terminology related to data flow analysis. Terminologies for Iterative algorithm :Here, we will discuss terminologies for iterative algorithm as follows. Data flow analysis - It is defined as a techn
3 min read
LOOK Disk Scheduling Algorithm
The LOOK Disk Scheduling Algorithm is the advanced version of the SCAN (elevator) disk scheduling algorithm which gives slightly better seek time than any other algorithm in the hierarchy (FCFS->SRTF->SCAN->C-SCAN->LOOK). It is used to reduce the amount of time it takes to access data on a hard disk drive by minimizing the seek time bet
13 min read
Welsh Powell Graph colouring Algorithm
In graph theory, vertex colouring is a way of labelling each individual vertex such that no two adjacent vertex have same colour. But we need to find out the number of colours we need to satisfy the given condition. It is not desirable to have a large variety of colours or labels. So, We have an algorithm called welsh Powell algorithm that gives th
3 min read
Algorithm for non recursive Predictive Parsing
Prerequisite - Classification of Top Down Parsers Predictive parsing is a special form of recursive descent parsing, where no backtracking is required, so this can predict which products to use to replace the input string. Non-recursive predictive parsing or table-driven is also known as LL(1) parser. This parser follows the leftmost derivation (LM
4 min read
Algorithm for CSMA and Rules for CSMA/CD
Rules for CSMA/CD: If medium is idle, transmit, otherwise go to 2If the medium is busy, continue to listen until the channel is idle, then transmit immediatelyIf collision is detected during transmission then transmit a brief jamming signal to assure that all station knows that there has been a collision so that stations can cease the transmissionA
2 min read
Difference between First Come First Served (FCFS) and Round Robin (RR) Scheduling Algorithm
First Come First Served Scheduling Algorithm: First Come First Served (FCFS) is the simplest and non-preemptive scheduling algorithm. In First Come First Served (FCFS), the process is allocated to the CPU in the order of their arrival. A queue data structure is used to implement the FCFS scheduling algorithm. The process which is at the head of the
2 min read
Difference between FCFS and SSTF Disk Scheduling Algorithm
Prerequisite - Disk Scheduling Algorithms 1. FCFS Disk Scheduling Algorithm : First come first serve, as name suggest this algorithm entertains the task in the order they arrived in the disk queue. It is the simplest and easy to understand disk scheduling algorithm. In this the head or pointer moves in the direction in which the task arrives and mo
3 min read
Difference between SSTF and LOOK disk scheduling algorithm
1. SSTF disk scheduling algorithm : SSTF stands for Shortest Seek Time First. As the name specify, this algorithm serves the task request which is closest to current position of head or pointer. Here, the direction of head plays an vital role in determining total head movement. If there occurs a tie between requests then the head will serve the req
3 min read
Relation in FCFS and Round Robin Scheduling Algorithm
In this article, we'll see how FCFS is special kind of Round Robin Algorithm and Round Robin is special kind of FCFS Algorithm. Also, we will cover the relation with each other. Let's discuss one by one. First Come First Serve (FCFS) Scheduling Algorithm : FCFS is simplest of CPU Scheduling Algorithm which executes process that comes first. It is n
3 min read
Ethernet Transmitter Algorithm
Prerequisite - Ethernet and Ethernet Frame Format Ethernet Adapter or Network Interface Card (NIC) is hardware device/component, that enables you to send and receive data, to and from your computer. It will be connected to the network via wired or wireless connection. Let us assume we have host computer, which has Ethernet Adapter. The Ethernet cab
6 min read
Difference between FCFS and C-SCAN disk scheduling algorithm
1. FCFS Disk Scheduling Algorithm : FCFS stands for First come first serve, this algorithm entertains the task in the order they arrived in the disk queue. It is the simplest and easy to understand disk scheduling algorithm. In this the head or pointer moves in the direction in which the task arrives and moves till all request is served. However, F
3 min read
Relation in FCFS and Preemptive Priority Scheduling Algorithm
In this article, we will see how FCFS is a special kind of Priority Preemptive Scheduling Algorithm. Also, we will cover the relation with each other. Let us discuss one by one. 1. First Come First Serve (FCFS) Scheduling Algorithm : FCFS is the simplest of CPU Scheduling Algorithm which executes the process that comes first. It is a non-preemptive
4 min read
Attribute Closure Algorithm and its Utilization
Closure of a set F of FDs is the set F+ of all FDs that can be inferred from F. It is also known as complete set of Functional Dependency. It is denoted by F+. Algorithm : Attribute Closure set Algorithm to compute a+, the closure of a under F Result:= a; while (changes to Result) do for each B → Y in F do Begin if B ⊆ Result then Result := Result
4 min read
Relation between Preemptive Priority and Round Robin Scheduling Algorithm
In this article, we'll try to establish the relation between Round Robin and Preemptive Priority Scheduling Algorithm. Let's discuss the algorithms one by one first and then establish how Round Robin is a special kind of Preemptive Priority Scheduling Algorithm. Prerequisite - CPU Scheduling | Difference between Priority and Round Robin (RR) Schedu
2 min read
LL(1) Parsing Algorithm
Prerequisite — construction of LL(1) parsing table.LL(1) parsing is a top-down parsing method in the syntax analysis phase of compiler design. Required components for LL(1) parsing are input string, a stack, parsing table for given grammar, and parser. Here, we discuss a parser that determines that given string can be generated from a given grammar
4 min read
Slow Start Restart Algorithm For Congestion Control
Once a connection is established between client and server, the sender sends the data to the receiver in form of packets. If the network is congested then packets get dropped. This happens when the buffer of intermediaries devices such as Router is filled. TCP sender has to detect whether it has filled up ‘buffers at the intermediate devices’, and
5 min read