Medium Access Control Protocols – ALOHA, CSMA/CD and CSMA/CA Explained



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.

The analogy: Think of MAC protocols like traffic rules at an intersection. Without rules, everyone drives through at once and crashes. With a stop sign (CSMA) or traffic lights (TDMA), vehicles take turns safely.

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.

ProtocolHow It WorksUse 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.

Vulnerable period: 2T (a new frame can collide with our frame if it starts within one frame time before or after ours)

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

Intuition: Pure ALOHA wastes up to 81.6% of channel capacity. At maximum efficiency (G = 0.5), for every 100 frames attempted, only 18 are delivered successfully. The rest collide and must be retransmitted.

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.

Vulnerable period: T (only the current slot)

Throughput S = G × e^(–G)

Maximum throughput: S_max = 1/e ≈ 0.368 = 36.8% at G = 1

Slotted ALOHA doubles Pure ALOHA throughput from 18.4% to 36.8% simply by synchronising transmissions to slots. This halves the window of vulnerability from 2T to T.
PropertyPure ALOHASlotted ALOHA
Synchronisation requiredNoYes (global clock)
Vulnerable period2TT
Max throughput1/(2e) ≈ 18.4%1/e ≈ 36.8%
Optimal offered load (G)0.51
ComplexitySimpleNeeds 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

VariantRule When Channel BusyRule When Channel IdleTrade-off
1-persistent CSMAKeep sensing; transmit as soon as idleTransmit immediately (p=1)High collision risk when multiple stations waiting
Non-persistent CSMAWait a random time, then sense againTransmit immediatelyLower collision risk; higher idle time
p-persistent CSMAKeep sensingTransmit 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

  1. Sense: Before transmitting, listen to the channel. If busy, wait.
  2. Transmit: When idle, begin transmitting the frame.
  3. Monitor: While transmitting, continue monitoring the channel for collisions (compare transmitted and received signals).
  4. Collision detected: Stop transmitting immediately. Send a 32-bit jam signal to ensure all stations detect the collision.
  5. Backoff: Wait a random backoff time (binary exponential backoff), then go back to step 1.
Minimum frame size requirement:
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
Why CSMA/CD is not used in Wi-Fi: In wireless networks, a transmitting station cannot simultaneously hear its own signal and other stations’ signals clearly enough to detect collisions (near-far problem, signal strength variation). Wi-Fi uses collision avoidance (CSMA/CA) instead.

Ethernet Frame Structure

FieldSizePurpose
Preamble7 bytesSynchronisation (alternating 10101010 pattern)
SFD (Start Frame Delimiter)1 byteMarks start of frame (10101011)
Destination MAC6 bytesReceiver’s MAC address
Source MAC6 bytesSender’s MAC address
Type/Length2 bytesProtocol type (IPv4, IPv6, ARP) or frame length
Data + Padding46–1500 bytesPayload; padded to minimum 46 bytes if needed
FCS (CRC)4 bytesCRC-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

  1. Sense: Listen for channel activity. If busy, wait until idle.
  2. 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.
  3. Random backoff: Pick a random backoff counter from the contention window. Count down only while the channel stays idle; pause if another station transmits.
  4. Transmit: When backoff reaches zero, transmit the frame.
  5. 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:

  1. Station A sends a short RTS (Request To Send) to AP B, indicating how long it needs
  2. AP B broadcasts a CTS (Clear To Send) — heard by both A and C
  3. Station C hears the CTS and sets a NAV (Network Allocation Vector) timer — stays silent for the duration
  4. Station A transmits safely; B sends ACK after receiving
RTS/CTS trade-off: RTS/CTS adds overhead for small frames. It’s beneficial mainly for large frames where the cost of a collision (retransmitting a big frame) outweighs the overhead of the RTS/CTS handshake. Wi-Fi implementations typically enable RTS/CTS only above a configurable frame size threshold.

Inter-Frame Spaces (IFS)

IFS TypeDurationUsed For
SIFS (Short IFS)ShortestACK, CTS, second fragment of a frame — highest priority
PIFS (PCF IFS)MediumPolling-based (point coordination function) access
DIFS (DCF IFS)LongerNormal data transmission (distributed coordination function)
EIFS (Extended IFS)LongestAfter 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

ProtocolCollisions?Max EfficiencyFairnessReal Use
TDMANo100% (when all busy)PerfectGSM, satellites
FDMANo100% (when all busy)PerfectFM radio, cable
Pure ALOHAYes18.4%Fair (random)Early packet radio
Slotted ALOHAYes36.8%Fair (random)Satellite uplinks
CSMA/CDYes (detected)~80–90% in practiceFair (backoff)Wired Ethernet
CSMA/CAAvoidedLower than CSMA/CDFair (backoff)Wi-Fi (802.11)
Token RingNoHigh under heavy loadGuaranteed turnIndustrial 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.

Leave a Comment