Medium Access Control

Medium Access Control Overview

When several stations share the same broadcast channel — the bus topology of traditional Ethernet, or a wireless LAN — the question of who may use the channel arises. Medium access control (MAC) is the mechanism that answers it.

Medium Access Control

Medium access control is a sublayer of the data link layer. It coordinates the right to use a shared channel among several stations, avoiding or resolving collisions so that the stations can share the channel resource efficiently and fairly.

Medium access control protocols fall into three categories:

  1. Channel partitioning protocols: the channel resource is divided into fixed pieces assigned to each station (FDM, TDM, WDM, CDM)
  2. Random access protocols: stations access the channel at random, collisions may occur, and they are handled by collision detection or avoidance (ALOHA, CSMA/CD, CSMA/CA)
  3. Polling access protocols: access is coordinated through a central controller or token passing (Token Ring, polling)

Channel Partitioning Protocols

Frequency Division Multiplexing (FDM)

The total bandwidth of the channel is split into several non-overlapping sub-bands, and each station permanently occupies one of them for communication. All stations can transmit at the same time without interfering with each other.

  • Advantages: no collisions, and all stations can transmit simultaneously
  • Disadvantages: low channel utilization (a sub-band sits idle while its station is silent), and inflexible (a new station needs a new sub-band)
  • Applications: radio broadcasting, cable television, ADSL

Time Division Multiplexing (TDM)

Time is divided into frames of fixed length, each frame is further divided into slots, and each station permanently occupies one slot. The stations take turns using the full bandwidth of the channel in time order.

  • Advantages: no collisions, and the stations are treated fairly
  • Disadvantages: a slot is wasted while its station is silent, and the scheme is inflexible
  • Applications: E1/T1 digital carriers, ISDN

Wavelength Division Multiplexing (WDM)

In fiber-optic communication, different wavelengths (colors) of light carry different signals, and a prism or diffraction grating multiplexes and demultiplexes them. It is essentially frequency division multiplexing in the optical domain.

  • Applications: fiber-optic backbone networks, where a single fiber can carry dozens or even hundreds of wavelengths simultaneously

Code Division Multiplexing (CDM)

Each station uses a unique chip sequence, and all stations may transmit at the same time using the same frequency. The sender exclusive-ORs the data bits with the chip sequence, and the receiver recovers the original data using the orthogonality of the chip sequences.

  • Advantages: all stations can transmit simultaneously, with strong interference resistance
  • Disadvantages: chip synchronization is required, which makes the implementation complex
  • Applications: 3G mobile communications (CDMA)

Random Access Protocols

The ALOHA Protocol

ALOHA was the earliest random access protocol, proposed by Norman Abramson at the University of Hawaii in 1970.

Pure ALOHA

  • A station transmits immediately when it has data, without listening to the channel
  • If a collision occurs (two or more stations transmit at the same time), all colliding frames are corrupted
  • If the sender receives no acknowledgment within a period of time, it waits for a random interval and then retransmits
  • Channel utilization (throughput): S=G⋅e−2GS = G \cdot e^{-2G}, with a maximum of about 18.4% (when G=0.5G=0.5)

Here GG is the total number of frames transmitted by all stations per unit time, counting both new frames and retransmissions.

Slotted ALOHA

  • Time is divided into slots of fixed length, and a station may only transmit at the start of a slot
  • Collisions can only occur within the same slot, so the collision window is halved
  • Channel utilization: S=G⋅e−GS = G \cdot e^{-G}, with a maximum of about 36.8% (when G=1G=1)

The throughput of slotted ALOHA is twice that of pure ALOHA.

The CSMA Protocol

CSMA (Carrier Sense Multiple Access) is based on a single idea: listen to the channel before transmitting, and transmit only if the channel is idle.

According to how the protocol behaves when the channel is busy and how it handles collisions after transmitting, CSMA comes in several variants:

1-Persistent CSMA

  • Channel idle: transmit immediately
  • Channel busy: keep listening and transmit as soon as it becomes idle (persistent)
  • High collision probability (several stations waiting transmit simultaneously the moment the channel becomes idle)

Non-Persistent CSMA

  • Channel idle: transmit immediately
  • Channel busy: wait for a random interval and then listen again (non-persistent)
  • Low collision probability, but the channel utilization may be lower (the channel may be idle during the waiting period)

p-Persistent CSMA

  • Channel idle: transmit with probability pp, or defer to the next slot with probability 1−p1-p
  • Channel busy: keep listening
  • Balances the collision probability against the channel utilization

The CSMA/CD Protocol

CSMA/CD (Carrier Sense Multiple Access with Collision Detection) is the medium access control protocol used by traditional Ethernet.

How It Works

