CSMA/CD

Part of Networking

Carrier Sense Multiple Access with Collision Detection — the protocol that made shared Ethernet possible.

Why This Matters

When multiple devices share a single communication channel, they must coordinate access to avoid simultaneous transmissions that destroy each other. CSMA/CD (Carrier Sense Multiple Access with Collision Detection) is the elegant solution that Ethernet used for decades to manage shared channel access without requiring central coordination.

Understanding CSMA/CD matters because it illustrates a fundamental principle of distributed systems design: how independent agents can coordinate effectively using only local information and simple rules. The protocol does not require any device to know what others are doing — it only requires each device to listen before transmitting and respond appropriately to detected failures. This decentralized approach made Ethernet robust and scalable.

Even though modern switched Ethernet has largely eliminated the need for CSMA/CD (because switches give each device a dedicated connection rather than a shared channel), the protocol remains important for understanding half-duplex operation, for working with legacy hardware, and for grasping the fundamental problem of medium access control that underlies all shared communication systems.

The Problem of Shared Media

In a bus network or a hub-based star network, all devices share a single electrical medium. When any device transmits, its signal propagates to all other devices simultaneously. If two devices transmit at the same time, their signals overlap and combine into a garbled signal that neither receiver can decode — this is a collision.

The naive solution to collisions is centralized scheduling: a master device grants permission to transmit, ensuring only one device transmits at a time. This works but creates a single point of failure (the master device) and introduces latency (every device must wait for permission before transmitting). For a protocol intended to be simple and decentralized, centralized scheduling is unsatisfactory.

CSMA/CD instead solves the collision problem through a listen-before-talk discipline combined with collision detection and recovery. The protocol is entirely distributed: every device follows the same rules independently, and the collective behavior of all devices following the same rules produces a functional shared network without any central coordinator.

How CSMA/CD Works

The protocol has four phases: carrier sense, transmission, collision detection, and backoff.

Carrier sense means listening to the channel before transmitting. If the channel is idle (no signal present), the device may begin transmitting. If the channel is busy (another device is transmitting), the device waits until the channel becomes idle, then waits an additional brief period (the interframe gap) before transmitting.

Transmission proceeds while the device continues listening to the channel. This simultaneous transmit-and-listen is what enables collision detection.

Collision detection compares what the device is transmitting to what it receives from the channel. If they match, no collision has occurred. If the received signal differs from the transmitted signal (because another device’s signal has mixed with it), a collision has occurred. When a collision is detected, the transmitting device immediately sends a jam signal — a brief burst of random data that ensures all other devices on the network also detect the collision.

Backoff is the recovery mechanism. After detecting a collision, each device that was transmitting waits a random amount of time before attempting to retransmit. The randomness is crucial: if both devices waited the same amount of time, they would collide again immediately. The random backoff makes it likely that one device will begin transmitting before the other, giving it access to the channel.

The backoff algorithm used in Ethernet is truncated binary exponential backoff. After the first collision, each device waits a random number of slot times between 0 and 1 (i.e., 0 or 1 slot). After the second collision, between 0 and 3. After the third, between 0 and 7. The range doubles with each collision, up to a maximum of 1,023 slot times after ten collisions. After sixteen consecutive collisions, the transmission is aborted and an error is reported to higher layers.

The Propagation Delay Problem

CSMA/CD has a fundamental limitation related to propagation delay. When a device begins transmitting, its signal takes time to propagate to the far end of the network. During this propagation time, a device at the far end may sense the channel as idle (because the first device’s signal has not yet arrived) and begin transmitting. A collision then occurs, but the first device will not detect it until the collision signal propagates back.

This propagation delay sets a minimum frame size. A frame must be long enough that the device is still transmitting when the collision signal returns. At Ethernet speeds and typical network lengths, this minimum frame size is 64 bytes. Frames shorter than 64 bytes are called runt frames and indicate either a collision or a malformed transmission.

The propagation delay also limits the maximum network extent. The longer the network, the longer propagation delay, and the larger the window during which a second device can begin transmitting without detecting the first device’s signal. Ethernet specifications define maximum cable lengths that ensure the propagation delay stays within the bounds required for CSMA/CD to function correctly.

Practical Performance and Limitations

CSMA/CD networks perform well at low utilization but degrade as load increases. At low utilization, few collisions occur and most transmissions succeed on the first attempt. As utilization increases, collisions become more frequent, retransmissions add to the load, and performance degrades nonlinearly. A heavily loaded CSMA/CD network can enter a collapse state where nearly all transmissions collide and nothing gets through.

For this reason, CSMA/CD networks were typically designed to operate at no more than 30-40% of their theoretical capacity. Higher utilization required either faster hardware, smaller collision domains, or switching to a different access method.

The transition from hub-based to switched Ethernet resolved the CSMA/CD performance problem by eliminating shared media. A switch gives each device a dedicated connection, and full-duplex operation means a device can transmit and receive simultaneously without collision. Modern switched Ethernet does not use CSMA/CD at all — the protocol is disabled when a link negotiates full-duplex mode.

Building CSMA/CD Networks

If you are building a network from older hardware, you will likely encounter CSMA/CD in half-duplex connections and hub-based networks. The key design principles are: keep collision domains small (fewer devices sharing the same segment), keep cable lengths within specifications, and avoid creating large shared segments when switching hardware is available.

A collision domain is the set of devices that can cause collisions with each other — all devices on the same hub or bus segment. Switches (and routers) separate collision domains: a collision on one switch port does not affect devices on other ports. When you have a mix of switches and hubs, place hubs only at the edge where they connect small groups of devices, and connect hubs to switches to separate the collision domains.

Monitoring collision rates is a useful diagnostic tool. A small number of collisions is normal and indicates CSMA/CD is functioning. A high collision rate (above about 5% of frames) indicates either excessive utilization, a cable problem creating a persistent signal on the medium, or a malfunctioning device that transmits continuously (a “jabber” fault).