3.2 CSMA, CSMA/CD & Exponential Backoff Algorithm
💡 Core Intuition: The Polite Classroom Conversation
🍳 The Everyday Analogy: "Listen Before You Speak"
In ALOHA, people behave like unruly toddlers: whenever a thought pops into their head, they shout it out immediately without checking whether someone else is already talking. This blind shouting causes constant collisions and wastes over 63% of the room's conversational time.
Carrier Sense Multiple Access (CSMA) introduces basic conversational etiquette:
- Carrier Sensing ("Listen Before You Speak"): Before uttering a word, you pause and listen to the room. If someone else is currently speaking, you keep your mouth shut. You only start talking when the room is dead silent.
- Collision Detection ("Listen While Speaking"): What if you and a friend sitting across the table both notice silence at the exact same millisecond and begin speaking simultaneously? In CSMA/CD, you do not mindlessly recite your entire 5-minute speech. You listen to your own voice while speaking. The instant you hear someone else talking over you, you stop speaking immediately, yell a brief "Sorry, go ahead!" (Jamming Signal), and roll a pair of dice to decide how many seconds to wait before trying again (Randomized Exponential Backoff).
💻 Bridging to Computer Science
In broadcast computer networks, an electrical or optical transmitter can sense the voltage or radio energy present on the physical cable before injecting its own bits.
By adding Carrier Sense (CS), the vulnerable collision window shrinks drastically from the entire frame transmission time () down to the physical propagation delay of the wire (). By adding Collision Detection (CD), stations abort collided transmissions immediately rather than transmitting corrupt bits to completion, freeing the channel for productive data.
📑Table of Contents
- 🎧 CSMA Foundations & The Vulnerable Window (T_p)
- 🔁 The Three Persistence Strategies (1-Persistent, Non-Persistent, p-Persistent)
- ⚡ CSMA/CD Mechanics & Transceiver Energy Sensing
- 📏 The Golden Minimum Frame Size Derivation (T_t \ge 2 T_p)
- 🎲 Binary Exponential Backoff Algorithm Internals
- 📈 CSMA/CD Channel Efficiency & Parameter 'a'
- 📶 Why Collision Detection Fails in Wireless (CSMA/CA)
- 🏭 Real-World Production Context: How Automotive CAN Bus & DOCSIS Adapted CSMA
- 📐 Numerical Applications & Worked Examples
- 🎯 Exam & Interview Pitfall Check
🎧 CSMA Foundations & The Vulnerable Window ()
In pure ALOHA, any station transmits blindly whenever a frame arrives. Carrier Sense Multiple Access (CSMA) requires every station to sense the shared medium before transmitting.
Why Do Collisions Still Occur in CSMA?
If every station listens before transmitting, how can collisions happen at all?
The root cause is Propagation Delay (): electrical and optical signals do not travel instantaneously; they propagate down copper or fiber at approximately (roughly per kilometer).
For example, consider Station and Station situated at opposite ends of a cable:
- At , Station senses the medium, finds it idle, and begins transmitting Frame .
- At (just before 's electrical wavefront reaches ), Station senses the line. Because 's signal has not yet arrived at , Station also senses the line as idle and begins transmitting Frame .
- Moments later, the two electrical wavefronts collide on the wire, corrupting both frames.
- Station senses the medium at , finds it idle, and begins transmitting.
- Station , located at the opposite end of a cable, has a frame to send at .
- Station senses the cable. Because Station 's electrical wavefront has only traveled and has not yet reached Station , Station detects zero signal on the wire!
- Station concludes the wire is idle and starts transmitting its own frame.
- A few meters later, the two electrical wavefronts collide, corrupting both transmissions.
Vulnerable Time in CSMA
The vulnerable time in CSMA is the time required for a signal to propagate from one extreme end of the medium to the other:
Compare the vulnerable collision windows across the three random-access protocols:
| Protocol | Vulnerable Period () | Primary Collision Vulnerability |
|---|---|---|
| Pure ALOHA | Complete and partial frame overlaps anywhere in time. | |
| Slotted ALOHA | Coinciding transmissions starting at the same slot clock boundary. | |
| CSMA | Propagation blind-spot before wavefront reaches remote nodes. |
Because in typical local networks the propagation delay () is orders of magnitude smaller than the frame transmission time () (i.e. ), CSMA drastically slashes collision rates compared to ALOHA.
🔁 The Three Persistence Strategies (1-Persistent, Non-Persistent, p-Persistent)
When a station senses the line and discovers it is busy (another station is currently transmitting), what should it do? The MAC layer implements one of three persistence strategies:
Contrasting channel aggression, idle channel waste, and collision probability
1-Persistent CSMA
- •Continuously monitors the line while busy.
- •The instant the line becomes idle, transmits immediately (Probability = 1.0).
- •Advantage: Zero wasted channel idle time after a frame finishes.
- •Disadvantage: If 2 or more stations were waiting during an ongoing transmission, both transmit immediately upon line idle, causing a guaranteed collision.
Non-Persistent CSMA
- •Senses the line once. If busy, stops monitoring immediately.
- •Waits for a random amount of time (backoff) before sensing the line again.
- •Advantage: Drastically reduces collisions because waiting stations retry at different times.
- •Disadvantage: Channel may sit completely idle even when stations have frames ready to send.
The Hybrid Approach: -Persistent CSMA
Used on slotted channels to find an optimal mathematical compromise between 1-persistent greed and non-persistent waste:
- The station continuously senses the channel.
- When the channel becomes idle, the station:
- With probability : Transmits immediately.
- With probability : Defers and waits until the beginning of the next slot.
- At the next slot:
- If the line is still idle, it repeats the test (transmits with probability ).
- If the line has become busy (another node transmitted), it treats this as a collision and runs the backoff procedure.
⚡ CSMA/CD Mechanics & Transceiver Energy Sensing
In basic CSMA, once a station begins transmitting, it pumps its entire frame onto the wire regardless of whether a collision happened. If two frames collide in the first , the remaining of transmission time is completely wasted transmitting garbage bits.
CSMA with Collision Detection (CSMA/CD) upgrades the station transceiver to full-duplex operation:
Lifecycle of a frame transmission with active collision detection and backoff
Carrier Sensing
Sense line voltage. If busy, apply 1-persistent wait. If idle, start sending.
Transmit & Listen
Pump frame bits while simultaneously monitoring line energy level.
Jamming Signal
Abort frame immediately and broadcast 32-48 bit jam sequence.
Exponential Backoff
Increment collision counter, compute random backoff slot, and retry.
Transceiver Energy Sensing
How does a network interface card (NIC) know a collision occurred on copper wiring?
- Idle Channel: Line voltage is .
- Normal Transmission: One station transmits; signal amplitude varies within standard limits (e.g. to ).
- Abnormal / Collision Level: Two electrical signals combine constructively and destructively, causing the line voltage and energy level to exceed standard operational limits (roughly doubling the normal voltage amplitude). The physical comparator in the transceiver detects this abnormal threshold and triggers the MAC collision interrupt.
📏 The Golden Minimum Frame Size Derivation ()
This is one of the most critical foundational principles in computer networking.
The Problem
A station only monitors the line for collisions while it is actively transmitting. Once the last bit of a frame exits the transmitter, the station tears down its transmission state, clears its buffer, and assumes the frame was delivered successfully!
If a collision occurs but the returning collision notification reaches the sender after it has finished transmitting its entire frame, the sender will never know its frame was destroyed, resulting in silent packet loss!
The Worst-Case Scenario Analysis
Consider two stations, and , separated by the maximum cable distance in the network. The one-way propagation delay between them is .
Station A must remain actively transmitting until the returning collision signal arrives at t = 2·Tp
Station A senses the wire idle at t = 0 and begins transmitting Frame A. The electrical wavefront propagates down the copper cable toward Station B.
- At time , Station begins transmitting.
- At time (an infinitesimal instant before 's signal reaches ), Station senses the line. Since 's signal has not yet arrived, senses idle and begins transmitting.
- A collision occurs immediately at Station .
- The distorted collision signal requires another full propagation delay () to travel all the way back across the cable from to .
- The collision noise finally arrives at Station at time:
The Formal Constraint
For Station to detect the collision, Station must still be actively transmitting when the collision signal arrives at . Therefore, the frame transmission time () must be greater than or equal to twice the propagation delay:
Recall that , where is frame length in bits and is bandwidth in bps, and .
Substituting:
Why Traditional Ethernet Frames Are At Least 64 Bytes (512 bits): In the original Standard Ethernet (), maximum collision domain length with repeaters was , yielding a worst-case round-trip propagation delay () of . If a payload is smaller than 46 bytes, Ethernet hardware forcibly injects padding bytes to pad the frame to 64 bytes specifically to satisfy this physical condition!
🎲 Binary Exponential Backoff Algorithm Internals
When a collision is detected, stations abort transmission, send a Jamming Signal (to ensure all nodes register the collision), and execute the Truncated Binary Exponential Backoff (BEB) algorithm to schedule retransmission.
The Algorithm Rules
Let denote the number of consecutive collisions experienced by a given frame ().
- Set the contention parameter .
- Pick a random integer uniformly from the discrete set:
- Compute the Backoff Wait Time (): where (512 bit times in standard Ethernet).
- After waiting , the station attempts to retransmit the frame.
- Abort Condition: If the frame suffers consecutive collisions, the station declares an unrecoverable link error, aborts transmission, and reports network failure to higher layers.
Contention Window Growth Table
| Collision Number () | Window Exponent | Contention Range () | Number of Possible Choices () |
|---|---|---|---|
| 1st Collision | 1 | 2 choices | |
| 2nd Collision | 2 | 4 choices | |
| 3rd Collision | 3 | 8 choices | |
| 4th Collision | 4 | 16 choices | |
| 5th Collision | 5 | 32 choices | |
| 10th Collision | 10 | 1,024 choices | |
| 11th to 15th | 10 (capped) | 1,024 choices (fixed) | |
| 16th Collision | — | ABORT (Drop Frame & Report Error) | — |
Why Exponential Doubling?
- Under light network load, collisions are rare. Choosing from ensures colliding stations retransmit almost immediately without unnecessary delay.
- Under heavy network congestion, many stations are contending. Doubling the window with each collision rapidly spreads the contending stations across a wider time horizon, preventing repeated collision avalanches.
📈 CSMA/CD Channel Efficiency & Parameter ''
Channel efficiency () in CSMA/CD depends fundamentally on the dimensionless parameter:
The theoretical channel efficiency is derived as:
The Engineering Implications of Parameter ''
- When (): (transmission time is huge compared to propagation delay). Frames are large, or cable lengths are short. The instant a transmission begins, its wavefront covers the entire cable before other stations attempt to transmit, yielding near-perfect channel utilization.
- When increases ( drops): is large compared to . As link speeds jumped from to to , shrank proportionally. To keep reasonably small at Gigabit speeds without blowing up minimum frame sizes, networks had to abandon shared-bus CSMA/CD and transition to Full-Duplex Switched Ethernet.
📶 Why Collision Detection Fails in Wireless (CSMA/CA)
While CSMA/CD works brilliantly on guided copper cables, it cannot be implemented on wireless LANs (Wi-Fi / IEEE 802.11) for two fundamental physical reasons:
- Massive Transmit/Receive Power Disparity (Dynamic Range Problem): In wireless radio, radiated signal power attenuates rapidly with distance according to the inverse-square law ( or ). When a wireless NIC transmits, its own local antenna radiates at, say, (). A distant frame arriving from across the room might reach the antenna at (). The local transmitter completely deafens its own receiver; detecting a remote collision over the roar of its own broadcast is practically impossible.
- Hidden Terminal Problem: Node can hear Node , and Node can hear Node , but and are out of radio range of each other (hidden by distance or a concrete wall). If and both sense the channel, both detect silence, and both transmit to simultaneously. A collision occurs at , yet neither nor can detect it!
Therefore, wireless networks use CSMA with Collision Avoidance (CSMA/CA) using Interframe Spaces (IFS), Random Contention Windows, Receiver ACKs, and optional RTS/CTS (Request to Send / Clear to Send) handshakes.
🏭 Real-World Production Context: How Automotive CAN Bus & DOCSIS Adapted CSMA
Although classic Ethernet bus architectures transitioned to full-duplex switches, the foundational principles of CSMA and collision resolution remain critical in mission-critical embedded systems and telecommunications:
1. Automotive Controller Area Network (CAN Bus & CSMA/CR)
Modern automobiles contain over 70 Electronic Control Units (ECUs) managing engine timing, anti-lock braking (ABS), steering, and infotainment over a single shared two-wire differential bus (CAN Bus).
- The High-Stakes Dilemma: In an automobile, an ABS brake trigger cannot afford randomized exponential backoff delays. If the brake ECU collides with a stereo volume adjustment, waiting could be fatal.
- The Solution — Non-Destructive Bitwise Arbitration (CSMA/CR):
CAN bus uses Carrier Sense Multiple Access with Collision Resolution. Bit
0is configured as Dominant (driven voltage) and bit1as Recessive (passive resistor pull). Every message begins with an identifier indicating its priority (lower numerical ID = higher priority). Nodes transmit their ID bit-by-bit while simultaneously reading the bus voltage. If an ECU transmits a recessive1but reads back a dominant0, it realizes a higher-priority message is sharing the wire, immediately yields without corrupting the message, and becomes a receiver. The highest-priority safety message proceeds through the bus without a single microsecond of delay or packet destruction!
2. Cable Broadband Internet (DOCSIS Contention Slots)
Your home coaxial cable internet (DOCSIS standard) connects thousands of suburban subscribers over a shared coaxial trunk to the Cable Modem Termination System (CMTS) at the ISP headend.
- Downstream data from ISP to homes is purely scheduled (TDM broadcast).
- Upstream data from homes to the ISP is divided into discrete minislots. When your cable modem has upstream packets to send, it uses a Slotted Contention Window with Exponential Backoff to request dedicated bandwidth slots from the CMTS. Once the request succeeds, the CMTS grants scheduled collision-free timeslots for the actual data transmission.
📐 Numerical Applications & Worked Examples
Example 1: Calculating Minimum Frame Size
Problem Statement: A broadcast network using CSMA/CD operates at a transmission bandwidth of (). The maximum signal propagation time between any pair of nodes is . Determine the minimum size of a frame (in bytes) required for proper collision detection.
Step-by-Step Solution:
- Given Parameters:
- Bandwidth
- Maximum propagation delay
- Apply CSMA/CD Minimum Frame Size Condition:
- Compute Frame Length in Bits:
- Convert to Bytes:
Example 2: Determining Signal Propagation Speed
Problem Statement: Consider a CSMA/CD network transmitting at () over a cable without repeaters. If the network standard dictates a minimum frame size of , calculate the signal propagation velocity in the cable (in ).
Step-by-Step Solution:
- Identify Frame Size in Bits:
- Compute Transmission Time ():
- Relate to via CSMA/CD Constraint:
- Calculate Velocity (): (In : .)
Example 3: Backoff Race Probability Between Two Stations
Problem Statement: Stations and are the only two nodes on a shared Ethernet bus. Both attempt to transmit a frame simultaneously, collide, and execute Binary Exponential Backoff. Station wins the first backoff race and transmits successfully. Immediately upon completion of 's frame, both and attempt to transmit their next frames and collide again. Calculate the probability that Station wins the second backoff race.
Step-by-Step Solution:
- Analyze Collision Counts for Both Stations at the Second Collision:
- Station succeeded on its prior attempt, so its collision counter reset to 0. For this new frame, this collision is its 1st collision ().
- Station 's contention range: .
- Station 's original frame has now suffered its 2nd consecutive collision ().
- Station 's contention range: .
- Station succeeded on its prior attempt, so its collision counter reset to 0. For this new frame, this collision is its 1st collision ().
- List All Possible Outcome Pairs : Since chooses independently from 2 options and chooses from 4 options, there are equally likely outcomes:
- Identify Winning Condition for Station :
Station wins the backoff race if and only if its chosen backoff multiplier is strictly smaller than 's ():
- If : wins if 3 winning pairs: .
- If : wins if 2 winning pairs: .
- Calculate Total Probability: (Note: This asymmetric advantage illustrates the "Capture Effect" in Ethernet, where a recently successful station with a smaller backoff window tends to dominate the channel over an unlucky colliding station.)
Example 4: Gigabit Ethernet Frame Size Constraint
Problem Statement: A Gigabit Ethernet network () is deployed over a copper cable with a signal velocity of . The maximum cable segment between any two stations is . Calculate the minimum frame size required to maintain CSMA/CD collision detection.
Step-by-Step Solution:
- Calculate Propagation Delay ():
- Apply :
- Convert to Bytes:
🎯 Exam & Interview Pitfall Check
- Why does the minimum frame size formula include a factor of 2 ( instead of just )? Because of the worst-case round-trip travel time. If station transmits at , its signal takes to reach station at the far end of the cable. If begins transmitting just before 's wavefront arrives, the resulting collision signal takes an additional to travel back from to . Thus, only detects the collision at time . must still be transmitting when that collision arrives.
- What is the Ethernet "Capture Effect"? When two stations contend for an Ethernet bus, the station that successfully transmits a frame resets its backoff counter to (window ), while the losing station increments its counter to (window ). On subsequent contentions, the successful station has a statistical probability advantage (), repeatedly "capturing" the channel while starving the other node.
- Trap: Confusing bits and bytes in calculations. The formula produces the frame size in bits (since is in bits/second). Always remember to divide by 8 when an interview or semester question asks for the answer in bytes.
- Trap: Believing CSMA/CD is used in modern Gigabit and 10-Gigabit Ethernet. While Gigabit Ethernet standards defined "Carrier Extension" to allow CSMA/CD with 512-byte minimum frames, virtually 100% of modern Ethernet deployments use full-duplex switched connections (dedicated point-to-point links to a switch). With dedicated pairs for Tx and Rx, collisions are physically impossible, making CSMA/CD completely inactive in modern wired networks!