The operation of CSMA/CD is summarized as “listen before transmitting, listen while transmitting, stop on collision, retransmit at random”:

  1. Carrier sense: listen to the channel before transmitting; wait if the channel is busy
  2. Transmit data: begin transmitting when the channel is idle
  3. Collision detection: keep listening while transmitting to detect whether a collision occurs
  4. Collision handling: on detecting a collision, stop transmitting immediately and send a jamming signal to notify all stations that a collision occurred
  5. Random retransmission: wait for a random interval and then try again

Contention Period and Minimum Frame Length

The key question in collision detection is: how long does the sender need before it can detect a collision?

Let the one-way propagation delay of the signal on the channel be τ\tau. In the worst case the sender detects a collision 2τ2\tau after starting (the round-trip propagation delay). This 2τ2\tau is called the contention period or collision window.

Therefore the minimum frame length must satisfy:

Lmin⁡=R×2τL_{\min} = R \times 2\tau

where RR is the data rate and 2τ2\tau is the contention period.

For traditional Ethernet (10 Mbps, maximum cable length 2500 m, signal propagation speed about 2×1082 \times 10^8 m/s):

  • τ=25002×108=12.5μs\tau = \frac{2500}{2 \times 10^8} = 12.5 \mu s
  • contention period 2τ=25.6μs2\tau = 25.6 \mu s
  • minimum frame length Lmin⁡=10×106×25.6×10−6=256L_{\min} = 10 \times 10^6 \times 25.6 \times 10^{-6} = 256 bit = 64 bytes

This is where the Ethernet minimum frame length of 64 bytes comes from.

Binary Exponential Backoff

After a collision the sender must wait a random interval before retransmitting. CSMA/CD uses the binary exponential backoff algorithm:

  1. Determine the basic backoff time T0=2τT_0 = 2\tau (the contention period)
  2. After the kk-th collision, pick a random number rr from the integer set {0,1,2,…,2k−1}\{0, 1, 2, \ldots, 2^k - 1\} and wait r×T0r \times T_0
  3. k=min⁡(number of retransmissions,10)k = \min(\text{number of retransmissions}, 10), that is, at most 210−1=10232^{10}-1 = 1023 contention periods
  4. After 16 failed retransmissions, give up and report an error

The characteristic of this algorithm is that the more collisions occur, the wider the range of waiting times becomes (the backoff), which lowers the probability of colliding again. It is an adaptive backoff strategy.

The CSMA/CA Protocol

CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance) is the medium access control protocol used by wireless LANs (IEEE 802.11 / Wi-Fi).

Why Wireless Networks Cannot Use CSMA/CD

  1. The hidden terminal problem: A and C are both within B’s range, but A and C cannot hear each other. When A transmits to B, C senses the channel as idle and also transmits to B, causing a collision. Neither A nor C can detect it.
  2. Large differences in signal strength: wireless signals attenuate quickly, so the transmitter’s signal is far stronger than the receiver’s, and the transmitter cannot listen for collisions while transmitting (the “near-far” problem).
  3. A high bit error rate on wireless channels: collision detection is expensive, so it is better to avoid collisions in the first place.

Wireless networks therefore use CSMA/CA, which tries to avoid collisions before transmission rather than detecting them afterwards.

How It Works

The core mechanisms of CSMA/CA are:

  1. Carrier sense: listen to the channel before transmitting and wait if it is busy
  2. IFS (InterFrame Space):
    • DIFS (DCF IFS): the longest, used for data frames and management frames. A frame may be sent only after the channel has been idle for a DIFS
    • SIFS (Short IFS): the shortest, used for response frames such as ACK and CTS. The receiver waits only a SIFS before replying with an ACK, which gives response frames priority
  3. Random backoff: if the channel is still busy after the DIFS, or if several stations were waiting, a station picks a random backoff time (a number of slots) and transmits only if the channel stays idle for that long. The backoff timer counts down and is paused while the channel is busy
  4. The RTS/CTS mechanism (optional):
    • The sender first sends a short RTS (Request To Send) frame carrying the length of the data frame
    • The receiver replies with a CTS (Clear To Send) frame, also carrying the length
    • Every station that hears the RTS or the CTS knows that a transmission is coming and stays silent for the specified period (NAV, the Network Allocation Vector)
    • RTS/CTS solves the hidden terminal problem

Polling Access Protocols

Token Ring

  • A special frame (the token) circulates around a ring topology
  • Only the station holding the token may transmit data
  • After the sender transmits, the data frame travels around the ring, the receiver copies the data and sets the response bit, and the frame eventually returns to the sender and is removed
  • The sender then releases the token and passes it to the next station
  • Advantages: no collisions, fair, and predictable (the maximum wait can be computed)
  • Disadvantages: a lost or corrupted token brings the network down, and token management is complex; a ring topology is less reliable
  • Applications: IEEE 802.5 Token Ring (largely obsolete)

