Media Access Control: CSE 123: Computer Networks Stefan Savage
Media Access Control: CSE 123: Computer Networks Stefan Savage
Media Access Control: CSE 123: Computer Networks Stefan Savage
Channel partitioning
FDMA (frequency division multiple access)
TDMA (time division multiple access)
CDMA (code division multiple access)
Random access
Contention-based
» Aloha
» CSMA, CSMA/CD, CSMA/CA
» Ethernet, 802.11
Contention-free
» Token-ring, FDDI
Channel Partitioning
Need to share media with multiple nodes (n)
Multiple simultaneous conversations
A simple solution
Divide the channel into multiple, separate channels
3
Frequency Division (FDMA)
Divide bandwidth of f Hz into n channels each with
bandwidth f/n Hz
Easy to implement, but unused subchannels go idle
» Also need “guard bands” between channels to prevent interference
Used by traditional analog cell phone service, radio, TV
Amplitude
Frequency
Amplitude
Frequency
4
Time Division (TDMA)
Divide channel into rounds of n time slots each
Assign different hosts to different time slots within a round
Unused time slots are idle
Used in GSM cell phones & digital cordless phones
1 2 3 1 2 3 4 2 4
5
Code Division (CDMA)
Do nothing to physically separate the channels
All stations transmit at same time in same frequency bands
One of so-called spread-spectrum techniques
TDMA
power
CDMA
power
7
Problem w/Channel partitioning
Not terribly well suited for random access usage
Why?
8
Aloha
Designed in 1970 to support wireless data connectivity
Between Hawaiian Islands—rough!
9
Collisions
Frame sent at t0 collides with frames sent in [t0-1, t0+1]
Assuming unit-length frames
Ignores propagation delay
10
Slotted Aloha
Time is divided into equal size slots (frame size)
Host wanting to transmit starts at start of next slot
Retransmit like w/Aloha, but quantize to nearest next slot
Requires time synchronization between hosts
11
Channel Efficiency
Q: What is max fraction slots successful?
A: Suppose n stations have packets to send
Each transmits in slot with probability p
At best: channel
Prob[successful transmission], S, is: used for useful
transmissions 37%
S = p (1-p)(n-1) of time!
0.4
12
Carrier Sense (CSMA)
Aloha transmits even if another host is transmitting
Thus guaranteeing a collision
13
Retransmission Options
non-persistent CSMA
Give up, or send after some random delay
Problem: may incur larger delay when channel is idle
1-persistent CSMA
Send as soon as channel is idle
Problem: blocked senders all try to send at once
P-persistent CSMA
If idle, send packet with probability p; repeat
Make sure (p * n) < 1
X (wire)
collision
A B
If nodes can detect collisions, abort! (CSMA/CD)
Requires a minimum frame size (“acquiring the medium”)
B must continue sending (“jam”) until A detects collision
17
Classic Ethernet
IEEE 802.3 standard wired LAN
(modified 1-persistent CSMA/CD)
Classic Ethernet: 10 Mbps over coaxial cable
All nodes share same physical wire
Max length 2.5km, max between stations 500m
(wire)
nodes
Framing
Preamble, 32-bit CRC, variable length data
Unique 48-bit address per host (bcast & multicast addrs too)
Preamble (8) Source (6) Dest (6) Len (2) Payload (var) Pad (var) CRC (4)
18
Ethernet improvements
19
Capture Effect
Randomized access scheme is not fair
20
Ethernet Performance
Much better than Aloha or CSMA in practice
Less efficient if
» More hosts – more collisions needed to identify single sender
» Smaller packet sizes – more frequent arbitration
» Longer links – collisions take longer to observe, more wasted
bandwidth
21
Contention-free Protocols
Problem with channel partitioning
Inefficient at low load (idle subchannels)
Problem with contention-based protocols
Inefficient at high load (collisions)
Contention-free protocols
Try to do both by explicitly taking turns
Can potentially also offer guaranteed bandwidth, latency, etc.
Two contention-free approaches
Polling Token Passing
Master node “invites” slave Control token passed from one
nodes to transmit in turn node to next sequentially.
Request to Send (RTS), Clear Point-to-point links can be fast
to Send (CTS) messages Problems:
Problems: Token overhead
Polling overhead Latency
Latency Single point of failure (token)
Single point of failure (master)
Token Ring (802.5)
C B
Direction of
D transmission
A nodes
26
Wireless Media Access
Wireless is more complicated than wired …
A B C
transmit range
A and C can both send to B but can’t hear each other
A is a hidden terminal for C and vice versa
Packets will collide at B and create interference
CSMA will be ineffective – want to sense at receiver
Exposed Terminals
A B C D
transmit range
B, C can hear each other but can safely send to A, D
B and C won’t transmit, when they should
CSMA with Collision Avoidance
(CSMA/CA)
Since we can’t detect collisions, we try to avoid them
When medium busy, choose random interval
(contention window)
Wait for that many idle timeslots to pass before sending
Remember p-persistence … a refinement
When a collision is inferred, retransmit with binary
exponential backoff (like Ethernet)
Use ACK from receiver to infer “no collision”
Again, exponential backoff helps us adapt “p” as needed
CSMA/CA vs. CSMA/CD
In CSMA/CA, backoff before collision
In CSMA/CD, backoff after collision
RTS / CTS Protocols (MACA)
RTS
A B C D
CTS