The Wayback Machine - https://web.archive.org/web/20241003210251/https://www.geeksforgeeks.org/collision-detection-csmacd/
Open In App

Collision Detection in CSMA/CD

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

CSMA/CD (Carrier Sense Multiple Access/ Collision Detection) is a media access control method that was widely used in Early Ethernet technology/LANs when there used to be shared Bus Topology and each node ( Computers) was connected by Coaxial Cables. Nowadays Ethernet is Full Duplex and Topology is either Star (connected via Switch or Router) or point-to-point ( Direct Connection). Hence CSMA/CD is not used but they are still supported though. 

Consider a scenario where there are ‘n’ stations on a link and all are waiting to transfer data through that channel. In this case, all ‘n’ stations would want to access the link/channel to transfer their own data. The problem arises when more than one station transmits the data at the moment. In this case, there will be collisions in the data from different stations. 

CSMA/CD is one such technique where different stations that follow this protocol agree on some terms and collision detection measures for effective transmission. This protocol decides which station will transmit when so that data reaches the destination without corruption. 

How Does CSMA/CD Work? 

  • Step 1: Check if the sender is ready to transmit data packets.
  • Step 2: Check if the transmission link is idle. 
    The sender has to keep on checking if the transmission link/medium is idle. For this, it continuously senses transmissions from other nodes. The sender sends dummy data on the link. If it does not receive any collision signal, this means the link is idle at the moment. If it senses that the carrier is free and there are no collisions, it sends the data. Otherwise, it refrains from sending data.
  • Step 3: Transmit the data & check for collisions. 
    The sender transmits its data on the link. CSMA/CD does not use an ‘acknowledgment’ system. It checks for successful and unsuccessful transmissions through collision signals. During transmission, if a collision signal is received by the node, transmission is stopped. The station then transmits a jam signal onto the link and waits for random time intervals before it resends the frame. After some random time, it again attempts to transfer the data and repeats the above process.
  • Step 4: If no collision was detected in propagation, the sender completes its frame transmission and resets the counters.

How Does a Station Know if Its Data Collide?  

Working of CSMA/CD
Consider the above situation. Two stations, A & B. 
Propagation Time: Tp = 1 hr ( Signal takes 1 hr to go from A to B) 

At time t=0, A transmits its data.
t= 30 mins : Collision occurs.

After the collision occurs, a collision signal is generated and sent to both A & B to inform the stations about the collision. Since the collision happened midway, the collision signal also takes 30 minutes to reach A & B. 

Therefore, t=1 hr: A & B receive collision signals.

This collision signal is received by all the stations on that link. Then, 

How to Ensure that it is our Station’s Data that Collided? 

For this, Transmission time (Tt) > Propagation Time (Tp) [Rough bound] 
This is because we want that before we transmit the last bit of our data from our station, we should at least be sure that some of the bits have already reached their destination. This ensures that the link is not busy and collisions will not occur. 
But, above is a loose bound. We have not taken the time taken by the collision signal to travel back to us. For this consider the worst-case scenario. 

Consider the above system again. 

Cllision detection in CSMA/CD

At time t=0, A transmits its data.
t= 59:59 mins : Collision occurs

This collision occurs just before the data reaches B. Now the collision signal takes 59:59 minutes again to reach A. Hence, A receives the collision information approximately after 2 hours, that is, after 2 * Tp.  

Hence, to ensure tighter bound, to detect the collision completely,
Tt > >= 2 * Tp

This is the maximum collision time that a system can take to detect if the collision was of its own data. 

What should be the Minimum length of the Packet to be Transmitted? 

Transmission Time = Tt = Length of the packet/ Bandwidth of the link 
[Number of bits transmitted by sender per second] 
Substituting above, we get, 
Length of the packet/ Bandwidth of the link>= 2 * Tp
Length of the packet >= 2 * Tp * Bandwidth of the link

Padding helps in cases where we do not have such long packets. We can pad extra characters to the end of our data to satisfy the above condition. 