Polling

  • A primary station takes turns asking each secondary station whether it has data to send
  • A secondary station may transmit only when it is polled
  • Advantages: no collisions and simple control
  • Disadvantages: high polling overhead and high latency (a secondary station must wait to be polled), and a failure of the primary station brings down the whole network
  • Applications: IBM 3270 terminal networks, Bluetooth (master/slave mode)

Worked Examples

Example 1: Computing the Minimum Ethernet Frame Length

On a 100 Mbps Ethernet with a maximum cable length of 200 m and a signal propagation speed in the cable of 2×1082 \times 10^8 m/s, find the contention period and the minimum frame length.

CSMA/CDContention PeriodMinimum Frame LengthEthernet

Approach: compute the one-way propagation delay, double it to get the contention period, and apply Lmin⁡=R×2τL_{\min} = R \times 2\tau.

Steps:

  1. One-way propagation delay: τ=2002×108=1μs\tau = \frac{200}{2 \times 10^8} = 1 \mu s
  2. Contention period: 2τ=2μs2\tau = 2 \mu s
  3. Minimum frame length: Lmin⁡=R×2τ=100×106×2×10−6=200L_{\min} = R \times 2\tau = 100 \times 10^6 \times 2 \times 10^{-6} = 200 bit = 25 bytes

The Ethernet standard in fact specifies a minimum frame length of 64 bytes (derived from the 10 Mbps Ethernet parameters for a 2500 m cable). 100 Mbps Ethernet kept the same minimum frame length but shortened the maximum cable length to 100 m (the contention period is still 2×1002×108=1μs2 \times \frac{100}{2 \times 10^8} = 1 \mu s, and 64×8/(100×106)=5.12μs>1μs64 \times 8 / (100 \times 10^6) = 5.12 \mu s > 1 \mu s, so the requirement is met).

Answer: the contention period is 2μs2 \mu s and the theoretical minimum frame length is 25 bytes (the standard mandates 64 bytes).

Example 2: Collision Detection Time in CSMA/CD

In a CSMA/CD network, stations A and B are 1 km apart and the signal propagation speed is 2×1082 \times 10^8 m/s. A starts transmitting a frame at t=0t=0, and B also starts transmitting a frame at t=2μst=2 \mu s. (1) At what time does A detect the collision? (2) At what time does B detect the collision?

CSMA/CDCollision DetectionPropagation DelayContention Period

Approach: compute the one-way propagation delay, then compare when each station’s signal reaches the other.

Steps:

  1. One-way propagation delay: τ=10002×108=5μs\tau = \frac{1000}{2 \times 10^8} = 5 \mu s
  2. A starts transmitting at t=0t=0 and B starts transmitting at t=2μst=2 \mu s.
  3. A’s signal reaches B at t=0+5=5μst = 0 + 5 = 5 \mu s. Since B had already started transmitting at t=2μst=2 \mu s, B detects the collision at t=5μst=5 \mu s (A’s signal arrives at B and overlaps B’s own signal).
  4. B’s signal reaches A at t=2+5=7μst = 2 + 5 = 7 \mu s. A detects the collision at t=7μst=7 \mu s (B’s signal arrives at A and overlaps A’s own signal).

Answer: (1) A detects the collision at t=7μst=7 \mu s; (2) B detects the collision at t=5μst=5 \mu s.

Note that the time at which A detects the collision (7μs7 \mu s) is less than the contention period 2τ=10μs2\tau = 10 \mu s, which satisfies the design requirement of CSMA/CD.

Example 3: ALOHA Throughput

In a pure ALOHA network, the total number of frames transmitted by all stations per unit time (counting both new frames and retransmissions) is G=1G=1. Find the throughput of the network. What is the throughput if slotted ALOHA is used instead?

ALOHAThroughputPure ALOHASlotted ALOHA

Approach: apply the throughput formulas for pure ALOHA and for slotted ALOHA at G=1G=1.

Steps:

  1. The pure ALOHA throughput formula is S=G⋅e−2GS = G \cdot e^{-2G} With G=1G=1: S=1⋅e−2=e−2≈0.135=13.5%S = 1 \cdot e^{-2} = e^{-2} \approx 0.135 = 13.5\%

  2. The slotted ALOHA throughput formula is S=G⋅e−GS = G \cdot e^{-G} With G=1G=1: S=1⋅e−1=e−1≈0.368=36.8%S = 1 \cdot e^{-1} = e^{-1} \approx 0.368 = 36.8\%

