300 likes | 436 Views
MAC Layer. Coordinate access to a shared medium Requirements Efficiency Reliability Fairness Support priority Support group communication. MAC Layer (Cont.). Base technologies Frequency division multiple access (FDMA) Time division multiple access (TDMA)
E N D
MAC Layer • Coordinate access to a shared medium • Requirements • Efficiency • Reliability • Fairness • Support priority • Support group communication
MAC Layer (Cont.) Base technologies • Frequency division multiple access (FDMA) • Time division multiple access (TDMA) • Code division multiple access (CDMA) Access schemes • Centralized • GSM • IS-95 • Distributed • CSMA/CD (Ethernet) • CSMA/CA (wireless LAN)
Example MAC Protocols • Pure ALOHA • Transmit whenever a message is ready • Retransmit when ACK is not received • Slotted ALOHA • Time is divided into equal time slots • Transmit only at the beginning of a time slot • Avoid partial collisions • Increase delay, and require synchronization Problem: do not listen to the channel.
Example MAC Protocols • Carrier Sense Multiple Access (CSMA) • Listen before transmit • Transmit only when no carrier is detected • Variants • 1-persistent CSMA: transmit once no carrier is detected • CSMA/CD: abort the transmission when collision is detected (Ethernet) • Non-persistent CSMA: when carrier is detected, wait a random time before a retry (WLAN)
A B C Hidden Terminal Problem • 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
A B C Solution for Hidden Terminal Problem: MACA • 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
Reliability • Wireless links are prone to errors. High packet loss rate detrimental to transport-layer performance. • Mechanisms needed to reduce packet loss rate experienced by upper layers
A B C A Simple Solution to Improve Reliability • When B receives a data packet from A, B sends an Acknowledgement (ACK) to A. • If node A fails to receive an ACK, it will retransmit the packet
IEEE 802.11 Wireless MAC • Support broadcast, multicast, and unicast • Uses ACK and retransmission to achieve reliability for unicast frames • No ACK/retransmission for broadcast or multicast frames • Distributed and centralized MAC access • Distributed Coordination Function (DCF) • Basic CSMA/CA • RTS/CTS extension • Point Coordination Function (PCF) • contention-free polling for time-bounded service
IEEE 802.11 DCF • CSMA/CA • Wireless MAC protocols often use collision avoidance techniques, in conjunction with a (physical or virtual)carrier sense mechanism • Uses RTS-CTS exchange to avoid hidden terminal problem • Any node overhearing a CTS cannot transmit for the duration of the transfer • Once channel becomes idle, the node waits for a randomly chosen duration before attempting to transmit. • Uses ACK to provide reliability
IEEE 802.11 RTS = Request-to-Send RTS A B C D E F Pretending a circular range
IEEE 802.11 RTS = Request-to-Send RTS A B C D E F NAV = 10 NAV = remaining duration to keep quiet
IEEE 802.11 CTS = Clear-to-Send CTS A B C D E F
IEEE 802.11 CTS = Clear-to-Send CTS A B C D E F NAV = 8
IEEE 802.11 • DATA packet follows CTS. Successful data reception acknowledged using ACK. DATA A B C D E F
IEEE 802.11 ACK A B C D E F
CSMA/CA • Carrier sense • Physical carrier sense • Carrier sense threshold • Virtual carrier sense using Network Allocation Vector (NAV) • NAV is updated based on overheard RTS/CTS/DATA/ACK packets • Nodes stay silent when carrier sensed (physical/virtual) • Collision avoidance • Backoff intervals used to reduce collision probability
Backoff Interval • When transmitting a packet, choose a backoff interval in the range [0, CW] • CW is contention window • Count down the backoff interval when medium is idle • Count-down is suspended if medium becomes busy • Transmit when backoff interval reaches 0
B1 = 25 B1 = 5 (leftover) wait data data wait B2 = 10 (leftover) B2 = 20 B2 = 15 DCF Example B1 and B2 are backoff intervals at nodes 1 and 2 cw = 31
Backoff Interval • The time spent counting down backoff intervals is a part of MAC overhead • Important to choose CW appropriately • large CWlarge overhead • small CW may lead to many collisions (when two nodes count down to 0 simultaneously) • Dynamically change CW depending on collision occurrence
Binary Exponential Backoff in DCF • 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 CWmin
MILD Algorithm in MACAW • MACAW uses exponential increase linear decrease to update CW • When a node successfully completes a transfer, reduces CW by 1 • In 802.11 CW is restored to CWmin • In 802.11, CW reduces much faster than it increases • MACAW can avoid wild oscillations of CW when many nodes contend for the channel
802.11 Overhead Random backoff RTS/CTS Data Transmission/ACK • Channel contention resolved using backoff • Nodes choose random backoff interval from [0, CW] • Count down for this interval before transmission • Backoff and (optional) RTS/CTS handshake before transmission of data packet • 802.11 has large room for improvement
802.11 Frame Priorities • Short interframe space (SIFS) • For highest priority frames (e.g., RTS/CTS, ACK) • PCF interframe space (PIFS) • Used by PCF during contention free operation • DCF interframe space (DIFS) • Minimum medium idle time for contention-based services DIFS PIFS contentwindow Frame transmission Busy SIFS Time
802.11 Management Operations • Scanning • Association/Reassociation • Time synchronization • Power management
Scanning in 802.11 • Goal: find networks in the area • Passive scanning • Not require transmission • Move to each channel, and listen for Beacon frames • Active scanning • Require transmission • Move to each channel, and send Probe Request frames to solicit Probe Responses from a network
Association in 802.11 1: Association request 2: Association response AP 3: Data traffic Client
Reassociation in 802.11 1: Reassociation request New AP 3: Reassociation response 5: Send buffered frames 2: verifypreviousassociation Client 6: Data traffic Old AP 4: send buffered frames
Time Synchronization in 802.11 • Timing synchronization function (TSF) • AP controls timing in infrastructure networks • All stations maintain a local timer • TSF keeps timer from all stations in sync • Periodic Beacons convey timing • Beacons are sent at well known intervals • Timestamp from Beacons used to calibrate local clocks • Local TSF timer mitigates loss of Beacons
Power Management in 802.11 • A station is in one of the three states • Transmitter on • Receiver on • Both transmitter and receiver off (dozing) • AP buffers packets for dozing stations • AP announces which stations have frames buffered in its Beacon frames • Dozing stations wake up to listen to the beacons • If there is data buffered for it, it sends a poll frame to get the buffered data