CSMA/CD is an acronym used for Carrier Sense Multiple Access with Collision Detection and is a collision detection protocol. It is basically a refinement/improvisation of CSMA where the user detects the occurrence of data packet collision along with sensing for the availability of carrier in a multiple user network channel.
This technique enables us to communicate within a shared network in an efficient manner by keeping a check on data collision within the network. However, this algorithm detects collision but is not capable of reducing it.
Introduction to CSMA
In our previous content on carrier sense multiple access, we have seen that it is based on the principle of sense before transmit. Also, we have seen that CSMA was introduced to overcome the drawbacks of the ALOHA protocol.
In the CSMA technique, each individual user sharing the channel with other users first senses the presence of any other carrier in the channel. If any other user is detected using the channel for data transmission, then it will wait for some random time period and will retransmit to eliminate the chances of collision. However, this has not nullified the collision because if two stations simultaneously begin to transmit after sensing the channel idle then this will lead to collision.
CSMA technology is quite a useful one but it is not incorporated with an acknowledgment mechanism from the receiver. However, there is a significant reason behind the same. The reason is we already know that the presence of various users automatically increases the chance of collision in the network. Along with that if there will be the presence of acknowledgment signals in the network for each transmitted data packet then this will lead to a huge collision.
So, another version of CSMA came into existence where despite waiting for acknowledgment, the users keep the check on whether any collision has occurred during transmission. This modified CSMA scheme is known as CSMA/CD where CD stands for Collision Detection and is used to deal with the inefficiency of CSMA.
Basics of CSMA/CD
The principle of operation of CSMA/CD is:
Sense during Transmit
In simple form, it is basically, Listen while Speak.
In CSMA, if the data from two stations collide then the channel will be remained unutilized for the complete transmission time. This leads to wastage in channel capacity when transmission continues even after a collision because of a lack of information. However, if the propagation delay is less than the transmission time then the wastage in channel capacity is considerable.
But the question arises – Is there any way by which we can deal with this wastage of channel capacity?
The answer is Yes. If along with before transmission, the channel is monitored during the transmission as well by the transmitting node then in case of occurrence of a collision, the node will get to know that collision has occurred and the node will immediately stop further transmission. By doing so, the chances of wastage of channel capacity can be reduced.
This scheme is known as Carrier Sense Multiple Access with Collision Detection as here the channel is monitored before transmission as well as during transmission. Before transmission, the channel is sensed to check if it is busy or idle but during transmission, it is monitored to check if any collision has happened. This technology is suitable for wired local area networks thus is mainly used in Ethernet.
Operation of CSMA/CD using Flow Chart
The figure shown below represents a flow chart explaining how CSMA/CD takes place.
Initially when a node wishes to transmit a data packet then it first senses the channel to check for two conditions whether it is
If the channel is already busy that means the transmission is taking place by any other node of the network. So, that particular node will wait and go for sensing again after some time interval. However, if the node finds the channel free then it will start transmitting the data packet over the channel.
Now next, once transmission has started then the respective node will monitor the channel to see if collision has occurred. Here also we have two conditions:
- Collision is not detected
- Collision is detected
If no collision has been detected by the node, then it continues to transmit and at the same time will regularly keep on checking for collision signal. If no collision signal reaches the node during the whole transmission, then it will consider that the transmission has been successfully completed.
However, if the transmitting node, detects data collision, then it immediately stops transmitting any further bits and notifies all the other nodes in the network regarding data collision by sending a jamming signal to all the nodes. After this, the respective node is required to check whether it has reached the maximum limit of transmission attempts or not. So, for this, the node will increment the attempt by 1 after each time it detects collision and check whether it is less than 15 or not.
The maximum permissible attempts to transmit a packet after detecting collision for a node is 15. So, here will be two more conditions:
- Incremented attempt count more than 15
- Incremented attempt count less than 15
If after incrementing, the attempts get more than 15 in the count then the packet gets discarded due to excessive collision. However, in case the count for the same is less than 15 then the respective node will prepare to retransmit the data packet over the channel again. For this, it will calculate the back-off time and will wait for the completion of that time duration. Once this is done, the node will again go for checking the availability of the channel that whether it is free or not in order to resume the transmission.
Here the backoff time is of great importance because if data from two nodes get collided and they began to retransmit after the same time interval then this will lead to collision again. Thus, each node must calculate the back-off time (random time) individually to avoid the chances of collision again.
Transmission Time and Propagation Delay
Suppose there are two stations M and N within a network that possess a propagation delay of 30 minutes. At 10:00 am both the stations have checked whether the channel is idle or busy. As we have already discussed in CSMA that while sensing the carrier, the complete channel will not be checked despite only the respective node region will be checked and at 10:00 am both finds the channel idle and begins to transmit towards each other unaware of each other’s transmission.
Propagation delay defined as the ratio of distance to the velocity of propagation. Both exhibit a propagation delay of 30 minutes as the distance between the two and propagation speed are the same. So, exactly after 15 minutes of starting transmission, data from both nodes will collide.
After collision has occurred, useless data that carries collision information is forwarded towards both stations. The useless data will also have the same propagation delay so, each station will get the collision signal after 15 minutes from the instant collision has occurred. As collision has occurred at 10.15 am thus, both will get the collision signal at nearly 10.30 am.
So, if both stations are still transmitting then exactly at 10.30 am they will get the collision signals. This means the collision signal will be obtained after the completion of the propagation delay. Thus, it is necessary that the
Transmission time > Propagation delay
However, there is a worst-case also.
Consider stations M and N again and propagation delay of 30 minutes.
M began transmission at 10:00 am and at 10:29 am, N has checked the channel to begin its transmission. As data from M will reach N by 10.30 due to a propagation delay of 30 minutes so, collision will occur at 10:29 am i.e., at the moment when almost the data from M was about to reach N. As N recently begin to transmit then it will immediately get the collision signal. But the collision signal will take 29 minutes to reach station M. Also, M will get to know about the collision if it is still transmitting the signal at that time.
So, we can say approximately after double the propagation time (i.e., 1 hour), station M will get a collision signal. Hence if τ denotes the maximum propagation delay then if collision occurs then 2τ time will be needed by all the nodes to detect collision and abort further transmission.
It is to be noted here that stations will get the collision signal only when they are still transmitting. If they are done with their end of transmission then stations will remain in ambiguity if it’s their data that have collided and lost or data transmitted by any other station in the network. Thus,
Hence, the packet length must be greater or equal to twice the product of propagation delay and channel bandwidth.
The efficiency of CSMA/CD is given as:
: a = propagation delay/ transmission time
The CSMA/CD scheme can detect collision but is not capable of reducing it. Also, the performance of this scheme decreases with the increase in the load within the network (i.e., nodes).