Sharing the Link: How Devices Agree to Take Turns

Link Layer · Part 2

Part 1 covered CRC error detection. This post tackles the next big link-layer problem: when many devices share a single channel (a copper bus, a chunk of radio spectrum, a fibre with passive splitters), who gets to talk, when, and what happens when two of them talk at once?

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.

PropertyValue
What it splitsFrequency (Hz)
Per-device allocationA continuous sub-band, exclusive
Hardware costOne narrowband transceiver per device, guard bands between users
If device is idleIts sub-band is wasted
Classic usesAM/FM radio stations, analog cellular (AMPS), cable TV channels, ADSL upstream/downstream split, DOCSIS upstream channels
Modern relativeOFDMA 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.

PropertyValue
What it splitsTime (slots in a recurring frame)
Per-device allocationA fixed slot every N slots
Hardware costTight clock synchronization across all devices, transmit/receive switching
If device is idleIts slot is wasted (the channel goes silent for that slot)
Classic usesGSM 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:

ConceptExample
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 code2 + 0 + 2 + 0 + 2 + 0 + 2 + 0 = 8 (positive, so Alice sent 1)
Receiver dots with Bob's code2 - 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.

ProtocolVulnerable windowPeak throughputWhat it requires
Pure ALOHA2T (any overlap collides)0.184 (18.4%)Nothing beyond a clock for retries
Slotted ALOHAT (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:

VariantIf channel is busyIf channel is idleBehavior summary
1-persistent (used by Ethernet)Keep sensingTransmit immediately with probability 1Aggressive. As soon as the channel clears, everyone who was waiting transmits at once and collides. Common in CSMA/CD.
Non-persistentWait a random time, then sense againTransmit immediatelyPolite. 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 slotTransmit with probability pCompromise. 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

StepActionNotes
1Frame readyAdapter has a frame from the upper layer
2Sense channelIf busy, wait until idle, then small inter-frame gap (96 bit times on 10/100 Mbps Ethernet)
3TransmitWhile transmitting, keep monitoring the line
4aNo collision detected before end of frameFrame sent successfully. Increment success counter. Done.
4bCollision detectedStop transmitting the frame. Send a 32-bit jam signal so every other device on the segment definitely sees the collision.
5Increment attempt counter nIf n > 16: give up, signal failure to upper layer (very rare).
6Compute backoffChoose K uniformly at random from {0, 1, …, 2min(n, 10) - 1}
7Wait K · 512 bit-times512 bit-times = 51.2 µs on 10 Mbps Ethernet (the "slot time")
8Go back to step 2Try 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 nK rangeWait time range (slot times)Wait time range on 10 Mbps Ethernet (51.2 µs slot)
1 (first collision){0, 1}0 or 10 or 51.2 µs
2{0, 1, 2, 3}0 to 30 to 153.6 µs
3{0, …, 7}0 to 70 to 358.4 µs
4{0, …, 15}0 to 150 to 768 µs
10{0, …, 1023}0 to 10230 to 52.4 ms
11 through 16{0, …, 1023} (window stops growing)0 to 10230 to 52.4 ms
17Give 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.

Quantity10 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 trip512 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.

  1. 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.
  2. 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

SymbolMeaningTypical 802.11g value
SIFSShort Inter-Frame Space. Wait this long before sending an ACK or a CTS.10 µs
DIFSDistributed Inter-Frame Space. Wait this long before starting a new transmission.28 µs (SIFS + 2 slot times)
SlotTimeBackoff slot9 µ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".

AttemptCW (contention window) rangeMean backoff at 9 µs/slot
10 to 1567.5 µs
20 to 31139.5 µs
30 to 63283.5 µs
40 to 127571.5 µs
50 to 2551.148 ms
60 to 5112.300 ms
7 and on0 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.

EventSenderReceiverHidden stationOther in-range stations
1Sends RTSHears RTS(Cannot hear)Hear RTS, set NAV
2ListensSends CTS after SIFSHears CTS, sets NAVHear CTS, update NAV
3Sends DATA after SIFSReceives DATASilent (NAV)Silent (NAV)
4ListensSends ACK after SIFSHears ACK, clears NAVClears 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 modeWhat is happeningHow sender detects itTypical response
CollisionTwo frames overlap on the wire or in the airEthernet: signal mismatch while transmitting. Wi-Fi: no ACK within timeout.Jam (Ethernet) or just stop, run binary exponential backoff, retry.
Bit errors from noiseRandom thermal noise, EMI, cable damage flips bitsReceiver 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 errorA 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 radioBackoff, 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 carriersPersistent high noise floor, no ACKs, carrier sense never clearsSame retry behavior, but it will not succeed. Detection requires looking at spectrum-level metrics, not just the MAC layer.
Hidden terminalTwo senders cannot hear each other but both reach the receiverWi-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 effectTwo frames collide but one is much stronger; the stronger one is still decodableThe 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.

 InterferenceJamming
IntentNone. A side effect of another system using nearby spectrum.Deliberate. The interferer's goal is to deny service.
Typical sourceMicrowave oven (2.4 GHz), Bluetooth, neighbour's AP on the same channel, cordless phones, USB 3.0 emissionsAn adversary's transmitter, sometimes a software-defined radio
PatternBursty, 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
DefensesChannel hopping, rate adaptation, channel selection, MIMO beamforming, FEC at the PHY layerSpread 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.

FieldLengthPurpose
Jam signal (alternating bits)32 bitsForce 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.

ProtocolMechanismStrengthsWhere it still appears
PollingA master device polls each slave: "do you have anything to send?"No collisions, simple slaves, deterministic latency under steady loadClassic Bluetooth (primary polls secondaries), 802.11 PCF mode, USB low-level transactions
Token passingA special token frame circulates. You can only transmit when you hold it.No collisions, fair, scales gracefully to high loadToken Ring (IEEE 802.5, mostly dead), FDDI (mostly dead), some industrial fieldbuses (PROFIBUS, ControlNet)
ReservationA contention slot for short reservations, then guaranteed slots for those who reservedCombines random-access flexibility with conflict-free data slotsDOCSIS upstream scheduling, satellite uplinks (DAMA), some industrial wireless

9. Side-by-Side Summary

Protocol Family Carrier sense? Collision response Used today in
FDMAPartition (frequency)n/aCannot collideAM/FM radio, cable TV
TDMAPartition (time)n/aCannot collideGSM voice, T1 trunks
CDMAPartition (code)n/aCodes are orthogonal3G UMTS, GPS broadcast
Pure ALOHARandom accessNoRandom retransmitRFID, some early IoT
Slotted ALOHARandom accessNoRandom retransmit at next slotSatellite uplink contention, LoRaWAN class A
CSMA/CDRandom access + listen + collision detectionYesJam, binary exponential backoffHistoric Ethernet on hubs. Modern switched full-duplex Ethernet does not use it.
CSMA/CARandom access + listen + collision avoidanceYesBackoff, retry, optional RTS/CTSWi-Fi, Zigbee, some industrial wireless
Token passingTaking turnsn/aCannot collideIndustrial fieldbus
PollingTaking turnsn/aCannot collideClassic 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).

← Back to Blog