Features of Collision Detection in CSMA/CD

  • Carrier Sense: Before transmitting data, a device listens to the network to check if the transmission medium is free. If the medium is busy, the device waits until it becomes free before transmitting data.
  • Multiple Access: In a CSMA/CD network, multiple devices share the same transmission medium. Each device has equal access to the medium, and any device can transmit data when the medium is free.
  • Collision Detection: If two or more devices transmit data simultaneously, a collision occurs. When a device detects a collision, it immediately stops transmitting and sends a jam signal to inform all other devices on the network of the collision. The devices then wait for a random time before attempting to transmit again, to reduce the chances of another collision.
  • Backoff Algorithm: In CSMA/CD, a backoff algorithm is used to determine when a device can retransmit data after a collision. The algorithm uses a random delay before a device retransmits data, to reduce the likelihood of another collision occurring.
  • Minimum Frame Size: CSMA/CD requires a minimum frame size to ensure that all devices have enough time to detect a collision before the transmission ends. If a frame is too short, a device may not detect a collision and continue transmitting, leading to data corruption on the network. 

Advantages of CSMA/CD

  • Simple and widely used: CSMA/CD is a widely used protocol for Ethernet networks, and its simplicity makes it easy to implement and use.
  • Fairness: In a CSMA/CD network, all devices have equal access to the transmission medium, which ensures fairness in data transmission.
  • Efficiency: CSMA/CD allows for efficient use of the transmission medium by preventing unnecessary collisions and reducing network congestion.

Disadvantages of CSMA/CD

  • Limited Scalability: CSMA/CD has limitations in terms of scalability, and it may not be suitable for large networks with a high number of devices.
  • Vulnerability to Collisions: While CSMA/CD can detect collisions, it cannot prevent them from occurring. Collisions can lead to data corruption, retransmission delays, and reduced network performance.
  • Inefficient Use of Bandwidth: CSMA/CD uses a random backoff algorithm that can result in inefficient use of network bandwidth if a device continually experiences collisions.
  • Susceptibility to Security Attacks: CSMA/CD does not provide any security features, and the protocol is vulnerable to security attacks such as packet sniffing and spoofing.

Conclusion

In conclusion, Collision Detection in CSMA/CD (Carrier Sense Multiple Access with Collision Detection) is a method used in Ethernet networks to handle collisions that occur when two or more devices transmit data simultaneously. When a collision is detected, devices involved pause and wait for a random amount of time before attempting to retransmit, reducing the likelihood of another collision. This approach helps maintain efficient data transmission and minimize network congestion in Ethernet networks.

Frequently Asked Questions on CSMA/CD – FAQs

How does CSMA/CD handle collisions?

When two devices on the network attempt to transmit data simultaneously and a collision is detected, CSMA/CD initiates a process where both devices stop transmitting, wait for a random amount of time, and then try to transmit again. This helps avoid repeated collisions.

Why is collision detection important?

Collision detection is important because it prevents data corruption and network congestion that can occur when multiple devices attempt to transmit at the same time. By detecting collisions early, CSMA/CD ensures more efficient data transmission.

How does CSMA/CD differ from CSMA/CA?

CSMA/CD is used in Ethernet networks, while CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance) is used in wireless networks. CSMA/CA aims to avoid collisions altogether by scheduling transmissions based on network conditions and using acknowledgments to confirm successful data transmission.



Previous Article
Next Article

Similar Reads

