4.3.6Computer Networks

Wi-Fi (IEEE 802.11) — CSMA - CA, bands

2,549 words12 min readdifficulty · medium

WHY does Wi-Fi need a special MAC protocol?

WHY can't Wi-Fi just use Ethernet's CSMA/CD?

  • CSMA/CD = "listen while you talk; if you hear a collision, stop." This needs the sender to simultaneously transmit and receive.
  • A Wi-Fi radio transmitting at, say, full power cannot simultaneously sense a faint colliding signal from a distant station — its own transmitter saturates its receiver. So collision detection is impossible in the air.
  • Worse, there's the hidden terminal problem (below): two stations may collide at the receiver while being unable to hear each other at all.

So Wi-Fi's answer: avoid collisions by waiting, sensing, and using random backoff + (optional) handshakes.


HOW CSMA/CA works — derived step by step

Step 1 — Carrier Sense (two kinds)

  • Physical CS: measure energy on the channel. Busy → defer.
  • Virtual CS: every frame header announces a Duration field. Others set a timer called the NAV (Network Allocation Vector) = "channel busy until time T, don't even bother sensing." Saves power and handles hidden terminals.

Step 2 — Interframe Spaces (IFS): priority by waiting time

After the channel goes idle, you must wait a gap before doing anything. Shorter wait = higher priority.

IFS Length Used for
SIFS shortest ACKs, CTS — replies that must win
DIFS longest (data) normal data before backoff

Step 3 — Random Backoff (the collision avoider)

After waiting DIFS, the station picks a random backoff counter: backoff=Random(0,  CW)×slotTime\text{backoff} = \text{Random}(0,\; CW) \times \text{slotTime} where CWCW is the contention window. The counter decrements only while the channel is idle, and freezes when the channel goes busy. When it hits 0 → transmit.

Step 4 — ACK & Exponential Backoff

  • Sender transmits, then waits SIFS; receiver sends an ACK.
  • No ACK ⇒ assume collision/loss. Retransmit, but first double the contention window (binary exponential backoff): CWnew=min(2(CWold+1)1,  CWmax)CW_{\text{new}} = \min\big(2\cdot(CW_{\text{old}}+1)-1,\; CW_{\max}\big) Doubling CWCW spreads out retries when the network is congested.

Step 5 (optional) — RTS/CTS handshake (solves hidden terminal)

Fix: before a big frame, sender sends a tiny RTS (Request To Send); AP replies with CTS (Clear To Send). Everyone who hears either RTS or CTS sets their NAV and stays quiet. Now even hidden C hears the CTS and backs off.

Figure — Wi-Fi (IEEE 802.11) — CSMA - CA, bands

The Bands — WHERE Wi-Fi lives

Band Range (approx) Wi-Fi gens Trade-off
2.4 GHz 2.400–2.4835 GHz b/g/n, ax Long range, better wall penetration, but crowded & slow
5 GHz ~5.15–5.85 GHz a/n/ac/ax More channels, faster, shorter range
6 GHz ~5.925–7.125 GHz Wi-Fi 6E / 7 Huge clean spectrum, least range

Worked Examples


Common Mistakes (Steel-manned)


Active Recall

Recall Quick self-test (cover the answers!)
  • Why CA not CD in Wi-Fi? → can't detect collisions while transmitting (half-duplex radio).
  • What proves a frame arrived? → the ACK after SIFS.
  • Why freeze the backoff counter instead of resetting? → fairness / keep your place in line.
  • What solves the hidden terminal problem? → RTS/CTS + NAV.
  • Why does 2.4 GHz reach farther than 5 GHz? → longer wavelength penetrates/diffracts better.
Recall Feynman: explain to a 12-year-old

Imagine a group of kids in a totally dark room who all want to talk, but no one can hear themselves while shouting. So they make rules: listen first; if it's quiet, count silently to a random number; whoever finishes counting first talks. If someone else starts talking, you pause your counting and continue later (so you don't lose your turn). After you speak, the listener must say "got it!" — that's the only way you know your words weren't garbled by someone else talking at the same moment. Some kids are too far to hear each other but stand near the same teacher, so before talking they shout "may I?" and the teacher shouts "yes, everyone else be quiet!" — that's RTS/CTS. Low-pitched voices (2.4 GHz) carry through walls; high-pitched voices (5 GHz) are clearer but get muffled.


Flashcards

