Physical Layer

advertisement
CPSC 689: Discrete Algorithms
for Mobile and Wireless Systems
Spring 2009
Prof. Jennifer Welch
Lecture 2
 Topics:
 Introduction
 Physical Layer
 MAC Protocols part 1
 Sources:




Schiller, Ch 1-3
Balakrishnan, Ch 11
Vaidya, Ch 1-2, 4-5
MIT 6.885 Fall 2008 slides
Discrete Algs for Mobile Wireless Sys
2
Wireless Computing Vision
 Future of computing includes
 portable computers
 wireless communication
 Why portable computers? Many devices are
designed to move with people:
 cell phones, PDAs, cars, planes
 Why wireless communication?
 quick, for temporary purposes (e.g., tradeshow)
 unintrusive, for delicate situations (e.g., historic bldg)
 useful when no infrastructure (countryside, rugged
terrain, after a natural disaster)
Discrete Algs for Mobile Wireless Sys
3
Applications
 car of the future: cars driving in same area build
a local ad-hoc network, use to learn about
emergencies, keep safe distance
 emergencies: ambulance can send info about
injuried people to hospital from accident scene
 business: traveling salesman can keep laptop in
constant synch with company's database
 infotainment: as you travel, get up-to-date info
about nearby goods and services; buy tickets, etc.
Discrete Algs for Mobile Wireless Sys
4
From Vision to Reality
 System support for such applications is in its
infancy
 Open research areas from Schiller book:
 handle interference of radio transmissions
 use radio frequencies more efficiently
 political and social issues regarding control of the
spectrum
 tolerate high delays and variation in delays
 security (easier to eavesdrop on wireless)
 coordinate access to shared medium well
 routing, service discovery, etc. scalably and reliably
Discrete Algs for Mobile Wireless Sys
5
Protocol Stack
 Physical layer
 convert bit stream into (analog) signals and back
 Data link layer
 provide reliable connection between a sender and one
or more receivers (w/in range)
 Network layer (cf. IP)
 route packets from sender to receiver (not necessarily
w/in range)
 Transport layer (cf. TCP and UDP)
 establishes an end-to-end connection
 Application layer
Discrete Algs for Mobile Wireless Sys
6
Protocol Stack
Application
Application
Application
Transport
Transport
Transport
Network
Network
Network
Data link
Data link
Data link
Physical
Physical
Physical
not every node needs every layer
Discrete Algs for Mobile Wireless Sys
7
Implementing the Protocol Stack
 Physical layer: signals, antennas, etc.
 Data link layer: various "medium access control" (MAC)
protocols developed to help nodes coordinate when they
transmit to reduce likelihood of interference
 Network layer: Extensions to IP to deal with mobility have
been developed.
 addressing, routing, device location, handover between
networks
 Transport layer: Extensions to TCP have been developed.
 quality of service, flow control, congestion control
 Applications: new ones ("find closest parking place")
 service location, support for multimedia, adapt to variations in
transmission characteristics
Discrete Algs for Mobile Wireless Sys
8
Our Use of the Protocol Stack
 Use it as a rough organizing principle.
 Won't focus on mobile versions of IP or
TCP
 Use general idea of layers of abstraction
 Broader perspective of structuring mobile
and wireless systems
 not just mimicking wired Internet
Discrete Algs for Mobile Wireless Sys
9
Physical Layer: Overview
 Mobile devices communicate using radio broadcasts,
over radio spectrum.
 Only a limited set of frequencies for transmission.
 Communicating devices must share a common
medium.
 Concurrent communications by nearby nodes may interfere
with each other, so that a receiver may hear garbled signals.
 Antennas provide the coupling between the
transmitter and space, and between space and the
receiver.
 What is actually transmitted is an analog signal.
 Discrete information has to be encoded into analog signals.
Discrete Algs for Mobile Wireless Sys
10
Physical Layer
 Wireless transmission uses certain frequencies of
the electromagnetic spectrum
 very low: submarines, underwater
 infrared: connecting laptops and PDAs
 Data is encoded in signals
 Signals in radio transmission are usually sine
waves
 Amplitude, frequency and/or phase shift of a sine
