Lecture 16: QoS and 802.11 CSE 123: Computer Networks Chris Kanich Prj2 due for full credit 11:59pm Lecture 16 Overview QoS followup: Packet Scheduling Fair Queueing Fluid Flow 802.11 Wireless CSMA/CA Hidden Terminals RTS/CTS CSE 123 – Lecture 16: QoS and 802.11 2 Scheduling So far we’ve done flow -based traffic policing Limit the rate of one flow regardless the load in the network In general, need scheduling Dynamically allocate resources when multiple flows compete Give each “ flow ” (or traffic class) own queue (at least theoretically) Weighted fair queuing Proportional share scheduling Schedule round-robins among queues in proportion to some weight parameter CSE 123 – Lecture 15: Routers and QoS 3 1
(Weighted) Fair Queuing Flow 1 Flow 2 I/P O/P Flow n CSE 123 – Lecture 15: Routers and QoS 4 Fair Queuing Maintain a queue for each flow What is a flow? Implements max-min fairness: each flow receives min ( r i , f ) , where r i – flow arrival rate f – link fair rate (see next slide) Weighted Fair Queuing (WFQ) – associate a weight with each flow CSE 123 – Lecture 15: Routers and QoS 5 Fair Rate Computation If link congested, compute f such that f = 4 : 8 10 4 min(8, 4) = 4 6 4 min(6, 4) = 4 2 min(2, 4) = 2 2 CSE 123 – Lecture 15: Routers and QoS 6 2
TCP vs. UDP CSE 123 – Lecture 15: Routers and QoS 7 TCP vs. UDP w/Fair Queuing CSE 123 – Lecture 15: Routers and QoS 8 Another Example Associate a weight w i with each flow i If link congested, compute f such that f = 2 : 8 ( w 1 = 3) 10 4 min(8, 2*3) = 6 6 4 ( w 2 = 1) min(6, 2*1) = 2 2 min(2, 2*1) = 2 2 ( w 3 = 1) Flow i is guaranteed to be allocated a rate >= wi *C/( Σ k w k ) If Σ k w k <= C , flow i is guaranteed to be allocated a rate >= w i CSE 123 – Lecture 15: Routers and QoS 9 3
Fluid Flow Flows can be served one bit at a time WFQ can be implemented using bit-by-bit weighted round robin During each round from each flow that has data to send, send a number of bits equal to the flow ’ s weight CSE 123 – Lecture 15: Routers and QoS 10 Fluid Flow Example link Orange flow has packets backlogged between time 0 and 10 flows Other flows have packets weights continuously backlogged 5 1 1 1 1 1 All packets have the same size 0 2 4 6 8 10 15 CSE 123 – Lecture 15: Routers and QoS 11 Packet-Based Implementation Packet (Real) system: packet transmission cannot be preempted. Why? Solution: serve packets in the order in which they would have finished being transmitted in the fluid flow system CSE 123 – Lecture 15: Routers and QoS 12 4
Packet-Based Example Service in fluid flow system 0 2 4 6 8 10 Select the first packet that finishes in the fluid flow system Packet system 0 2 4 6 8 10 CSE 123 – Lecture 15: Routers and QoS 13 Infrastructure vs. Ad hoc infrastructure network AP: Access Point AP AP wired network AP ad-hoc network CSE 123 – Lecture 16: QoS and 802.11 14 IEEE 802.11 Infrastructure mobile terminal fixed terminal infrastructure application application network TCP TCP access point IP IP LLC LLC LLC 802.11 MAC 802.11 MAC 802.3 MAC 802.3 MAC 802.11 PHY 802.11 PHY 802.3 PHY 802.3 PHY CSE 123 – Lecture 16: QoS and 802.11 15 5
802.11 Frame Format Synchronization synch., gain setting, energy detection, frequency offset compensation SFD (Start Frame Delimiter) 1111001110100000 Signal data rate of the payload (0A: 1 Mbit/s DBPSK; 14: 2 Mbit/s DQPSK) Service Length future use, 00: 802.11 compliant payload length HEC (Header Error Check) protection of signal, service and length, x 16 +x 12 +x 5 +1 128 16 8 8 16 16 variable bits synchronization SFD signal service length HEC payload PLCP preamble PLCP header CSE 123 – Lecture 16: QoS and 802.11 16 WLAN: IEEE 802.11b Data rate 1, 2, 5.5, 11 Mbit/s User data rate max. approx. 6 Mbit/s Transmission range 300m outdoor, 30m indoor Max. data rate ~10m indoor Frequency Free 2.4 GHz ISM-band CSE 123 – Lecture 16: QoS and 802.11 17 Physical Channels 12 channels available for use in the US Each channel is 22 MHz wide Only 3 orthogonal channels Using any others causes interference US (FCC)/Canada (IC) channel 1 channel 6 channel 11 2400 2412 2437 2462 2483.5 [MHz] 22 MHz CSE 123 – Lecture 16: QoS and 802.11 18 6
Carrier Sense Multiple Access CSMA : listen before transmit: If channel sensed idle: transmit entire pkt If channel sensed busy, defer transmission Persistent CSMA: retry immediately with probability p when channel becomes idle (may cause instability) Non-persistent CSMA: retry after random interval CSE 123 – Lecture 16: QoS and 802.11 19 Hidden Terminal Problem A B C B can communicate with both A and C A and C cannot hear each other Problem When A transmits to B, C cannot detect the transmission using the carrier sense mechanism If C transmits, collision will occur at node B Solution Hidden sender C needs to defer CSE 123 – Lecture 16: QoS and 802.11 20 CSMA/CA Cannot detect collision w/half-duplex radios Wireless MAC protocols often use collision avoidance techniques, in conjunction with a (physical or virtual) carrier sense mechanism Collision avoidance Nodes negotiate to reserve the channel. Once channel becomes idle, the node waits for a randomly chosen duration before attempting to transmit. CSE 123 – Lecture 16: QoS and 802.11 21 7
RTS/CTS (MACA) A B C When A wants to send a packet to B, A first sends a Request-to-Send (RTS) to B On receiving RTS, B responds by sending Clear-to- Send (CTS), provided that A is able to receive the packet When C overhears a CTS, it keeps quiet for the duration of the transfer Transfer duration is included in both RTS and CTS CSE 123 – Lecture 16: QoS and 802.11 22 Backoff Interval Problem: With many contending nodes, RTS packets will frequently collide Solution: When transmitting a packet, choose a backoff interval in the range [0, CW] CW is contention window Wait the length of the interval when medium is idle Count-down is suspended if medium becomes busy Transmit when backoff interval reaches 0 Need to adjust CW as contention varies CSE 123 – Lecture 16: QoS and 802.11 23 Non-symmetric ranges Carrier sense Interference range “ range ” DATA A A B C D E F F Transmit “ range ” CSE 123 – Lecture 16: QoS and 802.11 24 8
802.11 MAC Modes Distributed Coordination Function (DCF) CSMA/CA collision avoidance via randomized “ back-off “ mechanism minimum distance between consecutive packets ACK packet for acknowledgements (not for broadcasts) DCF w/ RTS/CTS Distributed Foundation Wireless MAC avoids hidden terminal problem Point Control Fuction (PCF) - optional Access point polls terminals according to a list We ’ re not going to discuss… CSE 123 – Lecture 16: QoS and 802.11 25 IEEE 802.11 DCF DCF is CSMA/CA protocol Uses a Network Allocation Vector (NAV) to implement collision avoidance DCF suitable for multi-hop ad hoc networking Optionally uses RTS/CTS exchange to avoid hidden terminal problem Any node overhearing a CTS cannot transmit for the duration of the transfer Uses ARQ to provide reliability CSE 123 – Lecture 16: QoS and 802.11 26 IEEE 802.11 RTS = Request-to-Send RTS A B C D E F Pretending a circular range CSE 123 – Lecture 16: QoS and 802.11 27 9
IEEE 802.11 NAV = remaining duration to keep quiet RTS = Request-to-Send RTS A B C D E F NAV = 10 CSE 123 – Lecture 16: QoS and 802.11 28 IEEE 802.11 CTS = Clear-to-Send CTS A B C D E F CSE 123 – Lecture 16: QoS and 802.11 29 IEEE 802.11 CTS = Clear-to-Send CTS A B C D E F NAV = 8 CSE 123 – Lecture 16: QoS and 802.11 30 10
IEEE 802.11 • DATA packet follows CTS. Successful data reception acknowledged using ACK. DATA A B C D E F CSE 123 – Lecture 16: QoS and 802.11 31 IEEE 802.11 Reserved area ACK A B C D E F CSE 123 – Lecture 16: QoS and 802.11 32 Binary Exponential Backoff When a node fails to receive CTS in response to its RTS, it increases the contention window CW is doubled (up to an upper bound) More collisions longer waiting time to reduce collision When a node successfully completes a data transfer, it restores CW to CW min CSE 123 – Lecture 16: QoS and 802.11 33 11
802.11 Backoffs SIFS (Short Inter Frame Spacing) highest priority, for ACK, CTS, polling response PIFS (PCF IFS) medium priority, for time-bounded service using PCF DIFS (DCF, Distributed Coordination Function IFS) lowest priority, for asynchronous data service DIFS DIFS PIFS SIFS medium busy contention next frame t direct access if medium is free DIFS CSE 123 – Lecture 16: QoS and 802.11 34 DCF Example B1 = 25 B1 = 5 wait data data wait B2 = 10 B2 = 20 B2 = 15 B1 and B2 are backoff intervals cw = 31 at nodes 1 and 2 CSE 123 – Lecture 16: QoS and 802.11 35 Fragmentation DIFS RTS frag 1 frag 2 sender SIFS SIFS SIFS SIFS SIFS CTS ACK 1 ACK 2 receiver NAV (RTS) NAV (CTS) DIFS NAV (frag 1 ) data other NAV (ACK 1 ) stations t contention CSE 123 – Lecture 16: QoS and 802.11 36 12
Recommend
More recommend