CSMA/CD

Theory

Carrier Sense Multiple Access with Collision Detection (CSMA/CD) is a network protocol used in wired Ethernet to manage access to the transmission medium and handle data collisions. It ensures efficient use of the shared medium by detecting and resolving collisions. Below are key topics related to CSMA/CD:

1. Interference in CSMA/CD

Interference in CSMA/CD occurs when multiple devices attempt to transmit data simultaneously on the same medium, leading to signal overlap and data corruption. This is commonly known as a collision.

How Interference Occurs:

  • Multiple stations sense that the channel is idle and begin transmission.
  • If two or more devices transmit at the same time, their signals interfere with each other, causing data corruption.
  • The network must detect this interference and take corrective measures.

How CSMA/CD Handles Interference:

  1. Carrier Sense: Each device listens to the channel before transmitting. If it's busy, the device waits.
  2. Collision Detection: If interference (collision) occurs, the device detects it by monitoring voltage levels on the transmission medium.
  3. Jam Signal: A special signal is sent to notify all devices that a collision has occurred.

2. Backoff Algorithm in CSMA/CD

The backoff algorithm is used to resolve collisions by introducing a random delay before retransmission. This helps prevent repeated collisions from occurring immediately after a previous one.

How the Backoff Algorithm Works:

  • If a collision is detected, the station stops transmitting and sends a jam signal to notify others.
  • The station then waits for a random period before trying again. This waiting time is determined using binary exponential backoff.

Binary Exponential Backoff:

  • Each station selects a random backoff time in the range: (0 to 2n - 1) × Slot Time

where n is the number of collisions encountered (up to a limit).

  • The more collisions occur, the longer the potential wait time, reducing further collisions.
  • If the maximum retry limit is reached, the transmission attempt fails, and an error is reported.

3. Minimum Packet Size for Collision Detection

To ensure effective collision detection, Ethernet networks enforce a minimum packet size. This ensures that a device can detect a collision before completing its transmission.

Why Minimum Packet Size is Needed:

  • Collision Window: A station must transmit long enough for its signal to propagate across the network. If a packet is too short, the sender might finish transmission before a collision is detected.
  • Slot Time: The minimum time required for a signal to travel across the entire network and back.
  • In 10 Mbps Ethernet, the slot time is: 512 bits (64 bytes)

Effect on Performance:

  • Small packets (<64 bytes): May result in undetected collisions.
  • Larger packets: Ensure that collision detection can occur within the transmission time.