wave are changed to represent different
information: called modulation
Discrete Algs for Mobile Wireless Sys
11
Physical Layer: Antennas
 Antennas convert electromagnetic energy between space
and a wire.
 Ideal antenna radiates equal power in all directions from a
point in space
 transmission: receiver gets signal
with sufficiently low error rate
 detection: receiver can detect
signal but error rate is too high
 interference: receiver cannot
detect signal but signal may
interfere with other xmissions by
adding to background noise
Discrete Algs for Mobile Wireless Sys
transmission
detection
interference
12
Physical Layer: Attenuation
 In a vacuum, received power is proportional to
1/d2, where d is distance of receiver from sender
 signal travels away from sender at speed of light
 signal is a wave with spherical shape
 sphere keeps growing and energy is equally distributed
over the sphere's surface
 surface area s = 4  d2
 In non-vacuum, signal decreases even faster due
to atmosphere ("path loss" or "attenuation")
 exponent between 2 and 4
Discrete Algs for Mobile Wireless Sys
13
Physical Layer: Propagation
 Types of propagation behaviors:
 groundwave (< 2 MHz): follow earth's surface; can
propagate long distances, penetrate objects (ex:
submarine communication)
 sky wave (2-30 MHz): waves bounce b/w ionosphere
and earth's surface, traveling around world (ex: short
wave radio)
 line-of-sight (> 30 MHz): waves follow a straight line
(ex: mobile phones, satellites)
 Obstacles are problem for line-of-sight:
 blocked, reflected, refracted, scattering, diffraction
 solution: additional antennas to fill in coverage gaps
Discrete Algs for Mobile Wireless Sys
14
Physical Layer: Propagation
 Because of all these physical effects, radio
signal behavior is highly variable
 depends on type of antenna and environment
 Example problem: 2-ray ground
propagation model:
Discrete Algs for Mobile Wireless Sys
15
Physical Layer: Bottom Line




Not every message sent is received
Loss due to noise and interference
Not easy to model in a realistic way
Mathematical models for propagation are not
accurate representations of real channel behavior.
 In practice, we want algorithms that can adapt to
real channel characteristics.
 Models are useful mainly for analysis and
simulation: get general idea of algorithms’
behavior, in some ideal cases
Discrete Algs for Mobile Wireless Sys
16
Physical Layer: Multiplexing
 Share the electromagnetic spectrum w/o
undue interference along several
dimensions:
 space, time, frequency, code
 Space division: senders are so far apart
they don't interfere
 Ex: FM radio stations in different towns w/
same frequency (90.9)
 Disadvantages: wastes space, what if senders
are close to each other?
Discrete Algs for Mobile Wireless Sys
17
Physical Layer: Multiplexing
 Frequency division: divide spectrum into
several non-overlapping frequency bands
 Ex: radio stations in same town use different
frequencies (90.9 vs. 89.1)
 Disadvantages: wastes frequency (unless
senders transmit all the time); fixed assignment
of frequency to sender is inflexible and limits
number of senders
Discrete Algs for Mobile Wireless Sys
18
Physical Layer: Multiplexing
 Time division: all senders use same
frequency but at different times
 Ex: different radio shows on the same station
but at different times
 Disadvantages: need precise synchronization;
receiver has to listen at right time
 Advantage: can assign more sending time to
senders with heavier load
Discrete Algs for Mobile Wireless Sys
19
Physical Layer: Multiplexing
 Code division:
 all users use same frequency at same time, each user
has different "code".
 With right choice of codes, transmissions can be done
simultaneously
 constructive interference properties of radio signals
allow the codes to be separated at receives
 Advantages: code space is huge, good protection
against interference and tapping
 Disadvantages: receiver must know code and separate
the desired information from background noise;
receiver must be synchronized with sender
Discrete Algs for Mobile Wireless Sys
20
Data Link Layer: Overview
 Medium Access Control (MAC) protocols try to
synchronize when nearby nodes transmit, in
order to reduce the likelihood of interference
 The "medium" is the communication resource
 Purpose: Achieve relatively reliable local
communication of packets (fixed-length
messages) among nearby devices.
 Both point-to-point and broadcast.
 Reasonable throughput (capacity).
 Reasonable fairness to each transmitter and
