Sub topic 10
CSMA/CD: Detecting Collisions While Transmitting
Prerequisites
Assume you know that the data link layer sends frames, that several stations can share one physical channel, and that transmission delay differs from propagation delay. You should also know basic binary numbers.
Why Collision Detection Is Needed
In a shared Ethernet network, multiple stations use the same cable. Two stations may both find the channel idle and begin transmitting at nearly the same time. Their electrical signals then overlap. The result is a collision, and neither frame can be decoded correctly.
CSMA/CD means Carrier Sense Multiple Access with Collision Detection:
- Carrier sense: A station listens to the channel before transmitting.
- Multiple access: Many stations share the same channel.
- Collision detection: A transmitting station continues listening while it sends.
Classic Ethernet uses a 1-persistent form of carrier sense. If the channel is busy, a station waits. When the channel becomes idle, it transmits immediately. This reduces idle time, but two waiting stations can still transmit together.
Collision-Detection Procedure
A station follows this sequence:
- Listen until the channel is idle.
- Start transmitting the frame.
- Monitor the channel during transmission.
- If the observed signal differs from the station's own signal, detect a collision.
- Stop transmitting the frame.
- Send a jam signal so every station notices the collision.
- Wait for a randomly selected backoff interval.
- Retransmit, unless the maximum attempt count has been reached.
The station must detect a collision before it finishes sending. Otherwise, it could incorrectly believe that the frame succeeded.
Backoff and Failure
After the first collision, a station chooses a random delay from a small range. After later collisions, the range grows. This is binary exponential backoff. For collision number \(k\), the station selects a slot count from:
\[ 0 \text{ through } 2^{\min(k,10)}-1 \]
Classic Ethernet gives up after 16 failed attempts. Random delays reduce the chance that the same stations collide again.
| Event | Station action |
|---|---|
| Channel busy | Wait and continue sensing |
| Channel idle | Transmit |
| Collision detected | Send jam, back off, and retry |
| Sixteen failed attempts | Discard the frame |
Worked Timing Idea
The worst-case collision may begin at the far end of the network and return after a round-trip propagation time. Therefore, the sender must still be transmitting when that signal returns. This requirement determines Ethernet's minimum frame size.
bandwidth_bps = 10_000_000
round_trip_time_s = 51.2e-6
minimum_frame_bits = round(bandwidth_bps * round_trip_time_s)
print(minimum_frame_bits) # 512Exercise
Why does CSMA/CD require a station to monitor the channel while it transmits?
Show answer
A collision may begin at another station and take time to propagate back. Monitoring lets the sender detect the collision before it finishes sending.