Wireless (WLAN) Medium Access Control Sublayer Mahalingam Mississippi State University, MS October 20, 2014
Outline Medium Access Protocols Wireless (WLAN) 1 Medium Access Protocols ALOHA Slotted ALOHA CSMA 2 CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 3 Wireless (WLAN) IEEE 802.11 4 5
Terminology Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA n stations sharing a channel Contention for channel access Collision occurs when packets from any two stations overlap Packet start times can be continuous or slotted Carrier sensing sensing the medium to check if it is in use Packets generated by the network layer of stations Generated packets are transmitted Some packets collide will need to be retransmitted Number of transmitted packets number of generated packets.
Three Scenarios Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA Medium access protocols can be classified into three broad types depending on the nature of the medium and ability to sense the medium ability to detect collisions Scenario 1: Stations contending for the medium cannot sense transmissions from other stations (eg., Satellite communication) Scenario 2: Stations able to sense transmissions by other stations, but cannot listen and transmit at the same time (Short-range wireless). Scenario 3: Stations can sense the medium, and can listen and transmit at the same time ()
ALOHA Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA n stations share a medium Stations transmit whenever they have a packet that needs to be transmitted ACK sent by the receiver. If no ACK received, stations wait for a random amount of time and retransmit. Assume all packets are of the same duration (we will use that as the unit of time)
ALOHA Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA User A B C D E Time
Poisson Distribution Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA What is the probability that an event will occur exactly k times during an interval? 0 times? once? twice? 3 times? For Poisson distribution mean is the same as variance Poisson distribution with mean a (and variance a) represented as Pr{k} = ak e a k! Pr{k} is the probability of exactly k occurrences in an unit interval For example, Pr{0} = e a, Pr{1} = ae a. The mean and variance of a Poisson distribution are the same
ALOHA Analysis Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA Number of stations is very large. Packet creation by network layers (of all stations together) is Poisson distributed with mean N or Pr N {k} = Nk e N k! (an average of N packets generated during each unit interval) Assume each interval has the same length as the packet duration. Average number of packets transmitted in a unit interval is G. As some packets will be retransmitted, G N. Also Poisson distributed with mean G. Pr G {k} = G k e G k! Collision occurs when 2 or more frames occupy the channel at the same time. Obviously, N 1, G 1, G N. (if we have more than one packet during any interval there will be a collision).
Wireless (WLAN) ALOHA - Vulnerable Period ALOHA Slotted ALOHA CSMA Collides with the start of the shaded frame t Collides with the end of the shaded frame t o t o + t t o + 2t t o + 3t Time Vulnerable
Wireless (WLAN) Efficiency of ALOHA ALOHA Slotted ALOHA CSMA Vulnerable period is 2 intervals Assume n When a station transmits a packet, the packet will be successfully transmitted if no other packets are generated for two consecutive intervals Probability Pr G {0} = e G for one interval Probability of no other packet in the vulnerable period is Pr G {0} Pr G {0} = e 2G Throughput (for each interval) S = Ge 2G (G attempts, but only a fraction e 2G is successful).
Wireless (WLAN) What s the best we can do? ALOHA Slotted ALOHA CSMA For pure ALOHA S = Ge 2G What is the best choice of G? d dg S = e 2G (1 2G) = 0 G = 0.5, S = 1 2e 0.184 Maximum efficiency is only 18%
Example Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA 10 Mbps channel, 1000 bits per packet Satellite can receive up to 10,000 packets per sec (packet interval 1/10,000 sec) Only 1840 packets per second received successfully Efficient Operating point: G = 0.5 for best efficiency : only half a packet will be sent (on an average) during every interval 5000 packets per second sent (by all stations together) Only 1840 will reach, 3160 per/sec will collide (and will have to be retransmitted)
Slotted ALOHA Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA Assumption - existence of some mechanism for synchronizing different stations Station will transmit only at the beginning of slot intervals. Vulnerable period is only one interval - not 2 Throughput S = Ge G Maximized when d dg S = e G (1 G) = 0 G = 1, S = 1 e 0.368 Maximum efficiency less than 37% Twice as efficient as pure ALOHA
Example Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA Satellite can receive 10,000 packets per sec. Packet interval 1/10,000 sec Now (all stations together) can send only 3680 packets per second. Efficient Operating point: G = 1 for best efficiency : One packet (on an average) sent during every interval Or 10000 packets per second sent by all stations together Only 3680 will reach, 6320 per/sec will collide (and will have to be retransmitted)
Stability of ALOHA Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA What happens when G increases? But first, what is the average number of attempts needed for successfully delivering a packet? Probability of success (no collision) is e G for each attempt. To successfully send one packet, e G packets have to be transmitted on an average Number of attempts increases exponentially with G
Wireless (WLAN) Channel Utilization With ALOHA ALOHA Slotted ALOHA CSMA S (throughput per frame time) 0.40 Slotted ALOHA: S = Ge G 0.30 0.20 0.10 Pure ALOHA: S = Ge 2G 0 0.5 1.0 1.5 2.0 3.0 G (attempts per packet time)
Wireless (WLAN) ALOHA Slotted ALOHA CSMA Carrier Sense Multiple Access Protocols Listen first. If no one is currently using the channel, then transmit Collisions can still occur Propagation delay (B has started transmission, but A does not know that yet) A and B wait for C (which is currently transmitting) to finish and start at the same time. Collisions inferred through the lack of ACKs Persistent and non-persistent CSMA
Wireless (WLAN) Non-persistent CSMA ALOHA Slotted ALOHA CSMA 1 If channel is free transmit. 2 If not stop sensing and wait (for a random time) 3 If the channel is free now, transmit 4 If not, back to 2 (stop sensing and wait)
Persistent CSMA Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA 1-persistent - if busy keep sensing the line till it becomes available and start transmitting immediately p-persistent (for slotted channels) if busy keep sensing the channel If free, transmit at the next slot - but with probability p Probability q = 1 p that a station will yield. Process continues till the packet has been transmitted or another station takes over the channel.
Wireless (WLAN) ALOHA Slotted ALOHA CSMA Channel Utilization With CSMA / ALOHA S (throughput per packet time) 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 Pure ALOHA Slotted ALOHA 0.5-persistent CSMA 1-persistent CSMA 0.01-persistent CSMA Nonpersistent CSMA 0.1-persistent CSMA 1 2 3 4 5 6 7 8 9 G (attempts per packet time)
Wireless (WLAN) ALOHA Slotted ALOHA CSMA CSMA With Collision Detection (CSMA-CD) In CSMA (and ALOHA) collisions are inferred through the lack of ACKs What if stations can send and listen at the same time? Stations can stop transmitting as soon as a collision is detected. Colliding packets will now use up only a small fraction of the time. As usual stations sense channel, and transmit only if the channel is free. If collision is detected - stop sending the packet (only part of a packet may be sent).
CSMA-CD States Medium Access Protocols Wireless (WLAN) ALOHA Slotted ALOHA CSMA t o Contention slots Frame Frame Frame Frame Transmission period Contention period Time Idle period
Wireless (WLAN) ALOHA Slotted ALOHA CSMA Seizing the Channel with CSMA-CD After a station starts transmission of a packet, it should be able to detect within a period τ d that no collision is going to occur for that packet. If τ is the maximum delay between any two stations in the channel τ d < 2τ. Why? After time τ d, the station is sure that it has seized the channel τ d is the contention period. CSMA-CD is employed in
Wireless (WLAN) 2τ for Collision Detection ALOHA Slotted ALOHA CSMA A Packet starts at time 0 B A Packet almost at B at τ - B (a) (b) A B A Noise burst gets back to A at 2τ B (c) Collision at time τ (d)
Wireless (WLAN) Restrictions On Packet Size CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 With CSMA-CD there is also a restriction on minimum packet duration! What happens if packet duration is less than 2τ? It is possible that A completes the entire packet before it sensed the collision. So A does not even know that a collision occurred! Packet sizes have to be chosen such that the packet duration is greater than 2τ
Wireless (WLAN) Minimum Packet Size CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 For 10 Mbps LAN, maximum distance of 2500 m between two stations In practice, upto 4 repeaters may be used Round trip time is about 50µs 10 µs propagation time each way; 30 µs repeater delay Smallest allowed packet size is 500 bits prescribes 64 bytes (512 bits) as the minimum packet size. For 100 Mbps LAN standard recommends max length 250 m 5µs RTT: 2µs propagation delay and 3µs repeater delay Minimum packet size is still about 500 bits (64 bytes)
Wireless (WLAN) CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 Binary Exponential Back-off in For any station time is slotted with slot duration 2τ (a slot begins at the instant a collision is sensed) After first collision, station randomly picks 0 or 1 (prob of 1 is half) Retransmit at the next slot with probability half. If collision happens again retransmit at next slot with probability 1/4 If a third collision occurs retransmit with probability 1/8, and so on After r collisions, transmission probability is 1 2 r Binary exponential back-off. After r = 10 probability does not fall below 1 2 10 = 1/1024
Wireless (WLAN) CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 Binary Exponential Back-off and Slotted ALOHA The contention periods in is similar to slotted ALOHA contending stations send randomly at specific time-slots When operating efficiently slotted ALOHA successfully delivers any packet with probability 1 e In, under full utilization of the channel, the probability that someone seizes the channel is 1 e.
Efficiency Medium Access Protocols Wireless (WLAN) CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 Average number of contention slots before a packet is delivered is e When is operating at its maximum capacity, for each packet delivered there is an average of e contentions. The channel is occupied by useful packets of duration P and useless contentions (on an average e contentions of duration 2τ each). Efficiency ν = P P + 2τe
Efficiency Medium Access Protocols Wireless (WLAN) CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 F - frame size (in bits) B - data rate (bits per sec) P = F B c - velocity of propagation L - maximum length of ethernet cable (maximum seperation between two stations) τ = L c ν = P P + 2τe = 1 1 + 2BLe/cF
Wireless (WLAN) Constant BL product CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 ν = P P + 2τe = 1 1 + 2BLe/cF Larger frame sizes results in increased efficiency Need to control BL product - higher bandwidth lines have to be shorter than lower bandwidth lines 100 Mbps lines of length L does not have 10 times the capacity of a 10 Mbps line of length L
Wireless (WLAN) Efficiency vs F CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 1.0 Channel efficiency 0.9 0.8 0.7 0.6 0.5 0.4 0.3 1024-byte frames 512-byte frames 256-byte frames 128-byte frames 64-byte frames 0.2 0.1 0 1 2 4 8 16 32 64 128 256
Wireless (WLAN) Manchester Encoding CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 Bit stream 1 0 0 0 0 1 0 1 1 1 1 (a) Binary encoding (b) Manchester encoding (c) Differential Manchester encoding Transition here indicates a 0 Lack of transition here indicates a 1 detection of start of each bit. Each bit period divided into two intervals. Twice the bandwidth Every bit period has a transition in the middle Unambiguo
Wireless (WLAN) DIX (DEC, Intel, Xerox) and 802.3 CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 Bytes (a) 8 6 6 2 0-1500 0-46 4 Preamble Destination address Source address Type Data Pad Destination Source (b) Preamble Length Data Pad address address Checksum Checksum Preamble - 8 octets (each 10101010) 2. Addresses - 6 bytes each. Dest. all ones address - broadcast 3. Destination address all ones implies broadcast; bit 46 used to distinguish local and global addresses; 4. Type of payload 5. Data upto 1500 bytes. Minimum limit? 6. Pad To cater for minimum packet length 7. Checksum 8. IEEE 802.3: SoF Delimiter (for compatibility), Type to Length 1.
Families Medium Access Protocols Wireless (WLAN) CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 Based on speed 10Base5 (thick coax), 10Base2 (thin coax), 10Base-T (Twisted Pair), 10Base-F (Fiber optics) Fast ethernet (802.3u), 100Base-T4 (category 3 UTP), 100Base-TX (category 5), 100Base-FX (Fiber) No changes in protocol - just better wires (and better technology for ethernet cards) Backward compatibility Maximum length reduced (otherwise we need to increase minimum frame size!) Why?
Wireless (WLAN) Gigabit ethernet (802.3z) CSMA-CD in Binary Exponential Back-off Performance - IEEE 802.3 Once again backward compatible Need to reduce length further - unacceptable Carrier extension - Padding to extend frame to 512 bytes. Frame bursting - concatenated sequence of frames.
Wireless (WLAN) IEEE 802.11 Hidden / Exposed Station Problem Case 1: A B. C senses medium but does not hear A s transmission as C is out of range. If C transmits to B we have collision. Hidden Station Problem. A is hidden from C Case 2: B A. C needs to transmit to D. C senses medium and assumes that it cannot transmit. Actually it can as A s reception will not be affected. Exposed Station Problem. What is needed? Interference at the Rx is the problem - not the interference at the transmitter! A B C D A B C D Radio range (a) (b)
A Medium Access Protocols Wireless (WLAN) IEEE 802.11 Multiple Access with Collision Avoidance (A) Rx should send a short frame to indicate that it is ready to receive from a source. Other stations hearing the Rx will yield. RTS (Request to Send) and CTS (Clear to Send) packets.
Wireless (WLAN) IEEE 802.11 A B. A sends RTS to B. B responds with CTS. C hears RTS but not CTS. C waits a reasonable amount of time for CTS, and failing to hear it can start Tx to some other node. D hears CTS but not RTS. D should desist until the packet following CTS is finished. Range of A's transmitter Range of B's transmitter C A RTS B D C A CTS B D E E (a) (b)
Wireless (WLAN) AW - A for Wireless IEEE 802.11 Some enhancements to A layer acknowledgements. To receive ACK there should be no collision at the transmitter of the original packet. So exposed station problem is deliberately not addressed. CSMA for transmitting RTS Back-off algorithm for each source-destination pair instead of for each station. Additional information exchange about congestion.
Wireless (WLAN) Virtual Channel Sensing IEEE 802.11 A RTS Data B CTS ACK C NAV D NAV Time
802.11 Modes Medium Access Protocols Wireless (WLAN) IEEE 802.11 DCF - Distributed Coordination Function Each node determine what to do next PCF - Point Coordination Function Base station broadcasts beacon frames (10-100 times per sec) Could provide QOS guarantees Coordinator can even request nodes to go to sleep
Wireless (WLAN) PCF - DCF Coordination IEEE 802.11 SIFS - Short IFS, PIFS - PCF IFS, DIFS - DCF IFS, EIFS - Extended IFS Control frame or next fragment may be sent here SIFS PIFS DIFS PCF frames may be sent here EIFS DCF frames may be sent here Bad frame recovery done here ACK Time
Wireless (WLAN) 802.11 Frame Structure IEEE 802.11 Bytes 2 2 6 6 6 2 6 0-2312 4 Frame control Address 1 Address 2 Address 3 Seq. Address 4 Data Duration Checksum Bits 2 2 4 Version Type Subtype 1 To From DS DS 1 1 1 1 1 1 1 MF Retry Pwr More W O Frame control
Frame Control Medium Access Protocols Wireless (WLAN) IEEE 802.11 11 subfields! Version, Data type (data, control, management), subtype (RTS, CTS) To DS, From DS - for interoperability with 802.3 MF - more fragments Retry - retransmission (ABP 0) Power management (sleep) More - additional frames to be sent W - WEP in use O - strict processing
Other Fields Medium Access Protocols Wireless (WLAN) IEEE 802.11 Duration (includes duration of ACK) - for managing NAV Address 3 and 4 - to handle handover for inter-cell traffic Sequence - frame number
Wireless (WLAN) 802.11 Protocol Stack IEEE 802.11 Upper layers sublayer Logical link control Data link layer 802.11 Infrared 802.11 FHSS 802.11 DSSS 802.11a OFDM 802.11b HR-DSSS 802.11g OFDM Physical layer
Wireless (WLAN) Bit-map protocol Binary Countdown Especially suitable for small number of stations that are close to each other (very little delay)
Bit Map Protocol Medium Access Protocols Wireless (WLAN) 8 Contention slots Frames 8 Contention slots 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 1 1 1 1 3 7 1 1 1 5 1 1 d 2
Binary Countdown Medium Access Protocols Wireless (WLAN) Bit time 0 1 2 3 0 0 1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 Result 1 0 1 0 Stations 0010 and 0100 see this 1 and give up Station 1001 sees this 1 and gives up
Wireless (WLAN) Width of each reservation slot should be of the order of the maximum delay between stations (so there is no ambiguity as to which station(s) is making a reservation) Number of reservation slots proportional to number of stations (in bit-map protocol) Number of reservation slots proportional to log2 of number of stations for each packet (in binary countdown) However, if number of packets is proportional to number of stations, even for binary countdown the total overhead (for reservation slots) will depend on the number of stations!
A Typical LAN Medium Access Protocols Wireless (WLAN) Bridge Backbone LAN B B B B File server Cluster on a single LAN Workstation LAN
Bridges Medium Access Protocols Wireless (WLAN) Bridges interconnect LANs Need for bridges LANs might have sprouted independently Sometimes (geographically well distributed) cheaper to connect different segments with a bridge than run a single cable Controlling load in each LAN Very large physical distances (greater than 2500 m) Reliability Security
Wireless (WLAN) Local Internetworking Should the frame be forwarded? To whom? Hash tables F G H Bridge LAN 4 A B B1 C B2 D E LAN 1 LAN 2 LAN 3
Backward Learning Medium Access Protocols Wireless (WLAN) Hash tables are empty at first If route to destination not known flood over all lines If destination and source are on the same line discard packet If destination and source are on different lines, forward Backward learning operate in promiscuous mode Inspect source address of each packet seen to get some knowledge of the topology
Wireless (WLAN) Repeaters, Hubs, Bridges, Switches, Routers, Gateways Application layer Transport layer Application gateway Transport gateway Packet (supplied by network layer) Network layer Router Frame header Packet header TCP header User data CRC Data link layer Physical layer Bridge, switch Repeater, hub (a) Frame (built by data link layer) (b)
Wireless (WLAN) Hubs, Bridges, Switches A B C D A B C D Host A B C D Hub Bridge Switch LAN E F G H (a) E F G H (b) E F G H (c)