Medium Access Control Protocols – ALOHA, CSMA/CD and CSMA/CA Explained
What You Will Learn
- Why MAC protocols are needed: the shared channel problem
- Channel partitioning: TDMA, FDMA, CDMA
- Random access: Pure ALOHA, Slotted ALOHA, CSMA, CSMA/CD, CSMA/CA
- Taking turns: Token Ring, Polling
- ALOHA throughput derivation and maximum efficiency
- Ethernet (CSMA/CD) and Wi-Fi (CSMA/CA) in detail
- Hidden station problem and RTS/CTS solution
1. Why MAC Protocols Are Needed
When multiple devices share the same communication medium — a Wi-Fi channel, an Ethernet cable, or a fibre link — they must coordinate who transmits at any given moment. If two devices transmit simultaneously, their signals interfere, causing a collision that garbles both transmissions.
The Medium Access Control (MAC) sub-layer of the Data Link layer solves this coordination problem. It determines the rules by which devices take turns using the shared channel.
MAC protocols fall into three broad categories: channel partitioning (divide the channel among users), random access (anyone can try; handle collisions), and taking turns (controlled, orderly access).
2. Channel Partitioning Protocols
These protocols divide the channel’s capacity among users — each user gets a guaranteed, dedicated slice. No collisions possible, but resources are wasted when a user has nothing to send.
| Protocol | How It Works | Use Today |
|---|---|---|
| TDMA (Time Division Multiple Access) | Time divided into fixed-length frames; each user gets a time slot per frame. If a user has nothing to send, their slot goes unused. | GSM (2G mobile), satellite links |
| FDMA (Frequency Division Multiple Access) | Channel bandwidth divided into frequency bands; each user transmits on their own frequency continuously. | AM/FM radio, cable TV, 3G mobile |
| CDMA (Code Division Multiple Access) | All users share the full bandwidth simultaneously; each is assigned a unique orthogonal code. Receiver uses the code to extract its signal from the mix. | 3G mobile networks, military comms |
| OFDMA (Orthogonal FDM Access) | Channel split into many narrow sub-channels assigned dynamically per user per frame. | 4G LTE, 5G, Wi-Fi 6 |
Main drawback of channel partitioning: If only one user wants to transmit, they can only use their allocated fraction of the channel — the rest is wasted. Random access protocols can achieve higher efficiency when traffic is bursty.
3. ALOHA Protocols
ALOHA was the first random access protocol, developed at the University of Hawaii in 1970 for a packet radio network connecting Hawaiian islands. It introduced the fundamental idea: just transmit when you have data, and deal with collisions after the fact.
Pure ALOHA
A station transmits a frame whenever it has data. If a collision occurs (detected by lack of acknowledgement within a timeout), it waits a random time and retransmits.
Throughput S = G × e^(–2G)
G = offered load (average frames transmitted per frame time)
S = successfully delivered frames per frame time
Maximum throughput: S_max = 1/(2e) ≈ 0.184 = 18.4% at G = 0.5
Slotted ALOHA
Stations are synchronised to time slots of exactly one frame duration. A station can only begin transmitting at the start of a slot. This halves the vulnerable period — a new frame only collides with frames from the same slot.
Throughput S = G × e^(–G)
Maximum throughput: S_max = 1/e ≈ 0.368 = 36.8% at G = 1
| Property | Pure ALOHA | Slotted ALOHA |
|---|---|---|
| Synchronisation required | No | Yes (global clock) |
| Vulnerable period | 2T | T |
| Max throughput | 1/(2e) ≈ 18.4% | 1/e ≈ 36.8% |
| Optimal offered load (G) | 0.5 | 1 |
| Complexity | Simple | Needs synchronisation |
4. CSMA – Carrier Sense Multiple Access
CSMA improves on ALOHA with a simple rule: listen before you talk. Before transmitting, a station first senses whether the channel is idle or busy.
CSMA Persistence Variants
| Variant | Rule When Channel Busy | Rule When Channel Idle | Trade-off |
|---|---|---|---|
| 1-persistent CSMA | Keep sensing; transmit as soon as idle | Transmit immediately (p=1) | High collision risk when multiple stations waiting |
| Non-persistent CSMA | Wait a random time, then sense again | Transmit immediately | Lower collision risk; higher idle time |
| p-persistent CSMA | Keep sensing | Transmit with probability p; defer with probability (1-p) | Balance between the two above |
Why collisions still happen in CSMA: Due to propagation delay, a station may sense the channel idle and begin transmitting, while another station’s signal (sent a moment earlier) hasn’t arrived yet. The two signals collide in transit. The longer the cable, the higher the probability of this happening.
5. CSMA/CD – Ethernet
CSMA with Collision Detection is the MAC protocol used in wired Ethernet networks (IEEE 802.3). It adds active collision detection during transmission, allowing faster recovery.
How CSMA/CD Works
- Sense: Before transmitting, listen to the channel. If busy, wait.
- Transmit: When idle, begin transmitting the frame.
- Monitor: While transmitting, continue monitoring the channel for collisions (compare transmitted and received signals).
- Collision detected: Stop transmitting immediately. Send a 32-bit jam signal to ensure all stations detect the collision.
- Backoff: Wait a random backoff time (binary exponential backoff), then go back to step 1.
A station must transmit long enough to detect any possible collision.
Worst case: collision at the far end of the cable (after 2×propagation delay)
Minimum frame transmission time ≥ 2 × Propagation delay
Min frame size = Bandwidth × 2 × Propagation delay
For 10 Mbps Ethernet (500m, propagation speed ≈ 2×10⁸ m/s):
Tp = 500 / (2×10⁸) = 2.5 μs → 2Tp = 5 μs
Min frame = 10 Mbps × 5 μs = 50 bits → rounded up to 64 bytes (512 bits)
Binary Exponential Backoff
After each collision, the waiting time is chosen randomly from an increasing range:
- 1st collision: wait 0 or 1 slot time (random from {0, 1})
- 2nd collision: wait 0–3 slot times (random from {0, 1, 2, 3})
- kth collision: wait 0 to 2^k – 1 slot times (k capped at 10)
- After 16 collisions: frame dropped, error reported
Ethernet Frame Structure
| Field | Size | Purpose |
|---|---|---|
| Preamble | 7 bytes | Synchronisation (alternating 10101010 pattern) |
| SFD (Start Frame Delimiter) | 1 byte | Marks start of frame (10101011) |
| Destination MAC | 6 bytes | Receiver’s MAC address |
| Source MAC | 6 bytes | Sender’s MAC address |
| Type/Length | 2 bytes | Protocol type (IPv4, IPv6, ARP) or frame length |
| Data + Padding | 46–1500 bytes | Payload; padded to minimum 46 bytes if needed |
| FCS (CRC) | 4 bytes | CRC-32 error detection |
6. CSMA/CA – Wi-Fi (IEEE 802.11)
CSMA with Collision Avoidance is the MAC protocol for Wi-Fi networks. Since collision detection is impractical in wireless, Wi-Fi tries to avoid collisions before they happen.
How CSMA/CA Works
- Sense: Listen for channel activity. If busy, wait until idle.
- DIFS wait: Wait for a DIFS (Distributed Inter-Frame Space) period after the channel becomes idle — a mandatory wait ensuring the medium is truly idle.
- Random backoff: Pick a random backoff counter from the contention window. Count down only while the channel stays idle; pause if another station transmits.
- Transmit: When backoff reaches zero, transmit the frame.
- Wait for ACK: Unlike Ethernet, Wi-Fi requires explicit ACK. If no ACK received within SIFS (Short IFS) + ACK timeout, assume collision/error and retransmit (with exponential backoff).
Hidden Station Problem and RTS/CTS
In wireless networks, not all stations can hear each other. Station A and Station C may both be in range of Access Point B, but out of range of each other — A is “hidden” from C. If both sense the channel as idle (because they can’t hear each other) and transmit simultaneously, they collide at B.
Solution — RTS/CTS handshake:
- Station A sends a short RTS (Request To Send) to AP B, indicating how long it needs
- AP B broadcasts a CTS (Clear To Send) — heard by both A and C
- Station C hears the CTS and sets a NAV (Network Allocation Vector) timer — stays silent for the duration
- Station A transmits safely; B sends ACK after receiving
Inter-Frame Spaces (IFS)
| IFS Type | Duration | Used For |
|---|---|---|
| SIFS (Short IFS) | Shortest | ACK, CTS, second fragment of a frame — highest priority |
| PIFS (PCF IFS) | Medium | Polling-based (point coordination function) access |
| DIFS (DCF IFS) | Longer | Normal data transmission (distributed coordination function) |
| EIFS (Extended IFS) | Longest | After a corrupted frame — lowest priority, extra caution |
7. Taking Turns Protocols
Taking turns protocols combine the collision-free nature of channel partitioning with the efficiency of random access. Each station gets to use the full channel capacity when it’s their turn, and idle stations are skipped.
Token Ring (Token Passing)
Stations are arranged in a logical ring. A special frame called a token circulates around the ring. A station can only transmit when it holds the token. After transmitting (or if it has nothing to send), it passes the token to the next station.
- Advantages: No collisions; bounded worst-case wait time; fair (every station gets a turn)
- Disadvantages: Token loss or a station failure can break the ring; overhead of token management
- Was used in: IEEE 802.5 Token Ring networks (largely obsolete, replaced by Ethernet)
Polling
A master (primary) station polls each slave (secondary) station in turn, asking if it has data to transmit. The slave responds with data if it has any, or a “nothing to send” response.
- Advantage: Simple, collision-free, master has full control
- Disadvantage: Polling overhead; if master fails, entire system fails; latency for stations far down the polling list
- Used in: Bluetooth (master-slave), some industrial control networks
8. MAC Protocol Comparison
| Protocol | Collisions? | Max Efficiency | Fairness | Real Use |
|---|---|---|---|---|
| TDMA | No | 100% (when all busy) | Perfect | GSM, satellites |
| FDMA | No | 100% (when all busy) | Perfect | FM radio, cable |
| Pure ALOHA | Yes | 18.4% | Fair (random) | Early packet radio |
| Slotted ALOHA | Yes | 36.8% | Fair (random) | Satellite uplinks |
| CSMA/CD | Yes (detected) | ~80–90% in practice | Fair (backoff) | Wired Ethernet |
| CSMA/CA | Avoided | Lower than CSMA/CD | Fair (backoff) | Wi-Fi (802.11) |
| Token Ring | No | High under heavy load | Guaranteed turn | Industrial networks |
9. Common Misconceptions
- “CSMA/CA avoids all collisions”: CSMA/CA significantly reduces collisions but does not eliminate them. Two stations can still pick the same backoff value and collide. It avoids the most obvious collisions (transmitting while channel is busy) but cannot prevent all simultaneous transmissions.
- “Slotted ALOHA is always better than Pure ALOHA”: Slotted ALOHA has higher maximum throughput (36.8% vs 18.4%), but it requires all stations to be synchronised to a common clock — which adds complexity and may not be feasible in all scenarios. Pure ALOHA is simpler and requires no synchronisation.
- “CSMA/CD is used in modern Ethernet”: Modern Ethernet (Gigabit and beyond) uses full-duplex links with switches. In full-duplex, there are no shared channels — each device has a dedicated link to the switch. Collisions cannot happen, so CSMA/CD is not used. CSMA/CD only applies to half-duplex shared Ethernet (legacy).
- “MAC address is permanent”: While MAC addresses are burned into hardware by the manufacturer, they can be spoofed or changed in software on most operating systems. Modern OSes often randomise MAC addresses for privacy when scanning for Wi-Fi networks.
- “The hidden station problem only affects old Wi-Fi”: The hidden station problem is an inherent limitation of any wireless network where nodes have limited transmission range. It exists in all 802.11 standards (a/b/g/n/ac/ax). RTS/CTS mitigates it but adds overhead, so it’s not always enabled by default.
10. Frequently Asked Questions
What is the difference between CSMA/CD and CSMA/CA?
CSMA/CD (Collision Detection) is used in wired Ethernet — it detects collisions during transmission and immediately stops, then uses exponential backoff before retrying. Collision detection works in wired networks because transmitted and received signals are distinguishable. CSMA/CA (Collision Avoidance) is used in Wi-Fi — it avoids collisions by sensing the channel, waiting a mandatory idle period (DIFS), then waiting a random backoff time before transmitting. Wi-Fi also uses ACKs for every frame and RTS/CTS for large frames to handle the hidden station problem.
What is the maximum throughput of Pure ALOHA and Slotted ALOHA?
Pure ALOHA maximum throughput = 1/(2e) ≈ 18.4% at offered load G = 0.5. Slotted ALOHA maximum throughput = 1/e ≈ 36.8% at G = 1. Slotted ALOHA doubles the efficiency by confining transmissions to time slots, which halves the collision vulnerable period from 2T (Pure ALOHA) to T (Slotted ALOHA). Both protocols achieve their maximum throughput at specific offered loads — exceeding the optimal load causes more collisions and drops actual throughput.
What is the hidden station problem in wireless networks?
The hidden station problem occurs when two wireless stations (A and C) are both in range of an access point (B) but out of range of each other. Both sense the channel as idle (they can’t hear each other) and transmit simultaneously, causing a collision at B. The solution is RTS/CTS: station A sends RTS to B; B broadcasts CTS (heard by both A and C); C sets a timer and stays silent while A transmits, preventing the collision.
How does binary exponential backoff work in CSMA/CD?
After each collision, the station waits a random number of slot times before retrying. The range doubles after each collision: 1st collision → wait 0–1 slots; 2nd → 0–3 slots; kth → 0 to (2^k – 1) slots (k capped at 10). After 16 collisions, the frame is dropped. This spreading-out of retransmission times progressively reduces collision probability when many stations are competing, adapting the backoff to the observed network congestion level.