Why does Wi-Fi use CSMA/CA instead of CSMA/CD?
A radio is half-duplex and can't sense collisions while transmitting; hidden terminals make detection impossible, so it avoids collisions instead.
What is the NAV in 802.11?
Network Allocation Vector — a virtual-carrier-sense timer set from a frame's Duration field, telling a station the channel is busy until time T.
What is the role of SIFS vs DIFS?
SIFS is the shortest gap (for ACK/CTS so replies win); DIFS is the longer gap a station waits before data + backoff.
How does a station pick its backoff?
Random(0, CW) × slotTime; it counts down only on idle slots and freezes when busy.
What happens to CW after a collision (no ACK)?
It doubles via binary exponential backoff: CW_new = min(2(CW_old+1)−1, CW_max).
Why freeze the backoff counter instead of resetting it?
To keep fairness — a station that waited longer keeps its earlier position in line.
What proves a unicast frame was received in Wi-Fi?
An ACK sent SIFS after the data; no ACK ⇒ assume collision/loss ⇒ retransmit.
What is the hidden terminal problem?
Two stations can each reach the AP but not each other, so both sense idle and collide at the AP.
How does RTS/CTS solve hidden terminals?
CTS from the AP is heard by all nearby stations (even hidden ones), who set their NAV and stay quiet.
Why does 2.4 GHz reach farther than 5 GHz?
Longer wavelength diffracts around and penetrates obstacles with less attenuation; 5/6 GHz carry more data but are absorbed more.
How many non-overlapping 20 MHz channels does 2.4 GHz typically have?
Three (channels 1, 6, 11), which is why it's congested.
Which band do Wi-Fi 6E/7 add and why?
6 GHz — lots of clean, uncrowded spectrum for higher throughput at shorter range.

Connections

  • CSMA-CD and Ethernet — wired cousin that detects collisions
  • ALOHA and Slotted ALOHA — ancestors of random-access MAC
  • Hidden and Exposed Terminal Problems
  • Frequency, Wavelength and Attenuation — physics behind band trade-offs
  • MAC Layer and ARQ / ACK — acknowledgements & retransmission
  • Bandwidth vs Throughput

Concept Map

half-duplex broadcast

rules out

forces use of

worsens

step 1

physical

virtual

both must hold

both must hold

then wait

short SIFS

long DIFS

avoid clashes

proves delivery

Shared air medium

Cannot detect collisions

CSMA-CD Ethernet

CSMA-CA

Hidden terminal problem

Carrier Sense

Energy vs threshold

NAV timer

Channel idle

Interframe Spaces

ACK and CTS win

Data then backoff

Random backoff

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, Wi-Fi ka asli problem yeh hai ki sab devices ek hi "hawa" (radio channel) share karte hain, aur ek radio jab khud transmit karta hai to wo apni hi awaaz mein dab jaata hai — yaani transmit karte waqt collision detect nahi kar sakta. Isliye wired Ethernet wala CSMA/CD (collision detect) yahan kaam nahi karta. Wi-Fi ka jugaad hai CSMA/CA — collision ko avoid karo, detect mat karo. Pehle channel sun lo (carrier sense), thoda fixed time ruko (DIFS), phir ek random number count karo (backoff), aur jab 0 pe pahuncho tab bhejo. Random isliye taaki do log ek saath na bol padein, aur agar koi beech mein bolne lage to apna counter freeze kar lo (reset nahi) — taaki fairness bani rahe, tumhari baari na chhine.

Kyunki collision sunai nahi deta, to proof chahiye ki frame pahuncha — isliye receiver ek ACK bhejta hai, wo bhi sabse chhote gap SIFS ke baad, taaki koi naya sender beech mein ghus na sake. Agar ACK nahi aaya, maan lo collision hua: dobara bhejo lekin contention window double karke (exponential backoff), taaki retry log aapas mein phir na takraayein. Ek aur dikkat hai hidden terminal: do device AP ko to sun lete hain par ek dusre ko nahi, isliye dono "khaali hai" samajh ke ek saath bhej dete hain. Iska solution hai RTS/CTS — pehle chhota "may I?" bhejo, AP "haan, baaki sab chup" (CTS) bolta hai jise hidden device bhi sun leta hai aur NAV set karke ruk jaata hai.

Bands ka funda simple hai: 2.4 GHz ki wavelength lambi hoti hai, isliye deewaron ke paar door tak jaati hai — par crowded hai (sirf 3 non-overlapping channels: 1,6,11) aur slow. 5 GHz fast hai, zyada channels, par deewar ke paar weak. 6 GHz (Wi-Fi 6E/7) ekdum khaali aur fast, par range sabse kam. Yaad rakho: "2 walls, 5 speed, 6 spacious." Exam aur real life dono mein yeh range-vs-speed trade-off hi pura khel hai.

Go deeper — visual, from zero

Test yourself — Computer Networks