receiver.
Discrete Algs for Mobile Wireless Sys
21
Challenge for MAC Protocols
 Communication provided by physical layer is not very
reliable:
 Messages might not get delivered, because of noise or
interference (collisions).
 MAC layer should improve the reliability.
 Won’t make it perfect, in spite of many tricks.
 Main job of MAC layer: Manage contention among
nearby transmitters and receivers.
 Q: What are reasonable statements of the
guarantees of a MAC layer?
 Probabilistic delivery guarantees? Conditional?
 Layer should be efficiently implementable.
 Should support higher-level programming.
Discrete Algs for Mobile Wireless Sys
22
Reinventing the Wheel?
 Most of the complication is with schemes
based on time division multiplexing.
 There are MAC protocols in wired networks
(ex: Ethernet)
 Must they be changed to work in wireless
networks? If so, how?
Discrete Algs for Mobile Wireless Sys
23
CSMA/CD MAC Protocol for (Wired)
Ethernet
 Carrier Sense Multiple Access with Collision
Detection
 sender senses the medium (wire) to see if it is free
 if busy, sender waits until it is free
 once medium is free, sender starts transmitting data
and continues to listen
 if sender detects a collision while sending, it stops and
sends a jamming signal
 Ethernet hardware allows collision detection by
sender
Discrete Algs for Mobile Wireless Sys
24
Anomaly: Hidden Terminals
 Consider three wireless devices, A, B, and C, such that
 A and C can both reach B,
 A and C cannot reach each other, or even detect each other.
 A and C can both start transmitting to B.
 Since A and C cannot hear each other, they will not know anything
is wrong.
 But B receives both transmissions, garbled.
 A and C are “hidden” from each other.
 Problem does not
occur if detection
range is > 2X
transmission range.
A
Discrete Algs for Mobile Wireless Sys
B
C
25
Anomaly: Exposed Terminals
 Consider four wireless devices, A, B, C, and D, such that
 B can reach A, C can reach D,
 B and C can detect each other.
 A cannot detect C, D cannot detect B.
 B might want to transmit to A, and C to D.
 Since they hear each other’s transmissions, they might decide
they should not both transmit.
 But this would be OK: they would not interfere.
 B and C are “exposed” to each other.
A
B
C
Discrete Algs for Mobile Wireless Sys
D
26
Wireless MAC Protocol: Fixed TDM
 Algorithm:
 allocate time slots in a fixed pattern
 just wait for your time slot to send
 Evaluation:
 Gives fixed bandwidth: inefficient for
bursty data or asymmetric connections
 Requires time synchronization between
nodes
Discrete Algs for Mobile Wireless Sys
27
Time Synchronization
 For wireless local area networks (LANs), IEEE
802.11 standard:
 local nodes synchronize to one node, the beacon
 if there is infrastructure, beacon can be specified
 in ad-hoc case, use random backoff so that only one
node attempting to be a beacon succeeds
 Gives local synchronization, which is enough for a
LAN
 Later we will see more general, and more
complicated, methods
Discrete Algs for Mobile Wireless Sys
28
Trivial MAC protocol: Pure Aloha
 When packet arrives at transmitter, transmitter immediately
sends.
 Resolving collisions is responsibility of higher layer
 Q: What is the probability of a transmission succeeding?
 Window of vulnerability for a transmission:
 Interval in which a transmission from another sender can
interfere with reception.
 2L, where L is the length of the transmission interval.
 Assumes negligible propagation delay.
Transmission
Window of vulnerability
Discrete Algs for Mobile Wireless Sys
29
Slotted Aloha
 Assumes every transmission takes time L.
 Instead of transmitting at arbitrary points in time, divide time into
slots of length L and transmit only on slot boundaries.
 Reduces window of vulnerability by a factor of 2, to one slot:
Transmission
Window of vulnerability
 Requires synchronized clocks.
 If they are approximately synchronized, with bounded skew, we
must increase the slot size to compensate.
 Synchronized clocks are not so easy to achieve in large ad hoc
networks.
Discrete Algs for Mobile Wireless Sys
30
Success Probability in Slotted Aloha
 Simplifying assumptions:
 Each transmission takes one slot.
 n nodes
 Each has probability p of transmitting at each slot.
 Probability that a given transmission succeeds: (1-p)n-1.
 Probability that, in a given slot, a given node transmits
