# CSMA/CD with the Binary Exponential Backoff

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.

When more than one stations send their frames simultaneously, collision occurs. Back-off algorithm is a collision resolution mechanism which is commonly used to schedule retransmissions after collisions in Ethernet. The waiting time that a station waits before attempting retransmission of the frame is called as back off time.

## Algorithm of CSMA/CD

Step 1) When a frame is ready, the transmitting station checks whether the channel is idle or busy.

Step 2) If the channel is busy, the station waits until the channel becomes idle.

Step 3) If the channel is idle, the station starts transmitting and continually monitors the channel to detect collision.

Step 4) If a collision is detected, the station starts the binary exponential backoff algorithm.

Step 5) The station resets the retransmission counters and completes frame transmission.

## Binary Exponential Backoff Algorithm in case of Collision

Step 1) 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.

Step 2) The station increments the retransmission counter, c, that denote the number of collisions.

Step 3) The station selects a random number of slot times in the range 0 and 2c – 1. For example, after the first collision (i.e. c = 1), the station will wait for either 0 or 1 slot times. After the second collision (i.e. c = 2), the station will wait anything between 0 to 3 slot times. After the third collision (i.e. c = 3), the station will wait anything between 0 to 7 slot times, and so forth.

Step 4) If the station selects a number 𝑘 in the range 0 and 2c – 1, then

Back_off_time = k × Time slot,

where a time slot is equal to round trip time (RTT).

Step 5) And the end of the backoff time, the station attempts retransmission by continuing with the CSMA/CD algorithm.

Step 6) If the maximum number of retransmission attempts is reached, then the station aborts transmission.

The flowchart below summarizes the algorithms. CMSA/CD algorithm is shown in green colour while the backoff algorithm is shown in maroon colour.