Module 3 MAC
Module 3 MAC
Overview!
Wireless MAC protocols!
Carrier Sense Multiple Access!
Multiple Access with Collision Avoidance (MACA) and MACAW!
MACA By Invitation!
IEEE 802.11!
IEEE 802.15.4 and ZigBee!
Characteristics of MAC Protocols in Sensor Networks!
Energy Efficiency!
Scalability!
Adaptability!
Low Latency and Predictability!
Reliability!
Contention-Free MAC Protocols!
Contention-Based MAC Protocols!
Hybrid MAC Protocols!
Medium Access Control
• LLC (Logic link control) main task is Error and Flow Control (next chapter)
• Energy efficiency is important
• Put a node to SLEEP whenever possible
• Contention based and Scheduling based approaches
• IEEE 802.15.4 combines both
• IEE 802.11 and Bluetooth are not the first choice
– Performance Requirements
- throughput
- stability
- low access delay
- low overhead
Overhead due to :
- per-packet overhead (headers , trailers)
- collisions – happens when 2 nodes Txmit
- exchange of extra control packets
- use priority based Tx for real-time
MAC Protocol Categorization
5!
Contention-Free Medium Access
Collisions can be avoided by ensuring that each node can use its allocated
resources exclusively!
Examples of fixed assignment strategies:!
FDMA: Frequency Division Multiple Access!
the frequency band is divided into several smaller frequency bands!
the data transfer between a pair of nodes uses one frequency band !
all other nodes use a different frequency band!
TDMA: Time Division Multiple Access!
multiple devices to use the same frequency band!
relies on periodic time windows (frames)!
– frames consist of a fixed number of transmission slots to separate the
medium accesses of different devices!
– a time schedule indicates which node may transmit data during a certain
slot!
Contention-Free Medium Access
Examples of fixed assignment strategies (contd.):!
CDMA: Code Division Multiple Access!
simultaneous accesses of the wireless medium are supported using different
codes!
if these codes are orthogonal, it is possible for multiple communications to
share the same frequency band!
forward error correction (FEC) at the receiver is used to recover from
interferences among these simultaneous communications!
Fixed assignment strategies are inefficient!
it is impossible to reallocate slots belonging to one device to other devices if not
needed in every frame!
generating schedules for an entire network can be a taunting task !
these schedules may require modifications every time the network topology or
traffic characteristics in the network change
Types of Channels
• Control channel
– Forward (Downlink) control channel
– Reverse (Uplink) control channel
• Traffic channel
– Forward traffic (traffic or information) channel
– Reverse traffic (traffic or information) channel
8
Types of Channels (Cont’d)
Reverse channel (Uplink) Control channels
f’
f1’
f2’
…
fn’
f1
f2
…
fn
Forward channels
MS Traffic channels BS
(Downlink)
9
FDMA
f1’ f1
MS #1
f2’ f2
MS #2 …
…
…
fn’ fn
MS #n
BS
Reverse channels Forward channels
(Uplink) (Downlink)
10
FDMA: Channel Structure
Guard Band Wg Sub Band Wc
…
1 2 3 4 N
Frequency
… …
Frequency
Reverse channels Forward channels
Protecting bandwidth
11
TDMA
Frequency f ’ Slot Frequency f
… … … … … …
#1
#1
#1
#1
MS #1 t t
… … … … … …
#2
#2
#2
#2
MS #2 t t
…
… … … … … …
#n
#n
#n
#n
MS #n t t
12
TDMA: Channel Structure
f
Frame Frame Frame
… … … t
#1
#2
#1
#2
#n
#1
#2
#n
#n
(a). Forward channel
f’
Frame Frame Frame
… … … t
#1
#2
#1
#2
#n
#1
#2
#n
#n
(b). Reverse channel
13
TDMA: Frame Structure (Cont’d)
Frequency
f=f’
Frame Frame
… … … …
#1
#2
#1
#2
#n
#1
#2
#n
#n
#1
#2
#n
Time
14
TDMA: Frame Structure (Cont’d)
Frequency
Frame Frame Frame
… … …
#1
#2
#1
#2
#n
#1
#2
#n
#n
Time
Head Data
Guard
time
15
Code Division Multiple Access (CDMA)
Frequency f ’ Frequency f
MS #1 C1’ C1
MS #2 C2’ C2
…
…
…
Cn’ Cn
MS #n
BS
Reverse channels Forward channels
(Uplink) (Downlink)
Note: Ci’ x Cj’ = 0, i.e., Ci’ and Cj’ are orthogonal codes, Ci
x Cj = 0, i.e., Ci and Cj are orthogonal codes
16
Comparisons of FDMA, TDMA, and CDMA (Example)
Hidden
terminal Also:
scenario: recall
exposed
terminal
A B C D
scenario
Ad hoc & sensor networs - Ch 5:
SS 05 18
MAC protocols
Main options to shut up senders
RTS
CTS CTS
RTS
CTS Data
Ack
22
RANDOM ACCESS
ALOHA
Carrier Sense Multiple Access
Carrier Sense Multiple Access with Collision Detection
Carrier Sense Multiple Access with Collision Avoidance
23
ALOHA
• Wireless link to provide data transfer between main
campus & remote campuses of University of Hawaii
• Simplest solution: just do it
– A station transmits whenever it has data to transmit
– If more than one frames are transmitted, they interfere with
each other (collide) and are lost
– If ACK not received within timeout, then a station picks random
backoff time (to avoid repeated collision)
– Station retransmits frame after backoff time
n 26
Throughput of ALOHA
2 G
S GPsuccess Ge
• Collisions are
0.2 e-2 = 0.184 means for
0.18 coordinating
0.16
0.14
access
0.12 • Max throughput is
0.1
S
G
snowball and drop
throughput to zero
27
Figure 3 Frames in a pure ALOHA network
28
Figure 4 Procedure for pure ALOHA protocol
29
Example 1
30
Example 1 (continued)
31
Figure 5 Vulnerable time for pure ALOHA protocol
32
Example 2
Solution
Average frame transmission time Tfr is 200 bits/200 kbps or
1 ms. The vulnerable time is 2 × 1 ms = 2 ms. This means
no station should send later than 1 ms before this station
starts transmission and no station should start sending
during the one 1-ms period that this station is sending.
33
Note
34
Example 3
A pure ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the throughput if the
system (all stations together) produces
a. 1000 frames per second b. 500 frames per second
c. 250 frames per second.
Solution
The frame transmission time is 200/200 kbps or 1 ms.
a. If the system creates 1000 frames per second, this is 1
frame per millisecond. The load is 1. In this case
S = G× e−2 G or S = 0.135 (13.5 percent). This means
that the throughput is 1000 × 0.135 = 135 frames. Only
135 frames out of 1000 will probably survive.
35
Example 3 (continued)
b. If the system creates 500 frames per second, this is
(1/2) frame per millisecond. The load is (1/2). In this
case S = G × e −2G or S = 0.184 (18.4 percent). This
means that the throughput is 500 × 0.184 = 92 and that
only 92 frames out of 500 will probably survive. Note
that this is the maximum throughput case,
percentagewise.
t
kX (k+1)X t0 +X+2tprop t0 +X+2tprop+ B
Time-out
Vulnerable
period
38
Note
39
Figure 7 Vulnerable time for slotted ALOHA protocol
40
Example 4
A slotted ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the throughput if the
system (all stations together) produces
a. 1000 frames per second b. 500 frames per second
c. 250 frames per second.
Solution
The frame transmission time is 200/200 kbps or 1 ms.
a. If the system creates 1000 frames per second, this is 1
frame per millisecond. The load is 1. In this case
S = G× e−G or S = 0.368 (36.8 percent). This means
that the throughput is 1000 × 0.0368 = 368 frames.
Only 386 frames out of 1000 will probably survive.
41
Carrier Sensing Multiple Access (CSMA)
• A station senses the channel before it starts transmission
– If busy, either wait or schedule backoff (different options)
– If idle, start transmission
– Vulnerable period is reduced to tprop (due to channel capture effect)
– When collisions occur they involve entire frame transmission times
– If tprop >X (or if a>1), no gain compared to ALOHA or slotted
ALOHA
Station A begins
transmission at t
=0 A
Station A captures
channel at t = tprop
A 42
Figure 8 Collision of the first bit in CSMA/CD
43
Figure 9 Collision and abortion in CSMA/CD
44
CSMA Options
• Transmitter behavior when busy channel is
sensed
– 1-persistent CSMA (most greedy)
• Start transmission as soon as the
channel becomes idle
• Low delay and low efficiency
– Non-persistent CSMA (least greedy)
• Wait a backoff period, then sense
carrier again
• High delay and high efficiency
– p-persistent CSMA (adjustable greedy)
• Wait till channel becomes idle,
transmit with prob. p; or wait one
mini-slot time & re-sense with
probability 1-p
• Delay and efficiency can be balanced 45
Flow diagram for three persistence methods
At time t 1, station A has executed its persistence procedure and starts sending the bits of
its frame. At time t2, station C has not yet sensed the first bit sent by A. Station C executes
its persistence procedure and starts sending the bits in its frame, which propagate both to
the left and to the right. The collision occurs sometime after time t2' Station C detects a
collision at time t3 when it receives the first bit ofA's frame. Station C immediately (or after
a short time, but we assume immediately) aborts transmission. Station A detects collision
at time t4 when it receives the first bit of C's frame; it also immediately aborts
transmission. Looking at the figure, we see that A transmits for the duration t4 – t1; C
transmits for the duration t3 - t2' Later we show that, for the protocol to work, the length
of any frame divided by the bit rate in this protocol must be more than either of these
durations. At time t4, the transmission of A:s frame, though incomplete, is aborted; at time
t3, the transmission of B's frame, though incomplete, is aborted.
Figure 10 Flow diagram for the CSMA/CD
49
CSMA/CA
Figure 11 Energy level during transmission, idleness, or collision
51
Figure 12 Timing in CSMA/CA
Need to avoid collisions on wireless networks because they cannot be detected. Carrier
sense multiple access with collision avoidance (CSMA/CA) was invented for this network.
Collisions are avoided through the use of CSMAICA's three strategies: the interframe space,
the contention window, and acknowledgments, as shown in Figure.
52
Figure 13 Flow diagram for CSMA/CA
Interframe Space (IFS)
First, collisions are avoided by deferring transmission even if the channel is found idle.
When an idle channel is found, the station does not send immediately. It waits for a
period of time called the interframe space or IFS. Even though the channel may
appear idle when it is sensed, a distant station may have already started transmitting.
The distant station's signal has not yet reached this station. The IFS time allows the
front of the transmitted signal by the distant station to reach this station. If after the IFS
time the channel is still idle, the station can send, but it still needs to wait a time equal
to the contention time.
Contention Window
The contention window is an amount of time divided into slots. A station that is ready
to send chooses a random number of slots as its wait time. The number of slots in the
window changes according to the binary exponential back-off strategy. This means that
it is set to one slot the first time and then doubles each time the station cannot detect
an idle channel after the IFS time. This is very similar to the p-persistent method except
that a random outcome defines the number of slots taken by the waiting station. One
interesting point about the contention window is that the station needs to sense the
channel after each time slot. However, if the station finds the channel busy, it does not
restart the process; it just stops the timer and restarts it when the channel is sensed as
idle. This gives priority to the station with the longest waiting time.
Acknowledgment
With all these precautions, there still may be a collision resulting in destroyed data.
In addition, the data may be corrupted during the transmission. The positive
acknowledgment and the time-out timer can help guarantee that the receiver has
received the frame.
53
MACA: Multiple Access
with Collision
Avoidance
• Carrier sense became adopted in radio
packet
14
RTS/CTS
• Exchange of two short messages: Request to Send (RTS)
and Clear to Send (CTS)
• Algorithm
1. A sends an RTS (tells B to
2. prepare)
B replies an CTS message length)
3. (echoes
A sends its Data
1. “RTS, k bits”
defers
A 3. “Data” B C
2. “CTS, k bits”
15
Deference to
CTS
• Hear CTS à Defer for length of expected data
transmission time
16
Deference to
RTS
• Hear RTS à Defer one CTS-time (why?)
A 3. “Data” B C D
2. “CTS, (No
k bits” deferen
ce after
17
Collision!
• A’s collides with C’s RTS, are lost at B
RTS both
• B will
not reply with a CTS
RTS Collision RTS
A B C
• Might collisions involving packets occur?
– Not data
according to our (unrealistic)
assumptions
– But Karn acknowledges interference range
communication
>
range
18
BEB in
MACA
• When collisions arise, MACA senders randomly
backoff like Ethernet senders then retry the
RTS
• How long do collisions take to detect in
the
Experimental Ethernet?
• What size should we make MACA backoff slots?
19
BEB in
MACA
• Current backoff constant:
CW
• MACA
sender:
– CW0 = 2 and CWM = 64
– Upon successful RTS/CTS, CW ß CW0
– Upon failed RTS/CTS, CW ß min[2CW, CWM]
20
1. MACA
2. MACAW
21
MACAW:
Context
• Published in SIGCOMM 1994, work
’93/’94
• Wi-Fi standards proceeded in parallel (IEEE ‘97)
standard
– 802.11 draws on MACAW, which draws on
MACA
• Assumptions and goals: Same as
MACA
• Setting: Wireless LAN
– Packet radio cell size: circa 100 mi. μs)
(528 ns)
– Wireless LAN cell size: circa 100 ft.
(100
22
Fairness in
BEB/MACA
• MACA’s BEB can lead to unfairness: backed-off sender
has
decreasing chance to acquire medium (“the poor get
• poorer”)
Simple example: C each sending at a rate thatcan alone
A,
saturate the
network A B C
CW= CW
32 =4
• C more likely to the backoff and set CW=2
win minimum
• A more likely to defer CW)
(maintain
23
BEB in MACAW:
Copy
• MACAW proposal: senders write their CW into
packets
– Upon hearing a packet, copy and adopt its CW
• Result: Dissemination of congestion level of
“winning”
transmitter to its competitors
• Is this a good
idea?
• RTS failure rate at one node propagates far and
wide
– Ambient noise? Regions with different loads?
24
BEB in
•MACAW
Integrates with MACAW’s ACK
mechanism
• Multiplicative increase, linear (MILD)
decrease
• MACAW
sender:
– CW0 = 2 and CWM = 64
– Upon failed RTS/CTS
• CW ß min[1.5CW, CWM]
– Upon successful RTS/CTS but failed ACK, no change
– Upon successful RTS/CTS/DATA/ACK
• CW ß CW−1
25
Reliability:
•ACK
MACAW introduces an ACK after DATA packets; not in
MACA
• Sender resends if RTS/CTS succeeds no ACKreturns
but
• Sender resends Two
RTS. cases:
1. DATA was
–lostReceiver sends CTS, sender
DATA
2. Receiver already has the DATA (reverse- ACK loss)
–linkReceiver sends
ACK
26
ACK:
•Considerations
Avoid TCP window reductions when
interference
• Useful when there’s ambient noise (microwave
ovens…)
• Why are sequence numbers in DATA packets
now important (not mentioned directly in paper!)
27
MACAW and Exposed
•Terminals
C can proceed only if it can hear a CTS from
D
– But B’s DATA will likely clobber
• So B sends a Data Sending (DS) after CTS
packet
– So C knows that B received CTS
a• C defers after ACK
until
Conservative:
1. “RTS, k bits” Doesn’t leverage exposed
terminal opportunities for concurrency
A 2. “CTS, B C D
k bits” Defer
3. “DS”
4.
“Data”
28
Need for
Synchronization
• Suppose D has a smaller CW, ongoing
• transmission
• B can not reply to A’s RTS
A doesn’t know when the contention periods are
• So, A’s backoff will increase:
unfair
A B C D
29
MACAW:
RRTS
• But B knows when the gaps for contention are
• B sends a Request for RTS (RRTS) packet to A when
DATA completes (hears an ACK from C)
• C defers transmissions for two slot periods (why?)
• A sends aRTS immediately without backoff
RRTS
CTS
A B C D
DRA
DRAT
TTS
TSA
30
A Problem not Solved by
RRTS
• What happens in this
scenario?
– Assume C is successful, ongoing
– transmission
When A sends RTS to B, B just can’t it
– hear
So this problem is not solved by RRTS
A B C D
31
Today: Wi- Above the PHY
Fi MACA
1.
2. MACAW
3. 802.11 MAClayer
– Contention and backoff
– Frame aggregation
– Selective retransmission Acknowledgement
and
32
802.11’s
•MAC
Adopts MACAW’s MAC from a high
level:
– Same RTS/CTS/DATA/ACK
• RTS/CTS optional
– Different contention window control
Sender: Data
Receiver: CW ACK
Overhead Overhea
d
34
Backoff: Pausing and
Resuming
• 802.11 backoff slot time Physical CS time + 802.11 ac:
switch radio from slot time = 9 μs
=
propagation time + time
• to
No No “copy,” MILD, no DS, noRRTS
receive
MACAW: to transmit
no
B1 = 25 B1 = 5
Node 1: wait data
pause @ 5
Node 2: data wait
B2 = 20 B2 = 15 B2 = 10
36
1. MACA
2. MACAW
3. 802.11 MAClayer
– Contention and backoff
– Frame aggregation
– Selective retransmission and
Acknowledgement
37
Motivation: MAC Scaling
Incommensurate with Bitrate
PHY
Preamble
Payload (1,500 byte packet)
(% overhead)
6 Mbps
1% (20 MHz, 1
x 1)
8% 54 Mbps
(20 MHz, 1
29% x 1)
130 Mbps
45% (20 MHz, 2 x 2)
270 Mbps
73% (40MHz,
(40 M
MHz, 2
4 xx 2)
4)
540 Mbps
Problem: Drop in efficiency with increasing data rate from
fixed overheads in the preamble and inter-frame spaces
38
Aggregation Fixed
Amortizes Overheads
• Without aggregation:
DIFS DIFS DIFS
CW BA CW BA
SIFS SIFS
39
802.11: Selective
•Retransmission
802.11 adopts TCP’s selective retransmission, but:
– Primary consideration is performance at the link
layer
– Protocol is only semi-reliable: may drop packets
• Receiver-side reorder buffer for in-order
delivery
• Receiver-side scoreboard for feedback to
sender
• Sender transmits Block ACK request (BAR)
1. If needed, sender can solicit a Block ACK response
frames:
(BA response) from receiver
46
2 CONTROLLED ACCESS
Central
Controller
83
Reservation Systems
Reservation Frame
interval transmissions
r d d d r d d d Time
Cycle n Cycle (n + 1)
r = 1 2 3 M
85
Example
• Initially stations 3 & 5 have reservations to transmit
frames
(a)
r 3 5 r 3 5 r 3 5 8 r 3 5 8 r 3
t
r 3 5 r 3 5 r 3 5 8 r 3 5 8 r 3
t
86
Efficiency of Reservation Systems
• Assume minislot duration = vX
• TDM single frame reservation scheme
– If propagation delay is negligible, a single frame transmission requires (1+v)X
seconds
– Link is fully loaded when all stations transmit, maximum efficiency is:
MX 1
max
Mv MX 1 v
• TDM k frame reservation scheme
– If k frame transmissions can be reserved with a reservation
message and if there are M stations, as many as Mk
frames can be transmitted in XM(k+v) seconds
– Maximum efficiency is:
MkX 1
max
Mv MkX 1 v
k 87
Random Access Reservation Systems
• Large number of light traffic stations
– Dedicating a minislot to each station is inefficient
• Slotted ALOHA reservation scheme
– Stations use slotted Aloha on reservation minislots
– On average, each reservation takes at least e minislot
attempts
– Effective time required for the reservation is 2.71vX
1 1
ρmax = X X(1+ev)
=
+ 2.71v
88
Polling Systems
• Centralized polling systems: A central controller transmits
polling messages to stations according to a certain order
• Distributed polling systems: A permit for frame
transmission is passed from station to station according
to a certain order
• A signaling procedure exists for setting up order
Central
Controller
89
Polling System Options
• Service Limits: How much is a station allowed to transmit per
poll?
– Exhaustive: until station’s data buffer is empty (including
new frame arrivals)
– Gated: all data in buffer when poll arrives
– Frame-Limited: one frame per poll
– Time-Limited: up to some maximum time
• Priority mechanisms
– More bandwidth & lower delay for stations that appear
multiple times in the polling list
– Issue polls for stations with message of priority k or higher
90
Figure 14 Select and poll functions in polling access method
91
Comparison of MAC approaches
• Aloha & Slotted Aloha
– Simple & quick transfer at very low load
– Accommodates large number of low-traffic bursty users
– Highly variable delay at moderate loads
– Efficiency does not depend on a
• CSMA-CD
– Quick transfer and high efficiency for low delay-bandwidth
product
– Can accommodate large number of bursty users
– Variable and unpredictable delay
92
Comparison of MAC approaches
• Reservation
– On-demand transmission of bursty or steady streams
– Accommodates large number of low-traffic users with slotted Aloha
reservations
– Can incorporate QoS
– Handles large delay-bandwidth product via delayed grants
• Polling
– Generalization of time-division multiplexing
– Provides fairness through regular access opportunities
– Can provide bounds on access delay
– Performance deteriorates with large delay-bandwidth product
93
Overview
• Schedule-based protocols
– SMACS
– LEACH
– TRAMA
• IEEE 802.15.4
• Schedule-based protocols
– SMACS
– LEACH
– TRAMA
• IEEE 802.15.4
Clusterheads Members
compete with compete
Self-election of
CSMA with CSMA
clusterheads
– Bookkeeping
Active period
of devices, address assignment,
Inactive period
request