Carrier Sense Multiple Access with Collision Detection (CSMA/CD) is a network
protocol for carrier transmission that operates in the Medium Access Control (MAC)
layer. It senses or listens whether the shared channel for transmission is busy or not,
and defers transmissions until the channel is free. The collision detection technology
detects collisions by sensing transmissions from other stations. On detection of a
collision, the station stops transmitting, sends a jam signal, and then waits for a random
time interval before retransmission.
Algorithms
The algorithm of CSMA/CD is:
When a frame is ready, the transmitting station checks whether the channel is
idle or busy.
If the channel is busy, the station waits until the channel becomes idle.
If the channel is idle, the station starts transmitting and continually monitors the
channel to detect collision.
If a collision is detected, the station starts the collision resolution algorithm.
The station resets the retransmission counters and completes frame
transmission.
The algorithm of Collision Resolution is:
The station continues transmission of the current frame for a specified time along
with a jam signal, to ensure that all the other stations detect collision.
The station increments the retransmission counter.
If the maximum number of retransmission attempts is reached, then the station
aborts transmission.
Otherwise, the station waits for a backoff period which is generally a function of
the number of collisions and restart main algorithm.
The following flowchart summarizes the algorithms:
Though this algorithm detects collisions, it does not reduce the number of
collisions.
It is not appropriate for large networks performance degrades exponentially when
more stations are added.
Advantages of CSMA CD:
1. It is used for collision detection on a shared channel within a very short time.
2. CSMA CD is better than CSMA for collision detection.
3. CSMA CD is used to avoid any form of waste transmission.
4. When necessary, it is used to use or share the same amount of bandwidth at each
station.
5. It has lower CSMA CD overhead as compared to the CSMA CA.
Disadvantage of CSMA CD
6. It is not suitable for long-distance networks because as the distance increases,
CSMA CD' efficiency decreases.
7. It can detect collision only up to 2500 meters, and beyond this range, it cannot
detect collisions.
8. When multiple devices are added to a CSMA CD, collision detection performance
is reduced.
Carrier Sense Multiple Access With Collision
Detection
CSMA/CD, a MAC process protocol, first senses for any transmissions from the other
stations in the channel and starts transmitting only when the channel is clear to transmit.
As soon as a station detects a collision, it stops transmission and sends a jam signal. It then
waits for some time period before retransmitting.
Let’s understand the meaning of the individual component of CSMA/CD.
1. CS – It stands for Carrier Sensing. It implies that before sending data, a station first
senses the carrier. If the carrier is found free, then the station transmits data else it
refrains.
2. MA – Stands for Multiple Access i.e. if there’s a channel, then there are many
stations that are trying to access it.
3. CD – Stands for Collision Detection. It also guides to proceed in case of packet data
collision.
What Is CSMA/CD
CSMA/CD procedure can be understood as a group discussion, where if the participants
speak all at once then it will be very confusing and the communication will not happen.
Instead, for good communication, it is required that the participants speak one after another
so that we can clearly understand the contribution of each participant in the discussion.
Once a participant has finished talking, we should wait for a certain time period to see if any
other participant is speaking or not. One should start speaking only when no other
participant has spoken. If another participant also speaks at the same time, then we should
stop, wait, and try again after some time.
Similar is the process of CSMA/CD, where the data packet transmission is only done when
the data transmission medium is free. When various network devices try to share a data
channel simultaneously, then it will encounter a data collision.
The medium is continuously monitored to detect any data collision. When the medium is
detected as free, the station should wait for a certain time period before sending the data
packet to avoid any chances of data collision.
When no other station tries to send the data and there is no data collision detected, then the
transmission of data is said to be successful.
Algorithm
The algorithm steps include:
First, the station that wants to transmit the data senses the carrier as to whether it is
busy or idle. If a carrier is found idle, then the transmission is carried out.
The transmission station detects a collision, if any, using the condition: Tt >= 2 *
Tp where Tt is the transmission delay and Tp is the propagation delay.
The station releases the jam signal as soon as it detects a collision.
After collision has occurred, the transmitting station stops transmitting and waits for
some random amount of time called the ‘back-off time’. After this time, the station
retransmits again.
CSMA/CD Flow Chart
[image source]
How Does CSMA/CD Work
To understand the working of CSMA/CD, let’s consider the following scenario.
Suppose there are two stations A and B. If station A wants to send some data to
station B, then it has to sense the carrier first. The data is being sent only if the
carrier is free.
But by standing at one point, it cannot sense the entire carrier, it can only sense the
point of contact. According to the protocol, any station can send data at any time, but
the only condition is to first sense the carrier as if its idle or busy.
In case A and B together start transmitting their data, then it’s fairly possible that the
data of both the stations will collide. So, both the stations will receive inaccurate
collided data.
So, the question that arises here is: how will the stations know that their data got
collided?
The answer to this question is, if the colloidal signal comes back during the process of
transmission, then it indicates that the collision has occurred.
For this, the stations need to keep on transmitting. Only then they can be sure that it’s their
own data that got collided/corrupted.
If in case, the packet is large enough, which means by the time the collision signal comes
back to the transmitting station, the station is still transmitting the left part of data. Then it
can recognize that its own data got lost in the collision.
Understanding Collision Detection
In order to detect a collision, it is important that the station keeps on transmitting the data
until the transmitting station gets back the collision signal if any.
Let’s take an example where the first bits transmitted by the station is involved in the
collision. Consider we have four stations A, B, C and D. Let the propagation delay from
station A to station D be 1 hour i.e. if the data packet bit starts to move at 10 a.m., then it
will reach D at 11 a.m.
At 10 a.m. both the stations, A and D sense the carrier as free and start their
transmission.
If the total propagation delay is 1 hour, then after half an hour both the station’s first
bits will reach halfway and will soon experience a collision.
So, exactly at 10:30 a.m., there will be a collision which will produce collision signals.
At 11 a.m. the collision signals will reach stations A and D i.e. exactly after one hour
the stations receive the collision signal.
Therefore, for the respective stations to detect that it’s their own data that got
collided the transmission time for both the stations should be greater than their
propagation time. i.e. Tt>Tp
Where Tt is the transmission time and Tp is the propagation time.
Let’s see the worst-case situation now.
Station A started the transmission at 10 a.m. and is about to reach station D at
10:59:59 a.m.
At this time, station D started its transmission after sensing the carrier as free.
So here the first bit of data packet sent from station D will face collision with the data
packet of station A.
After collision occurred, the carrier starts sending a colloidal signal.
Station A will receive the collision signal after 1 hour.
This is the condition for detecting collision in the worst case where if a station wants to
detect collision then it should keep on transmitting the data till 2Tp, i.e. Tt>2*Tp.
Now the next question is if the station has to transmit the data for at least 2*Tp time
then how much data should the station have so that it could transmit for this amount
of time?
So in order to detect a collision, the minimum size of the packet should be 2*Tp*B.
The below diagram explains the Collision of first bits in CSMA/CD:
[image source]
Station A,B,C, D are connected through Ethernet wire. Any station can send its data packet
for transmission after sensing the signal as idle. Here the data packets are sent in bits
which take time to travel. Due to this, there are chances of a collision.
In the above diagram, at time t1 station A starts transmitting the first bit of data after sensing
the carrier as free. At time t2, station C also senses the carrier as free and starts
transmitting the data. At t3, the collision occurs between bits sent by stations A and C.
Thus, the transmission time for station C becomes t3-t2. After the collision, the carrier will
send back the colloidal signal to station A which will reach at time t4. This means, while
sending the data, the collision can also be detected.
Having seen the time durations for the two transmissions, refer to the below figure
for a complete understanding.
Efficiency Of CSMA/CD
The efficiency of CSMA/CD is better than Pure ALOHA however there are some points that
need to be kept in mind while measuring the efficiency of CSMA/CD.
These include:
If the distance increases, then the efficiency of CSMA/CD decreases.
For Local Area Network (LAN), CSMA/CD works optimally but for long-distance
networks like WAN, it’s not advisable to use CSMA/CD.
If the length of the packet is bigger, then the efficiency increases but then again
there is a limitation. The maximum limit for the length of the packets is 1500 bytes.
Advantages & Disadvantages Of CSMA/CD
Advantages
Overhead is less in CSMA/CD.
Whenever possible, it utilizes all the bandwidth.
It detects collision within a very short span of time.
Its efficiency is better than simple CSMA.
It mostly avoids any kind of wasteful transmission.
Disadvantages
Not suitable for large distance networks.
Distance limitation is 2500 meters. Collision can’t be detected after this limit.
Assignment of priorities cannot be done to certain nodes.
As devices are added, the performance disrupts exponentially.
Applications
CSMA/CD was used in shared media Ethernet variants(10BASE2,10BASE5) and in the
early versions of twisted pair Ethernet that used repeater hubs.