Medium Access Control
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.
Definition
A definition is a precise description of what a concept, a term, or an object means. Understanding definitions is the foundation of learning any field, and every concept has its own exact meaning.
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:
- Channel partitioning protocols: the channel resource is divided into fixed pieces assigned to each station (FDM, TDM, WDM, CDM)
- 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)
- Polling access protocols: access is coordinated through a central controller or token passing (Token Ring, polling)
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)
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): , with a maximum of about 18.4% (when )
Here 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: , with a maximum of about 36.8% (when )
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 , or defer to the next slot with probability
- 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”:
- Carrier sense: listen to the channel before transmitting; wait if the channel is busy
- Transmit data: begin transmitting when the channel is idle
- Collision detection: keep listening while transmitting to detect whether a collision occurs
- Collision handling: on detecting a collision, stop transmitting immediately and send a jamming signal to notify all stations that a collision occurred
- 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 . In the worst case the sender detects a collision after starting (the round-trip propagation delay). This is called the contention period or collision window.
To guarantee that the sender detects a collision before it finishes transmitting the frame, the frame transmission delay must be greater than or equal to the contention period . Otherwise, if the frame is too short, the sender finishes before detecting the collision and wrongly believes the transmission succeeded.
Therefore the minimum frame length must satisfy:
where is the data rate and is the contention period.
For traditional Ethernet (10 Mbps, maximum cable length 2500 m, signal propagation speed about m/s):
- contention period
- minimum frame length 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:
- Determine the basic backoff time (the contention period)
- After the -th collision, pick a random number from the integer set and wait
- , that is, at most contention periods
- 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.
Modern Ethernet (full-duplex switched Ethernet) no longer uses CSMA/CD, because every switch port is an independent collision domain and, in full-duplex mode, transmission and reception use separate lines, so no collision can occur. CSMA/CD is used only in half-duplex mode.
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
- 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.
- 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).
- 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:
- Carrier sense: listen to the channel before transmitting and wait if it is busy
- 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
- 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
- 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
By combining “listen before transmitting + wait an IFS + random backoff + RTS/CTS”, CSMA/CA avoids collisions as far as possible before transmission. It cannot eliminate collisions entirely, but it greatly lowers their probability, which suits the wireless environment.
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)
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 m/s, find the contention period and the minimum frame length.
Approach: compute the one-way propagation delay, double it to get the contention period, and apply .
Steps:
- One-way propagation delay:
- Contention period:
- Minimum frame length: 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 , and , so the requirement is met).
Answer: the contention period is 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 m/s. A starts transmitting a frame at , and B also starts transmitting a frame at . (1) At what time does A detect the collision? (2) At what time does B detect the collision?
Approach: compute the one-way propagation delay, then compare when each station’s signal reaches the other.
Steps:
- One-way propagation delay:
- A starts transmitting at and B starts transmitting at .
- A’s signal reaches B at . Since B had already started transmitting at , B detects the collision at (A’s signal arrives at B and overlaps B’s own signal).
- B’s signal reaches A at . A detects the collision at (B’s signal arrives at A and overlaps A’s own signal).
Answer: (1) A detects the collision at ; (2) B detects the collision at .
Note that the time at which A detects the collision () is less than the contention period , 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 . Find the throughput of the network. What is the throughput if slotted ALOHA is used instead?
Approach: apply the throughput formulas for pure ALOHA and for slotted ALOHA at .
Steps:
-
The pure ALOHA throughput formula is With :
-
The slotted ALOHA throughput formula is With :
Note that the maximum throughput of pure ALOHA is (at ), while the maximum throughput of slotted ALOHA is (at ). At , 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%.
Exercise 1
What are the main differences between CSMA/CD and CSMA/CA? Why do wireless networks use CSMA/CA instead of CSMA/CD?
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:
-
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
-
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
-
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:
- 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
- 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)
- 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.
Approach: describe the algorithm steps, then give the three reasons for using an exponential rather than fixed backoff.
Steps:
How it works:
- After a collision, determine the basic backoff time (the contention period)
- After the -th collision, pick a random number from and wait
- ; give up after 16 failed retransmissions
Why an exponential backoff:
- 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
- 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
- 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.
| Term | Abbreviation | Explanation |
|---|---|---|
| Medium Access Control | MAC | Coordinating access to a shared channel |
| Carrier Sense Multiple Access | CSMA | Listening to the channel before transmitting |
| Collision Detection | CD | Detecting collisions during transmission |
| Collision Avoidance | CA | Avoiding collisions before transmission |
| Contention Period | - | The round-trip propagation delay 2τ |
| Binary Exponential Backoff | BEB | The random waiting algorithm used after a collision |
| Request To Send | RTS | A CSMA/CA control frame |
| Clear To Send | CTS | A CSMA/CA control frame |
| Network Allocation Vector | NAV | The reserved time for using the channel |
| InterFrame Space | IFS | The waiting time between frames |
| Hidden Terminal | - | Stations that cannot hear each other |
| Frequency Division Multiplexing | FDM | Dividing the channel by frequency |
| Time Division Multiplexing | TDM | Dividing the channel into time slots |
| Code Division Multiplexing | CDM | Dividing 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 |
