The CSMA method does not tell us what to do in case there is a collision. The size of a frame must be large enough so that collision can be detected by the sender while sending the frame. Atleast *two times* happen the maximum propagation delay.Carrier sense multiple access with collision detection (CSMA/CD) adds to the CSMA algorithm to deal with the collision.

## Efficiency of CSMA/CD

Carrier Sense Multiple Access (CSMA) is a networking protocol used in various forms in Ethernet. Networks to regulate the transmission of data packets among multiple devices sharing the same communication channel.

The fundamental idea behind CSMA is to minimize data collisions.Transmit data and check the channel to see if it’s currently in use by other devices. If the channel is idle (no ongoing transmission), the device can start sending its data. However, if the channel is busy, the device will wait for a random period and then check the channel again before attempting to transmit.

There are different variations of CSMA:

For example, if you know the rate of successful transmissions, the average time spent on backoff after a collision, the time for collision detection, and other relevant parameters, you can compute the total time and the useful transmission time to then determine the efficiency.

**CSMA**: Basic Carrier Sense Multiple Access, which checks the channel before sending data.**CSMA/CD**: Carrier Sense Multiple Access with Collision Detection. Two devices transmitting data simultaneously, leading to data corruption, the devices involved in the collision would cease transmission and wait for a random amount of time before attempting to resend the data.**CSMA/CA**: This will implement to avoid collisions such ad protocols for reserving channel before transmission. Carrier Sense Multiple Access with Collision Avoidance. It’s used in wireless networks like Wi-Fi. In CSMA/CA, nodes listen to the channel and wait for it to be idle before transmitting data.

Calculation

The efficiency of CSMA/CD can be calculated using the formula for efficiency in a network protocol, which is the ratio of useful transmission time to the total time, taking into account the protocol’s characteristics.

The formula for efficiency $E$ is given by:

To calculate the efficiency, you need to quantify these times based on the specific conditions and characteristics of the network.

$E= Ztotal /Zuseful $

Where:

- $Z_{useful}$ is the time during which successful transmissions occur without collisions.
- $Z_{total}$ is the total time, which includes useful transmission time as well as idle time, collision detection, backoff time, and any other overhead.

In the case of CSMA/CD:

- $Z_{useful}$ is the time when a device is actually transmitting data without experiencing collisions. This depends on the rate of successful transmissions.
- $Z_{total}$ includes the time spent on successful transmissions, idle time, collision detection, backoff time, and any other protocol overhead.

## Back-off Algorithm for CSMA/CD

Prerequisite –CSMA

**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

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

### Advantages

**Back-0ff-algorithm Improves network performance:**Back-off algorithm reduces the number of collisions and retransmissions, thus improving the overall network performance.**Back-0ff-algorithm Increases channel utilization**: By reducing the number of collisions, back-off algorithm increases the channel utilization, leading to better use of network resources.**Back-0ff-algorithmReduces delays:**By reducing the number of collisions, back-off algorithm reduces the waiting time between transmission attempts, resulting in lower delays.**Back-0ff-algorithmFairness:**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.