cse cse 123123 computer networks - computer scienceprob. successful transmissionprob. successful...
TRANSCRIPT
CSE CSE 123123Computer NetworksComputer Networks
Fall 2009Fall 2009
Lecture 5: Lecture 5: Media Media AccessAccess
Some portions courtesy Srini Seshan or David Wetherall
Last TimeLast TimeLast TimeLast Time Framing: How to translate a bitstream into Framing: How to translate a bitstream into
separate packets101010111
…101010111001001111000010110 001001111
101010111
000010110
Today: media accessToday: media accessToday: media accessToday: media access How to share a channel among different g
hosts? Approaches
Channel partitioning» FDMA, TDMA, CDMA
Random access Random access» Contention-based
Aloha CSMA, CSMA/CD, CSMA/CA CSMA, CSMA/CD, CSMA/CA Ethernet, 802.11
» Contention-free Token-ring, FDDIg,
Channel partitioningChannel partitioningChannel partitioningChannel partitioning Problem Problem
Have channel that can support 10Mbps Have 5 hosts, who want to send 2Mbps of datap How to meet this need and use channel efficiently?
Solution Create 5 channels each 1/5th the size Next question: how to split the channel
Frequency Division Frequency Division Multiple Access (FDMA)Multiple Access (FDMA)Multiple Access (FDMA)Multiple Access (FDMA)
Divide channel with some bandwidth f Hz into n subchannels h i h b d id h f/ Heach with bandwidth f/n Hz
Assign different hosts to different channels Easy to implement, but unused subchannels go idle Used by traditional analog cell phone service, radio, TV
litud
ee
Am
pl
Frequency
Am
plitu
deA
Frequency
Time Division Multiple Access Time Division Multiple Access (TDMA)(TDMA)(TDMA)(TDMA)
Divide channel into time rounds of length t with n time slots in each roundeach round
Assign different hosts to different time slots within a round Unused time slots are idle Used (in conjunction with FDM) in GSM cell phones & digital Used (in conjunction with FDM) in GSM cell phones & digital
cordless phones
Example, rounds of 1 second, with 4 timeslots (250ms) per roundH t #Host #
1 2 3 31 2 4 2 4
1 sec 1 sec 1 sec1 sec 1 sec 1 sec
Code Division Multiple AccessCode Division Multiple AccessCode Division Multiple AccessCode Division Multiple Access
Very different, spread spectrum codingy , p p g All hosts use the whole channel all the time (?!?)
Assign different hosts a unique spreading code which encodes transmitted data to cover the entire channelReceivers apply same code to extract the Receivers apply same code to extract the source signal they want out of the channel
Used by cell phone networks using Qualcomm Used by cell phone networks using Qualcomm chipsets (e.g. Verizon, Sprint)
Magic
Channel partitioning summaryChannel partitioning summaryChannel partitioning summaryChannel partitioning summary
FDMAFDMA
pow
er
TDMApo
wer
CDMA
p
wer
pow
Courtesy Takashi Inoue
Problem w/Channel partitioningProblem w/Channel partitioningProblem w/Channel partitioningProblem w/Channel partitioning
Not terribly well suited for random access Not terribly well suited for random access usage. Why?
New problem How to do we share a single channel among g g
different hosts who want to send at different times?
AlohaAlohaAlohaAloha Designed in 1970 to explore wireless data g p
connectivity between Hawaiian Islands Goal: distributed access control (no central
bi ) h d b d t h larbitrator) over a shared broadcast channel
Al h t l i t h ll Aloha protocol in a nutshell: When you have data send it If data doesn’t get through (receiver sends If data doesn t get through (receiver sends
acknowledgement) then retransmit after a random delayWhy not a fixed delay? Why not a fixed delay?
ProblemProblemProblemProblem Any packet sent at t0 collide with other pkts Any packet sent at t0 collide with other pkts
sent in [t0-1, t0+1]
Slotted AlohaSlotted AlohaSlotted AlohaSlotted Aloha Time is divided into equal size slots (= pkt trans. time)q ( p ) 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
Success (S) Collision (C) Empty (E) slotsSuccess (S), Collision (C), Empty (E) slots
Slotted Aloha EfficiencySlotted Aloha EfficiencySlotted Aloha EfficiencySlotted Aloha EfficiencyQ: What is max fraction slots successful?A S N t ti h k t t dA: Suppose N stations have packets to send
Each transmits in slot with probability p Prob. successful transmission S is: At b t h l Prob. successful transmission S is:
single node: S = p (1-p)(N-1)
any of N nodes:S Prob (only one transmits)
At best: channelused for useful transmissions 37%of time!S = Prob (only one transmits)
S = N p (1-p)(N-1)
(optimal p as N->infinity = 1/N) 0.3
0.4
Slotted Aloha= 1/e = .37
0 5 1 0 1 5 2 0
0.1
0.2
Pure Aloha
Slotted Aloha
offered load = N X p0.5 1.0 1.5 2.0
Carrier Sense Multiple Access Carrier Sense Multiple Access (CSMA)(CSMA)(CSMA)(CSMA)
Both Aloha’s transmit even if another host is Both Aloha s transmit even if another host is transmitting (guaranteed collision)
Can do better by listening first to make sure y gchannel is idle
Effective if # of pkts on the channel is small (bw*delay/packet size) Wait how long to be confident channel is idle Small (<<1) for LANs, large (>>1) for satellites
How long to wait if channel is How long to wait if channel is busy?busy?busy?busy?
non-persistent CSMAp Send after some random delay Problem: may incur larger delay when channel is
idleidle 1-persistent CSMA
Send as soon as channel is idle Send as soon as channel is idle Problem: blocked senders all try to send at once
p-persistent CSMAp p If idle, send packet with probability p; repeat Make sure p * number of hosts < 1
CSMA with Collision Detection CSMA with Collision Detection (CSMA/CD)(CSMA/CD)(CSMA/CD)(CSMA/CD)
Even with CSMA there can still be collisions. Why?y
Time for B to detect A’s transmission
Xcollision
(wire)
A B For wired media we can detect all collisions and abort
(CSMA/CD):Requires a minimum frame size (“acquiring the medium”) Requires a minimum frame size ( acquiring the medium )
B must continue sending (“jam”) until A detects collision Tough for radio (hard to listen & xmit at same time…
t i ll h lf d l i l h l / it)typically half-duplex, single channel recv/xmit)
Collision Collision Detection Detection on the wire on the wire on the wire on the wire How can A know that a collision has taken place? How can A know that a collision has taken place?
Worst case: » Latency between nodes A& B is d» A sends a message at time t and B sends a message at t + d – epsilon (just before
receiving A’s message) B knows there is a collision, but not A… B must keep transmitting so A
knows that its packet has collided How long? 2 * d
IEEE 802.3 Ethernet specifies max value of 2d to be 51.2us IEEE 802.3 Ethernet specifies max value of 2d to be 51.2us This relates to maximum distance of 2500m between hosts At 10Mbps it takes 0.1us to transmit one bit so 512 bits (64B) take 51.2us
to send So Ethernet frames must be at least 64B long So, Ethernet frames must be at least 64B long
» 14B header, 46B data, 4B CRC» Padding is used if data is less than 46B
Send jamming signal after collision is detected to insure all hosts see collisioncollision 48 bit signal
EthernetEthernetEthernetEthernet First local area network (building in early ’70s by
Metcalfe and Boggs at Xerox PARC)Metcalfe and Boggs at Xerox PARC) Originally 1Mbps, now supports 10Mbps, 100Mbps,
1Gbps and 10Gbps flavors (40/100 in development) Currently the dominant LAN technology, becoming
the dominant WAN technology
Classic EthernetClassic EthernetClassic EthernetClassic Ethernet IEEE 802.3 standard wired LAN
(modified 1-persistent CSMA/CD) Classic Ethernet: 10 Mbps over coaxial cable
All nodes share same wire Max length 2.5km, max between stations 500m
(wire)
F i
nodes
Framing Preamble, 32bit CRC, variable length data Unique 48-bit address per host (bcast & multicast addrs too)q p ( )
CRC (4)Len (2)Preamble (8) Payload (var)Dest (6)Source (6) Pad (var)
Ethernet improvementsEthernet improvementsEthernet improvementsEthernet improvements Binary exponential backoff Binary exponential backoff
Problems with random delay with fixed mean» Few senders = unnecessary delay» Many senders = unnecessary collisions
Ethernet approach: balance delay w/load» First collision: wait 0 or 1 min frame times at random retry» First collision: wait 0 or 1 min frame times at random, retry» Second time: wait 0, 1, 2, or 3 times» Nth time (N<=10): wait 0, 1, …, 2N-1 times» Max wait 1023 frames, give up after 16 attempts
Capture EffectCapture EffectCapture EffectCapture Effect Randomized access scheme is not fair Randomized access scheme is not fair
Stations A and B always have data to send Stations A and B always have data to send They will collide at some time Both pick random number of “slots” (0, 1) to wait p ( , ) Suppose A wins and sends Next time the collide, B’s chance of willing is halved
(since B will select from 0,1,2,3 due to exponential backoff)
Winner keeps winning is said to have Winner keeps winning, is said to have “captured” the channel
Ethernet PerformanceEthernet PerformanceEthernet PerformanceEthernet Performance Much better than Aloha or CSMA in practice Much better than Aloha or CSMA in practice
Source of protocol inefficiency: collisionsSource of protocol inefficiency: collisions More efficient to send larger frames
» Acquire the medium and send lots of data
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 bandwidthwasted bandwidth
ContentionContention--free Protocolsfree ProtocolsContentionContention--free Protocolsfree Protocols Problem with channel partitioning Problem with channel partitioning
Inefficient at low load (idle subchannels) Problem with contention-based protocolsProblem 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 contentionTwo contention--free free approachesapproachesapproachesapproaches
Polling T k P iPolling Master node “invites” slave
nodes to transmit in turn Request to Send (RTS) Clear
Token Passing Control token passed from one
node to next sequentially.Point to point links can be fast Request to Send (RTS), Clear
to Send (CTS) messages Problems:
Polling overhead
Point-to-point links can be fast Problems:
Token overhead Latencyg
Latency Single point of failure (master)
Latency Single point of failure (token)
Token Ring (802 5)Token Ring (802 5)Token Ring (802.5)Token Ring (802.5)
C BC
D
Direction oftransmission
ADnodes
Token rotates permission to send around node Sender injects packet into ring and removes later
Maximum token holding time (THT) bounds access time Maximum token holding time (THT) bounds access time Early or delayed token release Round robin service, acknowledgments and priorities
Monitor nodes ensure health of ring (alerts on failures)
FDDI FDDI (Fiber Distributed Data Interface)(Fiber Distributed Data Interface)(Fiber Distributed Data Interface)(Fiber Distributed Data Interface)
Roughly a large, fast token ring Roughly a large, fast token ring 100 Mbps and 200km vs 4/16 Mbps and local Dual counter-rotating rings for redundancyg g y Complex token holding policies for voice etc. traffic
Break! Token ring advantages
No contention, bounded access delay
Break!
Support fair, reserved, priority access Disadvantages
Complexity, reliability, scalability
Why Did Ethernet Win?Why Did Ethernet Win?Why Did Ethernet Win?Why Did Ethernet Win? Failure modes
Token rings – network unusable Ethernet – node detached
Good performance in common case Good performance in common case Volume lower cost higher volume …. Adaptable
To higher bandwidths (vs. FDDI) To switching (vs. ATM)
Completely distributed, easy to maintain/administerp y , y Easy incremental deployment Cheap cabling, etc
Wireless Media AccessWireless Media AccessWireless Media AccessWireless Media AccessWireless is more complicated than wired …p
Cannot detect collisions Transmitter swamps co-located receiver Collision avoidance
Different transmitters have different coverage areas Asymmetries lead to hidden/exposed terminal problems Also use contention-free protocols (RTS/CTS)
Hidden TerminalsHidden TerminalsHidden TerminalsHidden Terminals
A B C
transmit range
A and C can both send to B but can’t hear each other
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
CSMA will be ineffective – want to sense at receiver
Exposed TerminalsExposed TerminalsExposed TerminalsExposed Terminals
A B C D
B C can hear each other but can safely send
transmit range
B, C can hear each other but can safely send to A, D
CSMA with Collision CSMA with Collision Avoidance (CSMA/CA)Avoidance (CSMA/CA)Avoidance (CSMA/CA)Avoidance (CSMA/CA)
Since we can’t detect collisions, we try to avoid them, y
When medium busy, choose random interval (contention window) Wait for that many idle timeslots to pass before sending Remember p-persistence … a refinement 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
RTS / CTS Protocols (MACA)RTS / CTS Protocols (MACA)RTS / CTS Protocols (MACA)RTS / CTS Protocols (MACA)
B C DRTS
CTSA
Overcome exposed/hidden terminal problems with contention-free protocol1. B stimulates C with Request To Send (RTS)
A hears RTS and defers to allow the CTS2. A hears RTS and defers to allow the CTS3. C replies to B with Clear To Send (CTS)4. D hears CTS and defers to allow the data5. B sends to C
IEEE 802 11 Wireless LANIEEE 802 11 Wireless LANIEEE 802.11 Wireless LANIEEE 802.11 Wireless LAN 802.11b 802.11a
2.4-5 GHz unlicensed radio spectrum
up to 11 Mbps
5-6 GHz range up to 54 Mbps
802.11g up to 11 Mbps direct sequence spread
spectrum (DSSS) in physical layer
g 2.4-5 GHz range up to 54 Mbps
All use CSMA/CA forphysical layer» All hosts use same code
Widely deployed, using base stations
All use CSMA/CA for multiple access
Optional RTS/CTS All have base station andbase stations All have base-station and
ad-hoc network versions
IEEE 802 11 Wireless LANIEEE 802 11 Wireless LANIEEE 802.11 Wireless LANIEEE 802.11 Wireless LAN Wireless host communicates with a base station
Base station access point (AP) Base station = access point (AP) Basic Service Set (BSS) (a.k.a. “cell”) contains:
Wireless hosts Access point (AP): base station
BSS’s combined to form distribution system (DS)
Ad Hoc NetworksAd Hoc Networks Ad hoc network: IEEE 802.11 stations can dynamically
Ad Hoc NetworksAd Hoc Networks Ad hoc network: IEEE 802.11 stations can dynamically
form network without AP Theoretical Applications:
Laptops meeting in conference room, car Interconnection of “personal” devices
R i ti Rare in practice
802 11 Twists802 11 Twists802.11 Twists802.11 Twists How to support different speeds on same channel?pp p
Physical layer header encoded at lowest bitrate and indicates bitrate of rest of packet
Network Allocation Vector (NAV) Network Allocation Vector (NAV) Each frame contains field that indicates the amount of time
that will be used for the communication (channel reservation)f f All receivers defer xmit for that time
Allows for long or multi-frame exchange
RTS/CTS used as function of packet sizeS/C S used as u c o o pac e s e Why?
Misc issue: Misc issue: Addressing AlternativesAddressing AlternativesAddressing AlternativesAddressing Alternatives
On a broadcast channel all nodes receive all packetsp Addressing determines which packets are kept and which are
packets are thrown away Packets can be sent to:
» Unicast – one destination» Multicast – group of nodes (e.g. “everyone playing Quake”)» Broadcast – everybody on wire
Dynamic addresses (e.g. Appletalk) Pick an address at random Broadcast “is anyone using address XX?” If yes, repeat
Static address (e.g. Ethernet, 802.11, TokenRing, etc)( g , , g, )
IEEE addressing (Ethernet,etc)IEEE addressing (Ethernet,etc)IEEE addressing (Ethernet,etc)IEEE addressing (Ethernet,etc)
Addresses: 6 bytes (48bits)y ( ) Each adapter is given a globally unique address at
manufacturing time ($$$)» Address space is allocated to manufacturers» Address space is allocated to manufacturers
24 bits identify manufacturer E.g., 0:0:15:* 3com adapter
» Frame is received by all adapters on a LAN and dropped if y p ppaddress does not match
Special addresses» Broadcast – FF:FF:FF:FF:FF:FF is “everybody”» Range of addresses allocated to multicast
Adapter maintains list of multicast groups node is interested in
Practical problems: non-unique addressesp q
SummarySummarySummarySummary Ways to share a channely
Subdivide the channel into subchannels Contention-based protocols
» Try and retry if it fails» Try and retry if it fails Contention-free protocols
» Explicit control over who gets to send at each time
f Particular issues for wireless Hidden/exposed terminal problems
Addressing Addressing
For next time: bridging/switching, read 3.2, 3.1g g g
Backup: End to End Delay in Backup: End to End Delay in EthernetEthernetEthernetEthernet
c in cable = 60% * c in vacuum = 1.8 x 10^8 m/s Modern 10Mb Ethernet
2.5km, 10Mbps ~= 12.5us delay +Introduced repeaters (max 5 segments) Worst case – 51.2us round trip time!
Slot time = 51.2us = 512bits in flight After this amount, sender is guaranteed sole access to link
51 2us slot time for backoff 51.2us = slot time for backoff