Data Link Layer and Medium Access Sub Layer · Computer Networks

Carrier Sense Multiple Access with Collision Detection (CSMA/CD)


1. Principle of CSMA (Carrier Sense Multiple Access)

ALOHA protocols suffer low throughput because stations transmit blindly without checking the channel ("talk before listening").

CSMA introduces the rule: "Listen Before You Talk" (LBT):

  • A station with a frame to transmit first senses the physical medium (carrier).
  • If the medium is busy, the station defers transmission.
  • If the medium is idle, the station transmits.
MermaidDiagram
Rendering diagram…

CSMA Persistence Strategies:

  1. 1-Persistent CSMA:
    • If idle: Transmit immediately (with probability 1).
    • If busy: Continue listening continuously until the channel becomes idle, then transmit immediately.
    • Issue: If two stations are waiting for a busy channel to clear, both will transmit at the exact instant it clears, causing a guaranteed collision!
  2. Non-Persistent CSMA:
    • If idle: Transmit immediately.
    • If busy: Wait a random period of time before sensing the channel again.
    • Advantage: Reduces collisions; Drawback: Channel may sit idle while stations are in backoff, increasing latency.
  3. p-Persistent CSMA (Used in Slotted Channels):
    • If idle: Transmit with probability pp; defer to the next slot with probability (1−p)(1 - p).

2. Collision Detection: Adding "CD" to CSMA

Even with carrier sensing, collisions still occur due to Propagation Delay (TpT_p):

  • Station A senses the channel idle at time t0t_0 and transmits.
  • Station B, located at the far end of the cable, senses the channel at time t0+Δtt_0 + \Delta t before Station A's signal has had time to propagate to B.
  • Station B also senses the line idle and transmits →\rightarrow Collision occurs in transit!
MermaidDiagram
Rendering diagram…

In standard CSMA, stations continue transmitting the rest of the frame even after a collision, wasting channel time.
CSMA/CD adds Collision Detection: "Listen While Talking":

  • The transmitting station continuously monitors the electrical voltage on the cable while transmitting.
  • If the observed voltage exceeds a threshold (V>VnormalV > V_{\text{normal}}), a collision is detected.
  • The station aborts transmission immediately, saving valuable channel bandwidth!

3. Mathematical Condition for Collision Detection

A transmitting station must be able to detect a collision before it finishes transmitting its frame.

MermaidDiagram
Rendering diagram…

In the worst-case scenario, the collision occurs just before the signal reaches the furthest station (taking time TpT_p). The collision signal takes another TpT_p to travel back to the original sender:

Worst-Case Collision Round-Trip Time=2⋅Tp\text{Worst-Case Collision Round-Trip Time} = 2 \cdot T_p

For the transmitter to still be transmitting when the collision signal returns:

Ttx≥2⋅TpT_{tx} \geq 2 \cdot T_p
Minimum Frame Length (Lmin⁡)Bandwidth (B)≥2⋅Maximum Cable Length (d)v\frac{\text{Minimum Frame Length } (L_{\min})}{\text{Bandwidth } (B)} \geq 2 \cdot \frac{\text{Maximum Cable Length } (d)}{v}
Lmin⁡≥2⋅Tp⋅BL_{\min} \geq 2 \cdot T_p \cdot B

*(This is the fundamental reason why classic 10 Mbps10\text{ Mbps} Ethernet over 2.5 km2.5\text{ km} has a strict minimum frame size of 64 bytes (512 bits)!)*


4. The Jam Signal and Exponential Backoff

When a station detects a collision:

  1. Transmits a Jam Signal: A 32-to-48 bit pattern (e.g., alternating 1010...) broadcast onto the wire to ensure all other stations detect the collision and abort.
  2. Invokes Truncated Binary Exponential Backoff (BEB):
    • Let kk be the collision attempt count for this frame (1≤k≤161 \leq k \leq 16).
    • The station chooses a random integer RR uniformly from the range:
0≤R≤2k−1(truncated at k=10, so R∈[0,1023])0 \leq R \leq 2^k - 1 \quad (\text{truncated at } k = 10, \text{ so } R \in [0, 1023])
  • The station waits a backoff time:
TB=R×Slot Time(where Slot Time =2⋅Tp=51.2 μs in 10Base-T)T_B = R \times \text{Slot Time} \quad (\text{where Slot Time } = 2 \cdot T_p = 51.2\text{ }\mu\text{s in 10Base-T})
  • If after 16 consecutive collision attempts (k=16k = 16) the frame still fails, the station gives up and reports an unrecoverable transmission error to the upper layer.

5. Flowchart of CSMA/CD Operation

MermaidDiagram
Rendering diagram…

Frequently Asked Questions

QCalculate the minimum frame size for a $1\text{ Gbps}$ CSMA/CD network with a maximum cable length of $1\text{ km}$. Signal speed in cable is $2 \times 10^8\text{ m/s}$.
  • Tp=1,000 m2×108 m/s=5×10−6 s=5 μsT_p = \frac{1{,}000\text{ m}}{2 \times 10^8\text{ m/s}} = 5 \times 10^{-6}\text{ s} = 5\text{ }\mu\text{s}.
  • Round-trip delay = 2⋅Tp=10 μs2 \cdot T_p = 10\text{ }\mu\text{s}.
  • Minimum Frame Size:
    Lmin⁡=2⋅Tp⋅B=10 μs×109 bps=10,000 bits=1,250 bytesL_{\min} = 2 \cdot T_p \cdot B = 10\text{ }\mu\text{s} \times 10^9\text{ bps} = 10{,}000\text{ bits} = \mathbf{1{,}250\text{ bytes}}
QWhy is CSMA/CD disabled in Full-Duplex switched Ethernet?

In full-duplex switched Ethernet, each station has dedicated transmit (TxTx) and receive (RxRx) twisted-pair wires directly connected to an intelligent switch port (microsegmentation). Transmissions can never physically collide on the wire, making collision detection and backoff obsolete.

QWhat is the purpose of the Jam Signal in CSMA/CD?

It reinforces the collision voltage on the medium, ensuring that all communicating stations across the entire length of the cable unambiguously detect the collision and discard their partial frames.

QHow does truncated binary exponential backoff work in CSMA/CD?

After the kk-th collision a station picks a random integer RR from [0,2k−1][0, 2^k - 1] (capped at k=10k = 10) and waits R×R \times slot time (51.2 µs in 10 Mbps Ethernet). After 16 failed attempts the frame is dropped and an error is reported.

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.

← All Computer Networks modules