successfully: p (1-p)n-1 .
 Throughput = expected number of successful transmissions
per slot: n p (1-p)n-1 .
 Maximize throughput when p = 1/n, limiting value is 1/e.
Discrete Algs for Mobile Wireless Sys
31
Success Probability in Unslotted Aloha
 Probability that a given transmission succeeds: (1-p)2(n-1)
Because each other sender must avoid 2 “slots”.
 Probability that, in a given slot, a given node transmits
successfully: p (1-p)2(n-1)
 Throughput = expected number of successful transmissions
per slot: n p (1-p)2(n-1) .
 Maximize throughput when p = 1/(2n-1), limiting value is 1/(2e).
 Moral: Synchronizing sending on slot boundaries doubles the
throughput.
Discrete Algs for Mobile Wireless Sys
32
Techniques for Improving Throughput
Carrier sensing
Busy-tones
Link-layer Acks
Reservation-based strategies
Acks and reservations
Reducing collision probability
 p-persistence
 Backoff strategies
 TDMA
Discrete Algs for Mobile Wireless Sys
33
Carrier Sensing
 Determine whether the channel seems to be busy, before starting
to transmit.
 Sense the energy on the channel, see if it exceeds the Carrier
Sense (CS) Threshold.
 Choice of threshold is flexible:

Higher:
 More spatial reuse
 Smaller signal-to-noise ratio (SNR), so reliability of communication
is worse.

Lower:
 Less spatial reuse
 Larger SNR, so reliability is better.
 Tradeoff: Overall network throughput depend both on spatial
reuse and channels’ reliable transmission rates.
 Used in practical protocols like 802.11.
Discrete Algs for Mobile Wireless Sys
34
Problems with Carrier Sensing
 Doesn’t avoid all collisions.
 Hidden terminals:
 C does not detect that A is transmitting.
 Could lower threshold, but would get more “false positives”.
A
B
C
 Exposed terminals: C detects that B is transmitting.
A
B
C
Discrete Algs for Mobile Wireless Sys
D
35
Problems with Carrier Sensing
The problem: What we really care about is
collisions at the receiver, but carrier sensing
checks for collisions at the sender.
In wired networks, like Ethernet, these are
pretty much the same, but they’re different in
wireless networks.
Discrete Algs for Mobile Wireless Sys
36
Busy-Tones
 A simple strategy for avoiding collisions at
a receiver.
 Receiver who is successfully receiving a
transmission broadcasts a special “busy
tone” on a separate channel.
 Other nodes that receive the busy tone
delay transmission.
 Requires complex hardware to receive
message and broadcast busy-tone at the
same time.
Discrete Algs for Mobile Wireless Sys
37
Busy-Tones
 Solves hidden terminal problem:
 When B is receiving from A, its busy tone reaches
C.
 Still get collision if A and C start transmitting at just
the same time.
 But not very likely.
A
B
Discrete Algs for Mobile Wireless Sys
C
38
Link-Layer Acks




Messages sometimes fail to get through.
So it makes sense to retransmit.
But how does a sender know whether its message got through?
If the message has single intended target node, can use an Ackbased protocol:




Receiver sends an Ack message immediately after receiving a
message.
Sender sets timeout to a little more than the normal round-trip time,
resends if timeout expires.
Use sequence numbers for repeated receipts of the same data
packet.
Retransmit only a bounded number of times.
 To maintain some predictability for message delays.
 Also, because in mobile setting, the receiver could have moved
away.
Discrete Algs for Mobile Wireless Sys
39
Protecting the Acks



Need collision avoidance for Ack messages as well as the data
messages.
Loss of an Ack causes the data message to be retransmitted,
costly.
Solution 1: Defer for longer



Nodes that sense the channel as busy (using physical carrier
sensing) defer sending for a while after the channel becomes
free.
Enough time for the sender to receive an Ack.
Solution 2: Busy-tones for Acks


Nodes that sense the channel as busy (using physical carrier
sensing) defer sending for a very small time after the channel
becomes free.
Also, recipient of an Ack sends busy-tones, and anyone hearing
a busy-tone defers sending, as usual.
Discrete Algs for Mobile Wireless Sys
40
Download