Title: 15-441 Communications and Networking
115-441Communications and Networking
2Medium Access Control (MAC) Layer
3Medium Access Control
- Allow multiple stations to share a common
communication channel - Approaches
- Take turns token-passing, coordinator-polling
- Spread spectrum
- Collision-safe
4Master-Slave Polling
Master
Slave
Slave
Slave
- Master relays for slaves slaves cant talk
directly - Okay when peer-to-peer is less common that
client-server - Master is single point of failure
- Can pass more quickly by slaves with no data,
while still limiting time for those with backlog
5Token Passing
- Provide equal time slices to each station
- No starvation, predictable, possibly wasted slots
- Can be enforced by hardware
- Allows flexible time slices
- Possibility of starvation, more dynamic
- Broken link requires election
6Code Division Multiple Access (CDMA)
- Each unit is given a unique id known as a chip
sequence. - All chip sequences are the same length
- All chip sequences have the same number of 0s as
1s - A sender sends a 1-bit by transmitting its chip
sequence - A sender sends a 0-bit by transmitting the 1s
complement (flip each bit) of its chip sequence - Collision can occur, but will not destroy data
7CDMA, cont.
- Since each chip sequence must be of the same size
and have as many 0s as 1s, the dot-product of two
chip sequences is 0, unless they are the same, in
which case it is 1 - .
- When multiple stations transmit concurrently,
their signals add linearly - To ensure that their power is the same, they
transmit with the inverse power of the base
stationss signal strength - Sender and receiver must be synchronized for the
linear combination to work. This is accomplished
by training the receiver to the sender using a
known bit sequence.
8CDMA, cont
If we represent 0s and 1s as 1s and 1s, the dot
product of a chip sequence and itself is 1,
whereas the dot product of a chip sequence And
any other chip sequence is 0.
9CDMA, cont.
- Recall that collision will result in the linear
combination of chip sequences. - The dot product of this linear combination of
chip sequences and the senders chip sequence
will result in a 1 if the sender sent a 1 or a
1, otherwise. - The other sequences balance out and become 0.
The interesting chip sequence is multiplied by
itself, or the compliment of itself, yielding 1
or 1. - Consider 0101 vs 1010 vs 1100 vs 0011 vi 0110 vs
1001.
10Pure Aloha
- Circa 1970
- Originally developed at Univ. of Hawaii for use
across multiple campus on multiple islands - Avoided costly phone lines
- Illustrates the principles of a contention-based
MAC protocol on any broadcast media.
11Pure Aloha, Illustration
Coordinator
Station
Station
Station
Station
- Uplink is broadcast Any station can transmit at
any time - (Downlink was time-sliced)
- If ACK isnt received within RTT, assume lost
- Transmission problem/interference
- Collision detected by waiting for ACK, any
overlap destroys transmission - Retransmit after random time
- Wastes network time
- Can be lost, themselvesrepeat
12Pure Aloha, Collision Example
A
B
C
D
E
t
window of vulnerability (2t)
13Slotted Aloha
- Coordinator signals slot boundaries
- Tolerance needs to be built in for timing
signals transmission latency - Send only at beginning of slot.
- This reduces the window of vulnerability to a
single frames transmission time (1 slot) - Of course, if contention is low and collision is
not likely, it will increase average transmission
latency.
14Slotted Aloha, Collision
tic
tic
tic
tic
tic
tic
tic
tic
tic
tic
tic
tic
tic
A
B
C
D
E
t
window of vulnerability (t)
Potentially unnecessary delay
t
15Real Islands, Real problems
Coordinator King of the mountain
! mountains
- Stations cant hear each other. They cant listen
for garbled transmissions
16Carrier Sense Multiple Access (CSMA)
- But, what all stations can listen?
- if, instead of using slots, stations just
listen first, and only transmit if no one else
is? - This means that collisions would only occur in
the event of a tie two stations listened and
then transmitted? - This leads to much better performance the
window of vulnerability is very small just the
transmission latency.
17Persistent CSMA
- Under persistent CSMA stations continually sense
the channel and transmit as soon as it is free. - The problem is that a queue could have been
building up during the prior transmission. - This ensures almost certain collision to follow.
18Nonpersistent CSMA
- Nonpersistent CSMA will transmit immediately if
the channel is free. The recent past is a good
indicator of the near future. A collision isnt
likely. - If however, a station listens and hears a
transmission, it stops listening and waits a
random amount of time before trying again. - This helps to mitigate the queuing of requests
during a transmission from leading to a collision
19p-Persistent CSMA
- p is a parameter. It specifies the probability
with which a station should transmit upon
detecting an idle channel. - In other words, if the channel is free, a station
begins to transmit immediately with a probability
of p. - The other (1-p) time, the station waits a random
amount of time. After this random delay, it rolls
the dice again and transmits or waits,
accordingly. - This system is designed to further reduce the
likelihood of collision by spreading out bursts.
20Quiet _at_ it!
- Why do stations keep transmitting during a
collision? - Consider Aloha used radios
- Most cant concurrently transmit and receive (to
protect receiver), so they cant hear the
garbling - Even if they could listen while transmitting,
theyd likely only hear self - Signal weakens with inverse-square, so they
out-power other sender - These assumptions change if medium isnt radio,
but instead copper wire.
21CSMA/CD
- Another level of sophistication is the addition
of collision detection. - Ethernet
- Stations listen while transmitting
- If a station hears something different than what
it is sending, it immediate stops - What it hears is different from what it sends, if
another transmission garbles the original. - IEEE 802.3 (including Ethernet) protocols are
1-persistent CSMA/CD.
22CSMA/CD Jamming Signal
- What if two colliding signals, propagating in
opposite directions, cancel each other out? - If any station detects a collision, it sends a
jamming signal to make sure that the colliding
signals dont cancel each other out, preventing
detection after attenuation. - This reduces the time wasted in the event of a
collision sending already garbled packets.
23CSMA/CD Min. Frame Size
- Because of latency, collisions cannot be detected
immediately. This signal from one transmitter
much reach the other transmitter. - In practice, this imposes a minimum size on the
length of a frame. The frame must be long enough
to permit a collision to be detected. - If the frame is too short, it will be gone before
the signal from one transmitter reaches another. - The frames will be corrupted as the cross in the
mail - But neither sender will be able to detect it,
until the whole frame has been sent, which
defeats the purpose.
24Minimum Frame Size for CSMA/CD
- The frame needs to be sufficiently long to
require more than a round-trip time for
transmission. - We must consider the bit-rate of the channel as
well as its length to determine the round trip
time. - The frame must require more than this round-trip
time for transmission or the sender wont
necessarily still be transmitting when the
conflicting signal is first heard.
BS
- B bits/second
- S seconds
- BS bit time
Sender1
Sender2
Sender 1 must wait for its frame to (almost) make
it to Sender2, when the collision occurs, and
then for the energy from Sender2s frame to make
it back, before detecting the collision.
Sender2 detects the Collision almost immediately
25CSMA/CD Observations
- Frame size is a function of
- Wire size
- Transmission speed
- So
- Faster speeds or longer wires imply larger frames
- Smaller frames require slower speeds or shorter
wires - Consider the bandwidth-delay product
- Minimum frame size
- (2length)/propagation_speedbit_rate
- Think of it this way
- How much time does it take a single to make a
round trip? - (2length) X propagation speed (distance/s)
- How fast are bits being placed on the wire?
- bit-rate (b/s)
- How many bits are placed on the wire during this
round trip? - (2length)/propagation_speedbit_rate
26Can we use Carrier Detection Over a Satellite?
- Nope. Why not?
- Stations transmit up to a satellite, which then
echo everything back down. - Stations cant sense each others transmissions,
until they are echoed back down the
transmitters are too far apart and focused on the
satellite. - The propagation delay between the transmission to
the satellite and the echo back down is about
270ms - Throughput might be on the order of 36Mbps
- Consider the size of the frame needed to detect
collision.
27What Mountains Back to Wireless
- Consider shorter-range wireless No Mountains
- But, still challenges Reachability is not
transitive - A can reach B
- B can Reach C
- A cannot reach C
A
B
C
D
28What Mountains Back to Wireless
- A and C cant hear each other
- Cant detect that they are colliding at B
- A and C are hidden from each other
- B can hear and C, but C and A cant hear each
other - C hears B transmit to A, so B waits before
transmitting to D - This is unnecessary, because D cant hear B
- B and D are both exposed to C
A
B
C
D
29MACA Multiple Access with Collision Avoidance
- Dont assume we know what the receiver can hear.
Instead, ask the receiver - Request to send (RTS) w/data size (number of
frames) - If RTS not ACKed, assume collision
- Data should also be ACKed (to let other senders
know they can RTS)
30MACA Example
A
B
C
D
- White RTS from B to C (heard also by A)
- White-Dashed RTS-ACK from C to B (heard also by
D) - Black Data from B to C (heard also by A)
- Black-Dashed Data-ACK from C to B (heard also by
D)
31MACA Example Another View
A
B
C
D
Not intended recipient
Not intended recipient