The link layer has two related but distinct jobs. The first one, error detection, assumes you already have the channel. The second one, medium access control, is about getting the channel in the first place. Every shared-medium technology you have ever used (Ethernet on a hub, Wi-Fi, cellular, satellite uplink, even cable internet) lives or dies by its MAC protocol.
What you will learn
- The three families of multiple-access protocols and what each one optimizes for
- How FDMA, TDMA, and CDMA partition a channel without coordination per packet
- The random-access ladder: ALOHA, Slotted ALOHA, CSMA, CSMA/CD, CSMA/CA
- What actually happens on the wire during a collision on classic Ethernet
- The Wi-Fi answer to the hidden-terminal problem (RTS/CTS, virtual carrier sense)
- Binary exponential backoff, with worked numbers
- Interference and jamming, distinguished and dissected
1. The Problem in One Sentence
You have N devices that all want to transmit on one shared channel. Only one transmission can succeed at a time. There is no central scheduler that can hand out turns instantly. How do you keep the channel busy without letting devices step on each other?
Every protocol in this post is one answer to that question. They fall into three broad families.
| Family | Idea | Strength | Weakness | Examples |
|---|---|---|---|---|
| Channel partitioning | Carve the channel into fixed slices (frequency, time, code). Each device owns its slice. | No collisions ever. Predictable per-device bandwidth. | Slices are wasted if the device has nothing to send. Hard to add devices. | FDMA, TDMA, CDMA |
| Random access | Just transmit. Detect or avoid collisions and retry. | Decentralized, scales to many bursty senders, simple. | Collisions waste bandwidth. Worst case is unbounded. | ALOHA, Slotted ALOHA, CSMA, CSMA/CD, CSMA/CA |
| Taking turns | A token or a poller decides who transmits next. | No collisions, fair, fully uses the channel. | Single point of failure, token-pass latency, dead-token recovery is painful. | Token Ring, FDDI, polling on Bluetooth |
This post focuses on the first two families, because they are everywhere. Taking-turns protocols get a brief callout at the end.
2. Channel Partitioning: FDMA, TDMA, CDMA
If you can split the channel ahead of time, you never need to negotiate per packet. Partitioning trades flexibility for predictability.
1 FDMA: Frequency-Division Multiple Access
FDMA splits the spectrum into non-overlapping frequency bands. Each device transmits inside its band continuously, and a receiver tuned to that band hears only that device.
| Property | Value |
|---|---|
| What it splits | Frequency (Hz) |
| Per-device allocation | A continuous sub-band, exclusive |
| Hardware cost | One narrowband transceiver per device, guard bands between users |
| If device is idle | Its sub-band is wasted |
| Classic uses | AM/FM radio stations, analog cellular (AMPS), cable TV channels, ADSL upstream/downstream split, DOCSIS upstream channels |
| Modern relative | OFDMA in 5G NR and Wi-Fi 6, where many narrow subcarriers are dynamically grouped per user |
2 TDMA: Time-Division Multiple Access
TDMA keeps everyone on the same frequency but assigns each device a periodic time slot. During its slot, the device transmits at full power on the full bandwidth. During the other slots, it stays silent.
| Property | Value |
|---|---|
| What it splits | Time (slots in a recurring frame) |
| Per-device allocation | A fixed slot every N slots |
| Hardware cost | Tight clock synchronization across all devices, transmit/receive switching |
| If device is idle | Its slot is wasted (the channel goes silent for that slot) |
| Classic uses | GSM voice (8 slots per 200 kHz carrier), satellite uplink scheduling, DECT cordless, T1/E1 PCM voice trunks, classic Bluetooth slot pattern |
The trade-off between FDMA and TDMA is the same in different units. Either you give each device a slice of frequency forever, or you give each device the whole frequency for a slice of time. The math is symmetric. The hardware differs.
A worked TDMA example
Suppose four devices share a 1 Mbps TDMA channel with 1 ms frames divided into 4 slots of 250 microseconds each.
| Per-device peak rate during slot | Per-device average rate | Channel utilization if all 4 send full-rate | Channel utilization if only device A sends |
|---|---|---|---|
| 1 Mbps | 1 Mbps / 4 = 250 kbps | 100% | 25% (A uses its slot, the other three slots go empty) |
The wasted-when-idle property is exactly what makes pure TDMA bad for bursty traffic. It is great for voice, where every user genuinely talks at a steady rate, and terrible for web browsing, where users go silent for seconds then burst.
3 CDMA: Code-Division Multiple Access
CDMA lets every device transmit at the same time on the same frequency, but multiplies each device's signal by a unique pseudorandom code (a "chip sequence"). When the receiver multiplies the combined signal by a given device's code and integrates, the desired signal adds constructively and the others average out.
The two-user picture in numbers:
| Concept | Example |
|---|---|
| Alice's chip code | (+1, +1, +1, +1, +1, +1, +1, +1) |
| Bob's chip code | (+1, -1, +1, -1, +1, -1, +1, -1) |
| Alice's data bit = 1 sent as | (+1, +1, +1, +1, +1, +1, +1, +1) |
| Bob's data bit = 1 sent as | (+1, -1, +1, -1, +1, -1, +1, -1) |
| Sum on the channel | (+2, 0, +2, 0, +2, 0, +2, 0) |
| Receiver dots with Alice's code | 2 + 0 + 2 + 0 + 2 + 0 + 2 + 0 = 8 (positive, so Alice sent 1) |
| Receiver dots with Bob's code | 2 - 0 + 2 - 0 + 2 - 0 + 2 - 0 = 8 (positive, so Bob sent 1) |
CDMA was the basis of 3G cellular (CDMA2000, UMTS WCDMA). Modern 4G LTE and 5G use OFDMA, but CDMA still shows up inside GPS (the satellites broadcast on the same frequency, distinguished by Gold codes).
3. The Random-Access Family
Partitioning is great when traffic is steady and the device list is fixed. Most networks are not like that. A laptop sends a packet, goes silent for a minute, then sends a burst. A printer transmits once an hour. Pre-assigning slots to such users is a waste.
Random-access protocols let any device transmit whenever it wants, with rules for what to do when two devices transmit at once. They form a clear historical ladder, each step adding a smarter rule than the one before.
1 Pure ALOHA (1971)
The original. When you have a frame, transmit immediately. If the frame is acknowledged, great. If not (a collision corrupted it), wait a random time and retransmit.
How bad is pure ALOHA? Consider a frame of duration T. Your frame collides with any other frame that starts in the window (t - T, t + T), that is, a window of length 2T. Under Poisson traffic at mean load G frames per T, the probability of a collision-free interval of length 2T is e-2G. Channel throughput is therefore S = G · e-2G, which peaks at G = 0.5 giving S = 18.4% of channel capacity. Eighty-one percent of the channel is wasted on collisions and silence.
2 Slotted ALOHA
Force every device to start transmitting only at the beginning of a time slot equal to one frame duration. Now two frames either collide entirely (started in the same slot) or not at all (different slots). The vulnerable window halves from 2T to T. Throughput doubles to S = G · e-G, peak S = 36.8% at G = 1.
| Protocol | Vulnerable window | Peak throughput | What it requires |
|---|---|---|---|
| Pure ALOHA | 2T (any overlap collides) | 0.184 (18.4%) | Nothing beyond a clock for retries |
| Slotted ALOHA | T (same slot collides) | 0.368 (36.8%) | Global slot synchronization |
Doubling throughput is good, but a peak of 37% is still terrible. The problem is that ALOHA does not listen before talking.
3 CSMA: Listen Before You Talk
CSMA stands for Carrier-Sense Multiple Access. The rule is simple: before you transmit, listen to the channel. If you hear another transmission, hold off. If the channel is idle, go.
The natural question is: what exactly do you do when the channel is busy? Three classic variants:
| Variant | If channel is busy | If channel is idle | Behavior summary |
|---|---|---|---|
| 1-persistent (used by Ethernet) | Keep sensing | Transmit immediately with probability 1 | Aggressive. As soon as the channel clears, everyone who was waiting transmits at once and collides. Common in CSMA/CD. |
| Non-persistent | Wait a random time, then sense again | Transmit immediately | Polite. Fewer collisions but more idle time on a lightly loaded channel. |
| p-persistent (slotted channels) | Wait until idle, then transmit with probability p; with probability 1-p, defer to next slot | Transmit with probability p | Compromise. Tune p based on number of contenders. |
Carrier sense by itself helps a lot but does not eliminate collisions. Two devices that decide to transmit at almost the same instant cannot hear each other yet because the signal has not propagated, so both see "idle" and both start. The longer the channel (more propagation delay), the worse this is.
Propagation delay is why CSMA collisions still happen
A 1 Gbps Ethernet bit lasts 1 nanosecond. Light travels about 20 cm in 1 ns in copper. On a 100-meter cable, the propagation delay is about 500 ns, or 500 bit times. A device at one end can start a frame and the device at the other end will sense the channel as idle for the first 500 bit times. Both will transmit. Both will hear the collision a few hundred nanoseconds later.
4. CSMA/CD on Classic Ethernet
Classic 10 Mbps and 100 Mbps Ethernet on a coaxial bus or a hub did CSMA with one critical addition: collision detection. While transmitting, the device keeps listening. If the signal on the wire differs from what it transmitted, that means someone else is also transmitting. Abort, recover, retry. This is the "CD" in CSMA/CD.
The CSMA/CD algorithm, step by step
| Step | Action | Notes |
|---|---|---|
| 1 | Frame ready | Adapter has a frame from the upper layer |
| 2 | Sense channel | If busy, wait until idle, then small inter-frame gap (96 bit times on 10/100 Mbps Ethernet) |
| 3 | Transmit | While transmitting, keep monitoring the line |
| 4a | No collision detected before end of frame | Frame sent successfully. Increment success counter. Done. |
| 4b | Collision detected | Stop transmitting the frame. Send a 32-bit jam signal so every other device on the segment definitely sees the collision. |
| 5 | Increment attempt counter n | If n > 16: give up, signal failure to upper layer (very rare). |
| 6 | Compute backoff | Choose K uniformly at random from {0, 1, …, 2min(n, 10) - 1} |
| 7 | Wait K · 512 bit-times | 512 bit-times = 51.2 µs on 10 Mbps Ethernet (the "slot time") |
| 8 | Go back to step 2 | Try again |
Binary Exponential Backoff in numbers
The backoff window doubles after each collision. Here is what the wait-time distribution looks like, in slot times, as collisions accumulate.
| Attempt n | K range | Wait time range (slot times) | Wait time range on 10 Mbps Ethernet (51.2 µs slot) |
|---|---|---|---|
| 1 (first collision) | {0, 1} | 0 or 1 | 0 or 51.2 µs |
| 2 | {0, 1, 2, 3} | 0 to 3 | 0 to 153.6 µs |
| 3 | {0, …, 7} | 0 to 7 | 0 to 358.4 µs |
| 4 | {0, …, 15} | 0 to 15 | 0 to 768 µs |
| 10 | {0, …, 1023} | 0 to 1023 | 0 to 52.4 ms |
| 11 through 16 | {0, …, 1023} (window stops growing) | 0 to 1023 | 0 to 52.4 ms |
| 17 | Give up. Report failure to upper layer. | ||
The cleverness is in the doubling. Two colliding stations are most likely to draw different K values after a few rounds, so the channel settles. The window growth ensures that under heavy load, the protocol naturally backs off and gives the channel breathing room. Capping at 1023 prevents wait times from exploding under freak collision streaks.
Minimum frame size: why 64 bytes?
CSMA/CD requires that a station still be transmitting when it detects a collision. Otherwise it will have finished and walked away, never knowing the frame was corrupted. The worst case is two stations at opposite ends of the longest legal cable.
| Quantity | 10 Mbps Ethernet value |
|---|---|
| Maximum one-way propagation delay | ~25.6 µs (over 2.5 km of cable plus repeaters) |
| Round-trip propagation delay (slot time) | ~51.2 µs = 512 bit-times |
| Minimum frame size to still be transmitting after one round trip | 512 bits = 64 bytes |
That is why Ethernet frames have a 64-byte minimum (including the 14-byte header and 4-byte FCS, you need at least 46 bytes of payload, padded if necessary). It is a propagation-delay constant baked into the frame format. When Ethernet moved from coax to switches, full duplex made collisions impossible, and the rule became a curiosity that the standard kept for backwards compatibility.
5. CSMA/CA on Wi-Fi
Why doesn't Wi-Fi use CSMA/CD? Two reasons.
- You cannot listen while you transmit on the same frequency. A Wi-Fi radio's own transmission would deafen its receiver. The basic premise of "detect a collision while sending" does not work.
- The hidden-terminal problem. Two stations may both be able to hear the access point but not each other. Each can sense the channel as idle while the other is transmitting. Carrier sense alone is not sufficient.
Wi-Fi's answer is CSMA/CA (Carrier-Sense Multiple Access with Collision Avoidance). It uses three tricks together.
Trick 1: Mandatory ACK and a strict inter-frame spacing
| Symbol | Meaning | Typical 802.11g value |
|---|---|---|
| SIFS | Short Inter-Frame Space. Wait this long before sending an ACK or a CTS. | 10 µs |
| DIFS | Distributed Inter-Frame Space. Wait this long before starting a new transmission. | 28 µs (SIFS + 2 slot times) |
| SlotTime | Backoff slot | 9 µs |
Because SIFS is shorter than DIFS, an ACK always wins the race against a new transmission. After hearing a frame addressed to it, the receiver waits SIFS and sends an ACK; everyone else, who is also waiting to transmit, is still in their DIFS countdown.
If the sender does not receive an ACK in the expected window, it assumes the frame was lost (collided, faded, jammed) and retransmits after a backoff.
Trick 2: Binary exponential backoff, with a contention window
Wi-Fi backoff is similar in spirit to Ethernet's but with different constants and an important refinement: the counter pauses when the channel goes busy, and resumes when it goes idle again. This is fairer than Ethernet's "start fresh after every collision".
| Attempt | CW (contention window) range | Mean backoff at 9 µs/slot |
|---|---|---|
| 1 | 0 to 15 | 67.5 µs |
| 2 | 0 to 31 | 139.5 µs |
| 3 | 0 to 63 | 283.5 µs |
| 4 | 0 to 127 | 571.5 µs |
| 5 | 0 to 255 | 1.148 ms |
| 6 | 0 to 511 | 2.300 ms |
| 7 and on | 0 to 1023 (capped) | 4.604 ms |
Trick 3: RTS/CTS virtual carrier sense (for hidden terminals)
Before sending a large frame, a station can send a tiny RTS (Request To Send). The intended receiver replies with a CTS (Clear To Send). Both frames carry a Duration field saying how long the upcoming exchange will take. Every station that hears either RTS or CTS sets its local NAV (Network Allocation Vector) and stays silent for that duration. This is the "virtual carrier sense" mechanism.
Why it solves hidden terminals: a station that cannot hear the sender can still hear the CTS from the receiver, and it will respect the NAV.
| Event | Sender | Receiver | Hidden station | Other in-range stations |
|---|---|---|---|---|
| 1 | Sends RTS | Hears RTS | (Cannot hear) | Hear RTS, set NAV |
| 2 | Listens | Sends CTS after SIFS | Hears CTS, sets NAV | Hear CTS, update NAV |
| 3 | Sends DATA after SIFS | Receives DATA | Silent (NAV) | Silent (NAV) |
| 4 | Listens | Sends ACK after SIFS | Hears ACK, clears NAV | Clears NAV after duration expires |
RTS/CTS is optional and usually disabled for small frames because it adds overhead. Wi-Fi drivers turn it on for frames above a configurable threshold (often 2347 bytes by default, meaning effectively off).
6. Failed Transmissions, in Detail
A transmission can fail for several different reasons. The link layer's response depends on which kind of failure occurred, but in many protocols the response is "retry with backoff" regardless, because the sender often cannot tell exactly what went wrong.
| Failure mode | What is happening | How sender detects it | Typical response |
|---|---|---|---|
| Collision | Two frames overlap on the wire or in the air | Ethernet: signal mismatch while transmitting. Wi-Fi: no ACK within timeout. | Jam (Ethernet) or just stop, run binary exponential backoff, retry. |
| Bit errors from noise | Random thermal noise, EMI, cable damage flips bits | Receiver CRC fails, no ACK is sent (Wi-Fi); on Ethernet, the corrupted frame is dropped by the receiver and the upper layer eventually notices. | Drop. TCP retransmits at the transport layer. |
| Burst error | A short, intense noise event (microwave oven, switching transient, lightning) | Same as bit errors, but a longer run of bits is corrupted. CRC still catches it (see Part 1). | Drop and retransmit. |
| Interference (unintentional) | Another nearby system using overlapping spectrum (a neighbour's Wi-Fi, a baby monitor, a Bluetooth device) | Repeated ACK timeouts, low SNR reported by the radio | Backoff, retransmit, and at higher layers: rate adaptation (drop to a more robust modulation), channel hopping (Bluetooth FHSS), channel re-selection (Wi-Fi DFS). |
| Jamming (intentional) | An adversary deliberately injects noise or bogus carriers | Persistent high noise floor, no ACKs, carrier sense never clears | Same retry behavior, but it will not succeed. Detection requires looking at spectrum-level metrics, not just the MAC layer. |
| Hidden terminal | Two senders cannot hear each other but both reach the receiver | Wi-Fi: no ACK from receiver because the second sender corrupted the first sender's frame. | Backoff and retry. Enable RTS/CTS for large frames if it keeps happening. |
| Capture effect | Two frames collide but one is much stronger; the stronger one is still decodable | The stronger sender succeeds, the weaker one does not. Looks like a one-sided collision. | The weaker sender retries with backoff. Persistent capture causes unfairness; modern Wi-Fi uses dynamic CW to mitigate. |
7. Interference vs Jamming
These two words are often used interchangeably. They should not be.
| Interference | Jamming | |
|---|---|---|
| Intent | None. A side effect of another system using nearby spectrum. | Deliberate. The interferer's goal is to deny service. |
| Typical source | Microwave oven (2.4 GHz), Bluetooth, neighbour's AP on the same channel, cordless phones, USB 3.0 emissions | An adversary's transmitter, sometimes a software-defined radio |
| Pattern | Bursty, frequency-localized, often predictable (microwave oven on a duty cycle) | Designed to be hard to evade: wideband noise, sweep jammers, reactive jammers that only transmit when they detect a target |
| Defenses | Channel hopping, rate adaptation, channel selection, MIMO beamforming, FEC at the PHY layer | Spread spectrum, directional antennas, spectrum sensing, and ultimately physical-layer authentication. CSMA/CA cannot defeat a determined jammer; it just retries forever. |
The Ethernet jam signal: a friendly use of the word
The word "jam" appears inside Ethernet too, but it means something completely different: when a station detects a collision, it transmits a 32-bit jam signal so that every other station on the shared segment definitely sees a collision and aborts. The Ethernet jam is a cooperative signal, not an attack. It just happens to share a name.
| Field | Length | Purpose |
|---|---|---|
| Jam signal (alternating bits) | 32 bits | Force a definite, machine-detectable collision pattern long enough for every station on the segment to notice. The exact bit pattern is unspecified in the standard; the goal is just to ensure a collision is detected by all parties. |
8. Taking Turns, Briefly
The third family gets a quick callout because it still ships in niche places. Instead of carving the channel or letting devices contend, a single coordinator hands out turns.
| Protocol | Mechanism | Strengths | Where it still appears |
|---|---|---|---|
| Polling | A master device polls each slave: "do you have anything to send?" | No collisions, simple slaves, deterministic latency under steady load | Classic Bluetooth (primary polls secondaries), 802.11 PCF mode, USB low-level transactions |
| Token passing | A special token frame circulates. You can only transmit when you hold it. | No collisions, fair, scales gracefully to high load | Token Ring (IEEE 802.5, mostly dead), FDDI (mostly dead), some industrial fieldbuses (PROFIBUS, ControlNet) |
| Reservation | A contention slot for short reservations, then guaranteed slots for those who reserved | Combines random-access flexibility with conflict-free data slots | DOCSIS upstream scheduling, satellite uplinks (DAMA), some industrial wireless |
9. Side-by-Side Summary
| Protocol | Family | Carrier sense? | Collision response | Used today in |
|---|---|---|---|---|
| FDMA | Partition (frequency) | n/a | Cannot collide | AM/FM radio, cable TV |
| TDMA | Partition (time) | n/a | Cannot collide | GSM voice, T1 trunks |
| CDMA | Partition (code) | n/a | Codes are orthogonal | 3G UMTS, GPS broadcast |
| Pure ALOHA | Random access | No | Random retransmit | RFID, some early IoT |
| Slotted ALOHA | Random access | No | Random retransmit at next slot | Satellite uplink contention, LoRaWAN class A |
| CSMA/CD | Random access + listen + collision detection | Yes | Jam, binary exponential backoff | Historic Ethernet on hubs. Modern switched full-duplex Ethernet does not use it. |
| CSMA/CA | Random access + listen + collision avoidance | Yes | Backoff, retry, optional RTS/CTS | Wi-Fi, Zigbee, some industrial wireless |
| Token passing | Taking turns | n/a | Cannot collide | Industrial fieldbus |
| Polling | Taking turns | n/a | Cannot collide | Classic Bluetooth, USB |
10. The Modern Reality on Wired LANs
You may have noticed that the most-deployed wired LAN technology in the world, switched full-duplex Ethernet, does not use any of these contention protocols in practice. Every device has its own dedicated link to the switch port. The switch buffers and forwards. There is no shared medium.
That is correct, and it is one of the great architectural simplifications of the 1990s. The interesting MAC protocols live on:
- Wi-Fi, because air is inherently shared.
- Cellular, where uplink slots and codes are scheduled by the base station.
- PON access networks (GPON, XGS-PON), where a single fibre is split passively to many homes and the OLT schedules upstream slots.
- Satellite and LoRaWAN, where ALOHA-style contention is still alive.
- RFID and other tag protocols, where Slotted ALOHA is the workhorse.
Takeaways
- Partitioning (FDMA, TDMA, CDMA) gives every device a guaranteed slice. Great for steady traffic, wasteful for bursty traffic.
- Random access (ALOHA family, CSMA/CD, CSMA/CA) lets devices contend. Cheap, scalable, and the wire-line and Wi-Fi world is built on it.
- CSMA/CD on Ethernet uses binary exponential backoff and a 32-bit jam signal. The minimum 64-byte frame size is a direct consequence of collision-detection physics.
- Wi-Fi cannot detect collisions while sending, so CSMA/CA combines mandatory ACKs, SIFS-vs-DIFS priorities, and optional RTS/CTS for hidden terminals.
- Failed transmissions come in many shapes: collision, noise, burst errors, hidden terminals, interference, and jamming. The MAC layer responds the same way (retry with backoff) but the underlying cause matters for how you fix the network.
- Switched full-duplex Ethernet eliminated the shared medium on wired LANs. Shared-medium MAC protocols now live in air, fibre PONs, and satellite.
Next in the Link Layer Series
Part 3 will go inside the MAC frame itself. We will look at MAC addresses (where do they come from, how globally unique are they really, what is the locally-administered bit for, why does multicast have a magic bit), ARP (how IP addresses get mapped to MAC addresses, and how that gets weaponized in ARP spoofing), and switch learning (how a switch's forwarding table gets populated, and how flooding works when it does not know yet).