Collision-Free Protocols in Computer Network
Almost all collisions can be avoided in CSMA/CD but they can still occur during the contention period. The collision during the contention period adversely affects the system performance, this happens when the cable is long and length of packet are short. This problem becomes serious as fiber optics network came into use. Here we shall discuss some
4 min read
Collision Domain and Broadcast Domain in Computer Network
Prerequisite - Network Devices, Transmission Modes The most common network devices used are routers and switches. But we still hear people talking about hubs, repeaters, and bridges. Do you ever wonder why these former devices are preferred over the latter ones? One reason could be: 'because they are more efficient and powerful'. But what actually
5 min read
Collision Avoidance in wireless networks
We take a close look at so-called WiFi which is also known as IEEE standard 802.11 Consider the situation depicted in the figure, where each of the four nodes is able to send and receive signals that reach just the nodes to its immediate left and right. For example, B can exchange frames with A and C but it cannot reach D, while C can reach B and D
6 min read
How RTS and CTS are used to avoid collision in CSMA CA?
Answer: RTS (Request to Send) and CTS (Clear to Send) signals are mainly used in CSMA/CA to have co-ordinate access to the channel, and making sure that only one node or device sends data at a time to prevent the collisionsSteps demonstrating how RTS and CTS are used to avoid collision in CSMA/CAStep 1: Channel CheckingFirstly, before sending the d
2 min read
What is Strong and Weak Collision Resistance in Cryptography?
Cryptographic hash functions are key tools in such fields as they permit the secure conversion of data into fixed-size digits. In the era of the internet when data security is very important, cryptography has a great significance in protecting non-public information. The two most vital characteristics of cryptographic hash functions include strong
5 min read
Multiple Access with Collision Avoidance (MACA)
Multiple Access with Collision Avoidance (MACA) is a medium access control (MAC) layer protocol used in wireless ad hoc network. It is used to solve the hidden terminal problem and exposed terminal problem. It is an alternate to Carrier-sense multiple access (CSMA) which have the hidden terminal problem and the exposed terminal problem. Working:- T
2 min read
Error detection and Recovery in Compiler
In this phase of compilation, all possible errors made by the user are detected and reported to the user in form of error messages. This process of locating errors and reporting them to users is called the Error Handling process. Functions of an Error handler. DetectionReportingRecoveryClassification of Errors Compile-time errorsCompile-time errors
6 min read
Compiler Design | Detection of a Loop in Three Address Code
Prerequisite - Three address code in Compiler Loop optimization is the phase after the Intermediate Code Generation. The main intention of this phase is to reduce the number of lines in a program. In any program majority of the time is spent actually inside the loop for an iterative program. In the case of the recursive program a block will be ther
3 min read
Approaches to Intrusion Detection and Prevention
Prerequisites - Intrusion Detection System (IDS)Intrusion Prevention System (IPS) IDS stands for Intrusion Detection System (IDS). It is device or software application that monitors network or systems for malicious activity or policy violations. There are six basic approaches to Intrusion Detection and Prevention. Some of these methods are implemen
6 min read
Packet Loss Detection Algorithms
TCP uses retransmission for the lost packets during any transmission, but how does packet loss happens and how TCP can detect it. In this article, we are going to discuss packet loss detection algorithms. When does a packet loss happen?Packet loss happens due to the following reasons: When the receiver's buffer is full but the sender is sending the
5 min read
Random Early Detection (RED) Queue Discipline
RED is among the first Active Queue Management (AQM) algorithms. RED was proposed in 1993 by Sally Floyd. RED is called by three different names; a.k.a Random Early Discard or Random Early Drop and Random Early Detection (so there are 3 possible full forms of RED). The main goal of RED is to: Avoid congestion: Passive Queue Management suffers from
8 min read
Which Layer Called Error Detection Layer?
Answer: The Data Link layer is often referred to as the error detection layer.And, Transport Layer is also responsible for error detection and recovery in data communication. Error DetectionThe Data Link layer is responsible for transferring data frames between adjacent network nodes. During this process, it employs error detection techniques to en
1 min read
Intrusion Detection System (IDS)
An Intrusion Detection System (IDS) is a security tool that monitors a computer network or systems for malicious activities or policy violations. It helps detect unauthorized access, potential threats, and abnormal activities by analyzing traffic and alerting administrators to take action. An IDS is crucial for maintaining network security and prot
10 min read
Network Traffic Analysis for Intrusion Detection and Prevention
Network traffic analysis is defined as a method of monitoring network activity to identify security and performance issues and other breaches. In this article, we will learn about the working, importance, and implementation of network traffic analysis. What is Network Traffic Analysis?Network traffic analysis is a method of monitoring network activ
4 min read
Intrusion Detection Systems (IDS) vs Intrusion Prevention Systems (IPS)
It is difficult to make Internet use secure in current situation, people are the among the most important aspect. The two kinds of network security instruments that are applied to protect against cyber threat dangers are Intrusion Detection Systems (IDS) and Intrusion Prevention Systems (IPS) thus forming a comprehensive scheme of cyber safeguards.
4 min read
Advanced Persistent Threat ( APT) : Working, Characteristics, Detection and Protection
Advanced Persistent Threat (APT) is a prolonged and targeted cyberattack where hackers gain unauthorized access to a network and remain undetected for an extended period. Advanced Persistent Threat (APT) is like a stealthy burglar who breaks into a house and stays hidden for a long time, carefully stealing valuable items without being noticed. Thes
8 min read
Error Detection in Computer Networks
Error is a condition when the receiver's information does not match the sender's. Digital signals suffer from noise during transmission that can introduce errors in the binary bits traveling from sender to receiver. That means a 0 bit may change to 1 or a 1 bit may change to 0.  Data (Implemented either at the Data link layer or Transport Layer of
7 min read
Deadlock Detection Algorithm in Operating System
In operating systems, managing resources like memory, files, and processors is very important. Sometimes, processes (or programs) get stuck waiting for each other to release resources, leading to a situation called a deadlock. To handle deadlocks, operating systems use special methods called deadlock detection algorithms. These algorithms help iden
7 min read
Error Detection Code - Checksum
Checksum is the error detection method used by upper layer protocols and is considered to be more reliable than LRC, VRC and CRC. This method makes the use of Checksum Generator on Sender side and Checksum Checker on Receiver side. At the Sender side, the data is divided into equal subunits of n bit length by the checksum generator. This bit is gen
2 min read
What is Anomaly Detection?
Anomaly Detection, additionally known as outlier detection, is a technique in records analysis and machine studying that detects statistics points, activities, or observations that vary drastically from the dataset's ordinary behavior. These abnormalities may sign extreme conditions which include mistakes, flaws, or fraud. Anomaly Detection is crit
15 min read
DBMS Tutorial – Learn Database Management System
Database Management System is a software or technology used to manage data from a database. Some popular databases are MySQL, Oracle, MongoDB, etc. DBMS provides many operations e.g. creating a database, Storing in the database, updating an existing database, delete from the database. DBMS is a system that enables you to store, modify, and retrieve
8 min read
Operating System Tutorial
An Operating System(OS) is software that manages and handles the hardware and software resources of a computer system. It provides interaction between users of computers and computer hardware. An operating system is responsible for managing and controlling all the activities and sharing of computer resources. An operating system is a low-level Soft
7 min read
Types of Operating Systems
An Operating System performs all the basic tasks like managing files, processes, and memory. Thus, the operating system acts as the manager of all the resources, i.e. resource manager. Thus, the operating system becomes an interface between the user and the machine. It is one of the most required software that is present in the device. Operating Sy
11 min read
TCP/IP Model
The TCP/IP model is a fundamental framework for computer networking. It stands for Transmission Control Protocol/Internet Protocol, which are the core protocols of the Internet. This model defines how data is transmitted over networks, ensuring reliable communication between devices. It consists of four layers: the Link Layer, the Internet Layer, t
13 min read
What is OSI Model? - Layers of OSI Model
OSI stands for Open Systems Interconnection , where open stands to say non-proprietary. It is a 7-layer architecture with each layer having specific functionality to perform. All these 7 layers work collaboratively to transmit the data from one person to another across the globe. The OSI reference model was developed by ISO - 'International Organiz
15+ min read
Basics of Computer Networking
Computer networking is a cornerstone of modern technology, enabling the interconnected systems that power the Internet, business communications, and everyday digital interactions. Understanding the fundamentals of computer networking is essential for anyone involved in technology, from enthusiasts to professionals. This article will explore the bas
12 min read
Types of Network Topology
Network topology refers to the arrangement of different elements like nodes, links, or devices in a computer network. It defines how these components are connected and interact with each other. Understanding various types of network topologies helps in designing efficient and robust networks. Common types include bus, star, ring, mesh, and tree top
12 min read
ACID Properties in DBMS
This article is based on the concept of ACID properties in DBMS that are necessary for maintaining data consistency, integrity, and reliability while performing transactions in the database. Let's explore them. A transaction is a single logical unit of work that accesses and possibly modifies the contents of a database. Transactions access data usi
7 min read
Introduction of ER Model
Peter Chen developed the ER diagram in 1976. The ER model was created to provide a simple and understandable model for representing the structure and logic of databases. It has since evolved into variations such as the Enhanced ER Model and the Object Relationship Model The Entity Relational Model is a model for identifying entities to be represent
10 min read
Normal Forms in DBMS
Normalization is the process of minimizing redundancy from a relation or set of relations. Redundancy in relation may cause insertion, deletion, and update anomalies. So, it helps to minimize the redundancy in relations. Normal forms are used to eliminate or reduce redundancy in database tables. Normalization of DBMSIn database management systems (
12 min read