Note that the maximum throughput of pure ALOHA is 1/(2e)≈18.4%1/(2e) \approx 18.4\% (at G=0.5G=0.5), while the maximum throughput of slotted ALOHA is 1/e≈36.8%1/e \approx 36.8\% (at G=1G=1). At G=1G=1, pure ALOHA is not operating at its optimum point.

Answer: the throughput of pure ALOHA is about 13.5%, and the throughput of slotted ALOHA is about 36.8%.


Exercises

Exercise 1

What are the main differences between CSMA/CD and CSMA/CA? Why do wireless networks use CSMA/CA instead of CSMA/CD?

CSMA/CDCSMA/CACollision DetectionCollision AvoidanceHidden Terminal

Approach: compare the two protocols on collision handling, target environment, and key mechanisms, then explain why collision detection is impractical on a wireless link.

Steps:

The main differences are:

  1. How collisions are handled:

    • CSMA/CD: detects collisions during transmission and stops and retransmits once one is detected
    • CSMA/CA: uses various mechanisms to avoid collisions before transmission and does not detect them
  2. Target environment:

    • CSMA/CD: wired networks (traditional Ethernet), where signal strength is stable and transmitting and listening can happen at the same time
    • CSMA/CA: wireless networks (Wi-Fi), where signals attenuate strongly and the hidden terminal problem exists
  3. Key mechanisms:

    • CSMA/CD: listen while transmitting, jamming signal, binary exponential backoff
    • CSMA/CA: IFS waiting, random backoff, RTS/CTS, NAV

Why wireless networks cannot use CSMA/CD:

  1. The hidden terminal problem: two stations cannot hear each other but both reach the receiver, so they may transmit at the same time and collide without either detecting it
  2. Differences in signal strength: wireless signals attenuate quickly, so the transmitter’s signal is far stronger than the receiver’s, and the transmitter cannot listen for collisions while transmitting (the near-far problem)
  3. A high bit error rate on wireless channels: collision detection is expensive, so it is better to avoid collisions in the first place

Answer: CSMA/CD detects collisions after transmitting and suits wired links; CSMA/CA avoids collisions before transmitting and suits wireless links, where collision detection is unreliable because of the hidden terminal problem, signal attenuation, and a high bit error rate.

Exercise 2

Describe how the binary exponential backoff algorithm works, and explain why an exponential backoff is used instead of a fixed one.

Binary Exponential BackoffCSMA/CDRetransmissionBackoff Algorithm

Approach: describe the algorithm steps, then give the three reasons for using an exponential rather than fixed backoff.

Steps:

How it works:

  1. After a collision, determine the basic backoff time T0=2τT_0 = 2\tau (the contention period)
  2. After the kk-th collision, pick a random number rr from {0,1,…,2k−1}\{0, 1, \ldots, 2^k-1\} and wait r×T0r \times T_0
  3. k=min⁡(number of retransmissions,10)k = \min(\text{number of retransmissions}, 10); give up after 16 failed retransmissions

Why an exponential backoff:

  1. Adapts to the network load: many collisions mean a heavy load, which requires a wider range of waiting times to lower the probability of colliding again; few collisions mean a light load, where a quick retransmission is fine
  2. Avoids persistent collisions: with a fixed backoff, several colliding stations may pick the same waiting time and collide again. The exponential backoff widens the random range as the collision count grows, greatly reducing the probability of another collision
  3. Fairness: a station that has collided many times waits longer, which gives newer stations more opportunities to transmit and avoids starvation

Answer: the algorithm waits a random multiple of the contention period, where the multiple is drawn from a range that doubles with each collision; this adapts to the load, lowers the chance of repeated collisions, and keeps the medium fair.


Glossary

TermAbbreviationExplanation
Medium Access ControlMACCoordinating access to a shared channel
Carrier Sense Multiple AccessCSMAListening to the channel before transmitting
Collision DetectionCDDetecting collisions during transmission
Collision AvoidanceCAAvoiding collisions before transmission
Contention Period-The round-trip propagation delay 2τ
Binary Exponential BackoffBEBThe random waiting algorithm used after a collision
Request To SendRTSA CSMA/CA control frame
Clear To SendCTSA CSMA/CA control frame
Network Allocation VectorNAVThe reserved time for using the channel
InterFrame SpaceIFSThe waiting time between frames
Hidden Terminal-Stations that cannot hear each other
Frequency Division MultiplexingFDMDividing the channel by frequency
Time Division MultiplexingTDMDividing the channel into time slots
Code Division MultiplexingCDMDividing the channel by chip sequence
Token Ring-A ring network that uses token passing
Jamming Signal-The signal that notifies all stations after a collision

Found an issue with this content?

Tell us what could be improved.