Sub topic 8
Sharing the air: CSMA/CA and airtime
This chapter assumes you know what a channel and a channel width are, and that you can tell an access point (AP) from a client. It explains how devices on the same channel take turns, and why that turn-taking limits speed.
One channel, one talker
Wi-Fi uses a shared medium. Every device in range on a channel hears every other device on it. If two devices transmit at the same moment, their signals collide and both frames (units of data sent over the air) are usually lost.
Wired Ethernet detects collisions while it sends. A Wi-Fi radio cannot listen while it transmits, because its own signal drowns out everything else. So Wi-Fi avoids collisions instead of detecting them. The method is called CSMA/CA: Carrier Sense Multiple Access with Collision Avoidance.
How CSMA/CA works
A device that wants to send follows these steps:
- Listen to the channel. If it is idle for a short fixed gap (the interframe space), continue. If it is busy, wait.
- Pick a random backoff: a number of empty time slots to wait before sending.
- Count the slots down, but only while the channel stays idle. If another device starts to transmit, pause the countdown.
- When the count reaches zero, transmit the frame.
- Wait for an acknowledgment (ACK) from the receiver. If none arrives, assume a collision, double the range of the random backoff, and try again.
The random backoff makes it unlikely that two waiting devices start at the same instant. It does not make a collision impossible, which is why the ACK is required.
Hidden nodes and RTS/CTS
Two clients can both be in range of the AP but out of range of each other. Neither hears the other, so each believes the channel is idle. This is the hidden node problem. An optional exchange helps: the sender transmits a short Request to Send (RTS), and the AP answers with a Clear to Send (CTS). Every device that hears the CTS stays quiet for the stated time. RTS/CTS costs airtime, so it is normally used only for large frames.
Airtime is the real currency
Only one device transmits at a time on a channel. The scarce resource is therefore airtime: the time the channel spends carrying your frames. Data rate decides how much data fits into each unit of airtime.
Suppose a frame holds 12,000 bits (1,500 bytes). The time on air is roughly bits divided by rate:
def airtime_ms(frame_bits, rate_mbps):
"""Approximate time on air in milliseconds, ignoring overhead."""
return frame_bits / (rate_mbps * 1_000_000) * 1000
print(airtime_ms(12_000, 300)) # 0.04 ms for a fast client
print(airtime_ms(12_000, 6)) # 2.0 ms for a slow clientThe slow client uses 50 times more airtime for the same data. Every other device waits during those 2 ms. One distant device at a low rate can drag down the whole cell. This is the performance anomaly of mixed-rate networks, and it is a main reason real throughput falls below the headline rate.
Overhead adds to this. Each frame carries a preamble, backoff gaps and an ACK, none of which carry your data. More devices on a channel also means more waiting and more collisions.
Exercise
A client sends a 12,000-bit frame at 6 Mbps and another client sends the same frame at 120 Mbps on the same channel. How many times more airtime does the slow frame use, and why does that matter to the fast client?
Show answer
It uses 20 times more airtime (2 ms against 0.1 ms). The fast client must wait while the slow frame occupies the channel, so its throughput drops even though its own link is fast.