Chapter 2 Multiple Access Protocols Professor Rick Han University of Colorado at Boulder...
-
date post
21-Dec-2015 -
Category
Documents
-
view
223 -
download
4
Transcript of Chapter 2 Multiple Access Protocols Professor Rick Han University of Colorado at Boulder...
Chapter 2Multiple Access Protocols
Professor Rick HanUniversity of Colorado at Boulder
Prof. Rick Han, University of Colorado at Boulder
Announcements
• Email/Hand in HW #1 in class Thursday Jan. 29
• Programming assignment #1 is online and is due Feb. 10• Dora submission
• No TA office hours this week• Next, Chapter 2, Media Access Protocols
Prof. Rick Han, University of Colorado at Boulder
Recap of Previous Lecture• Stop-and-Wait• Sliding Window protocols – keep the bit
pipe full• Go-Back-N• Window-based Flow Control• Selective Repeat Protocol
• Preview of Shared-media protocols
Prof. Rick Han, University of Colorado at Boulder
Shared-Media or Broadcast Networks
• N senders and receivers connected by a shared medium (copper wire, atmosphere, water)
• Shared local access to the same media• Local Area Network (LAN)
• Ethernet, Fast Ethernet, Gigabit Ethernet, …• Wireless Ethernet, or 802.11 a/b/g, or WiFi
Ethernet (802.3) 802.11/WirelessEthernet
Prof. Rick Han, University of Colorado at Boulder
Multiple Access Protocols
• Determine which host is allowed to transmit next to a shared medium• Channel reservation: TDMA, FDMA, CDMA,
Token Ring, …• Random access: ALOHA, CSMA/CD, CSMA/CA
Ethernet 802.11/WirelessEthernet
Prof. Rick Han, University of Colorado at Boulder
Multiple Access Protocols (2)
• Also called Medium-Access Control (MAC) protocols
• Before data link-layer packets can be sent, a sender has to gain access to the media • MAC layer is often placed in
the stack between layer 2 and layer 1
Physical Layer
MAC Layer
Host A
Data LinkLayer
Prof. Rick Han, University of Colorado at Boulder
Time Division Multiple Access (TDMA)
• Divide time into multiple slots• Each host sends in a pre-determined slot• Out-of-band reservation mechanism• Compare to Time Division Multiplexing (TDM)
… …2 3 11 2 3 1 2 3
Host 1
Host 2
Host 31
2
3
Not Eth.
Router/Mux
1
2
12
Prof. Rick Han, University of Colorado at Boulder
Frequency Division Multiple Access (FDMA)
• Divide spectrum into frequency bins• Each host sends in a pre-determined
frequency bin• Out-of-band reservation mechanism (FCC)• Also called Frequency Division Multiplexing
(FDM)• Example: AM/FM radio, TV
AM500-1700 KHz
FM88-108 MHz
SatelliteGHz range
Freq.(Hz)
Host 1 Host 2 Host 3
Prof. Rick Han, University of Colorado at Boulder
Code Division Multiple Access (CDMA)
• Use multiple orthogonal codes to partition a range of spectrum
• Each host sends using a pre-determined code• Also called “spread spectrum”
• Two forms spread spectrum:• Direct-Sequence Spread Spectrum– DSSS
• Chipping sequences spread the signal’s spectrum
• CDMA is often used as synonym for DSSS• Examples: 802.11b, cell
• Frequency-hopping spread spectrum– FHSS• Example: Bluetooth• Advantage: simple, but not as efficient
Prof. Rick Han, University of Colorado at Boulder
Code Division Multiple Access (CDMA) (2)
• Frequency hopping example
BluetoothHost 1’s Code: 1342, Host 2’s Code: 3214, Host 3’s Code: 4123Note that all 3 codes are orthogonal: at each instant in time, each host is on a different frequency
Host 1
Host 2
Host 3
F1 F2 F3Freq (Hz)
F4
F1 F2 F3
…, F1, F3, F4, F2, F1, F3, F4, F2, …
Possiblehoppingsequence
F4
Prof. Rick Han, University of Colorado at Boulder
Random Access/MAC Protocols
• Multiple users share the same frequency band and/or same time and/or same code• Analogy: conversation in a crowded room
• What protocol steps do people use to talk in the same room (shared media)?• Important factors:
• Wait for silence• Then talk• Listen while talking.• What do we do if there’s 2 talkers?
Backoff.• Repeat
• Protocols also add a random increasing timeout
Prof. Rick Han, University of Colorado at Boulder
Random Access: ALOHA Protocol
• Developed at University of Hawaii in 1971 by Abramson• Ground-based UHF radios connect computers
on several island campuses to main university computer on Oahu
• “pure” ALOHA: hosts transmit whenever they have information to send – form of random access• Collision will occur when two hosts try to
transmit packets at the same time• Hosts wait a timeout=1 RTT for an ACK. • If no ACK by timeout, then wait a randomly
selected delay to avoid repeated collisions, then retransmit
Prof. Rick Han, University of Colorado at Boulder
Random Access: ALOHA Protocol (2)
• Collision of packets can occur when a packet overlaps another packet
Packet A
Packet CPacket B
time
T0
Collision Collision
Wasted TimeColliding with B
Wasted Time Due to a Collision = 2 packet intervals
Prof. Rick Han, University of Colorado at Boulder
Random Access: Slotted ALOHA
• Rather than sending a packet at any time, send along time slot boundaries• Collisions are confined to one time slot
Packet A
Packet CPacket B
time
T0
CollisionNo
Collision
Wasted Time Due to a Collision = 1 packet interval
Prof. Rick Han, University of Colorado at Boulder
Random Access: Slotted ALOHA (2)
• How do hosts synchronize to begin transmitting along time slot boundaries?• One central station transmits a
synchronization pulse or beacon
• Slotted ALOHA is more efficient than ALOHA because when there is a collision, the wasted time is confined to one time slot• Assuming Poisson packet arrivals
(memoryless), can compute the maximum throughput of ALOHA to be 18%.
• Maximum throughput of Slotted ALOHA is 37%
• Why are ALOHA & slotted ALOHA so inefficient?
Prof. Rick Han, University of Colorado at Boulder
Random Access: CSMA • ALOHA & slotted ALOHA are inefficient
because hosts don’t take into account what other hosts are doing before they transmit• “Talk-before-listen” protocols• Example: at party, everyone speaks whenever
they want to, regardless of whether another person is speaking
• Instead, “listen before you talk” = Carrier Sense Multiple Access (CSMA)• Sense for “carriers” (see if anyone else is
transmitting) before you begin transmittingPacket A timeHost Blistens
Packet B Packet YPacket X
Host B sendsdelay Collision still possibleover long prop. delays
Prof. Rick Han, University of Colorado at Boulder
Random Access: 1-Persistent CSMA
• If channel is busy,• A host listens continuously• When channel becomes free, a host transmits its
packet immediately (with probability 1)
Packet Atime
Host B listens
Packet B Packet YPacket X
Host B sends Collision
• Collision scenarios• Hosts A and B are far apart (long prop. delay).
A’s signal takes a long time to reach B. So, B thinks channel is free, and begins transmitting.
• Hosts B and C transmit as soon as A finishes• Still, CSMA is more efficient than ALOHA variants
Prof. Rick Han, University of Colorado at Boulder
Random Access: p-Persistent CSMA
• Generalization of 1-persistent CSMA• Typically applied to slotted channels• Slot length is chosen as maximum propagation
delay
• A host senses the channel, and• If slot is idle, transmit with probability p, or
defer with probability q=1-p• If next slot is idle, transmit with probability p,
or defer with probability 1-p, repeat…• If channel is busy, then sense channel
continuously until it becomes free, begin again
Prof. Rick Han, University of Colorado at Boulder
Random Access: Non-Persistent CSMA
• Host does not sense channel continuously• Instead, if channel is busy,
• Wait/sleep a random interval before sensing again
• As with 1-persistent CSMA, as soon as channel is idle, then send a packet
• Random interval reduces collisions• Higher throughput than 1-persistent CSMA
when many sendersPacket A time
Host Blistens
Packet B
Host B sendsRandomSleep
Prof. Rick Han, University of Colorado at Boulder
Random Access: Ethernet CSMA/CD
• Ethernet uses CSMA/CD, i.e. CSMA with Collision Detection (CD)
• “Listen-while-talk” protocol• A host listens even while it is transmitting, and
if a collision is detected, stops transmitting
Packet Atime
Host Bsensescarrier
Packet B
delay
Host B starts sending
Packet B
Host B detects collisionAnd stops sending
Not transmitted
Prof. Rick Han, University of Colorado at Boulder
Random Access: Ethernet CSMA/CD (2)
• Can abort transmission sooner than end-of-packet if there is a collision• Can happen if prop. delays are long• Better efficiency than pure CSMA
• CSMA/CD doesn’t require explicit acknowledgement• Unlike CSMA, which requires an ACK or timeout
to detect a collision• Collision detection is built into the transmitter• When collision detected, begin retransmission
Prof. Rick Han, University of Colorado at Boulder
Random Access: Ethernet CSMA/CD (3)
• Exponential backoff strategy• When a collision is detected, a host waits for
some randomly chosen time, then retransmits a packet
• If a second collision is detected, a host doubles the original wait time, then retransmits the packet
• Each time there is another collision, the wait time is doubled before retransmission
• Variants:• At each retransmission, choose a random value from
the exponentially increasing wait time.• At each retransmission, choose randomly from
among a discrete set of values within exponentially increasing wait time
• Retransmit a finite # of times
Prof. Rick Han, University of Colorado at Boulder
Random Access: Ethernet CSMA/CD (4)
• CSMA/CD can be used with nonpersistent, 1-persistent, or p-persistent variants of CSMA
• Ethernet is synonymous with the IEEE 802.3 standard• Initial work on Ethernet at Xerox in early 70’s• Ethernet specifies 1-persistent CSMA/CD
• To extend an Ethernet, repeaters are placed.• Start to run into propagation delay issues and
noise amplification issues• Ethernet keeps its maximum length to 2500 m
to keep prop. delays tight, so that CSMA/CD responds well
Prof. Rick Han, University of Colorado at Boulder
Random Access: Ethernet CSMA/CD (5)
• Ethernet CSMA/CD requires a minimum size to a frame:
A BEthernet
Hosts A and B at opposite ends of the Ethernet
t t+d, d=prop. delay
B transmits @ time t+dJust before A’s packet arrives
B sees Collision at t+d,Transmits a “runt” packetB’s packet arrives at t+2d
Prof. Rick Han, University of Colorado at Boulder
Random Access: Ethernet CSMA/CD (6)
• If B’s packet arrives at A and A is no longer transmitting, then Host A will• Fail to detect the collision• thinks its packet got through• Thinks the incoming packet is a new packet
• Therefore, to detect a collision:• Minimum frame size >= 2*(prop. delay)*BW
A BEthernet
Hosts A & B at opposite ends of Ethernet
t t+d
B’s packet arrives at t+2d
Prof. Rick Han, University of Colorado at Boulder
Random Access: 802.11 “Wireless” Ethernet
• Employs CSMA/CA, i.e. CSMA with Collision Avoidance (CA)
• Hidden terminal effect• Example: B can hear A and C, but A and C
can’t hear each other. If A is sending B, C thinks channel is clear and starts sending => collision!
• Doesn’t happen in wired Ethernet, because hosts can hear each otherHost A
Collision
Host B Host C
Prof. Rick Han, University of Colorado at Boulder
Random Access: 802.11 “Wireless” Ethernet (2)
• How to handle the hidden terminal effect?• Host A sends a Request-To-Send (RTS)• Host B sends a Clear-To-Send (CTS)• Host C hears the CTS, and does not interrupt
transmission between A and B• This helps implement Collision Avoidance
Host A
Host C Suppresses Its Data
Host B Host CRTS
CTS CTS
Data
ACK