MAC Layer 4/16/2008 Guest lecture: Antonis Stampoulis Outline Recap Non-partitioning MAC protocols Random access Taking turns 2 MAC Protocols: a Taxonomy Goals efficient, fair, decentralized, simple Three broad classes: channel partitioning divide channel into smaller “pieces” (time slot, frequency, code) Non-partitioning random access • allow collisions “taking-turns” • a token coordinates shared access to avoid collisions 3 Channel Partitioning: CDMA CDMA (Code Division Multiple Access) Used mostly in wireless broadcast channels (cellular, satellite, etc) Unique “code” assigned to each user; i.e., code set partitioning All users share same frequency, but each user m has its own “chipping” sequence (i.e., code) cm to encode data e.g. cm = 1 1 1 -1 1 -1 -1 -1 Example: Sprint 4 CDMA: Encoding and Decoding Assume original data are represented by 1 and -1 Encoded signal = (original data) modulated by (chipping sequence) assume cm = 1 1 1 -1 1 -1 -1 -1 if data is d, send d cm, • if data d is 1, send cm • if data d is -1 send -cm Decoding: inner-product (summation of bit-by-bit product) of encoded signal and chipping sequence if inner-product > 0, the data is 1; else -1 If codes are orthogonal, multiple users can “coexist” and transmit simultaneously with minimal interference 5 CDMA: Two-Sender Interference Code 1: 1 1 1 -1 1 -1 -1 -1 Code 2: 1 -1 1 1 1 -1 1 1 6 Outline Recap Non-partitioning MAC protocols Random access Taking turns 7 Random Access Protocols When a node has packets to send transmit at full channel data rate R. no a priori coordination among nodes Two or more transmitting nodes -> “collision” Random access MAC protocol specifies: how to detect collisions how to recover from collisions (e.g., via delayed retransmissions) Examples of random access MAC protocols: slotted ALOHA and pure ALOHA CSMA and CSMA/CD, CSMA/CA 8 Slotted Aloha [Norm Abramson] Time is divided into equal size slots (= pkt trans. time) Node with new arriving pkt: transmit at beginning of next slot If collision: retransmit pkt in future slots with probability p, until successful. Success (S), Collision (C), Empty (E) slots 9 Slotted Aloha Efficiency Q: What is the fraction of successful slots? suppose n stations have packets to send suppose each transmits in a slot with probability p - prob. of succ. by a specific node: p (1-p)(n-1) - prob. of succ. by any one of the N nodes S(p) = n * Prob (only one transmits) = n p (1-p)(n-1) 10 Goodput vs. Offered Load Slotted Aloha 0.5 1.0 1.5 2.0 G = offered load = np when p n < 1, as p (or n) increases probability of empty slots reduces probability of collision is still low, thus goodput increases when p n > 1, as p (or n) increases, probability of empty slots does not reduce much, but probability of collision increases, thus goodput decreases goodput is optimal when p n = 1 11 Maximum Efficiency vs. n 0.4 1/e = 0.37 maximum efficiency 0.35 0.3 0.25 0.2 At best: channel use for useful transmissions 37% of time! 0.15 0.1 0.05 0 2 7 12 17 n 12 Pure (unslotted) Aloha Unslotted Aloha: simpler, no clock synchronization Whenever pkt needs transmission: send without awaiting for the beginning of slot Collision probability increases: pkt sent at t0 collide with other pkts sent in [t0-1, t0+1] 13 Pure Aloha (cont.) Assume a node transmit with probability p in one unit of time P(success by a given node) = P(node transmits) * P(no other node transmits in [t0-1,t0] * P(no other node transmits in [t0, t0+1] = p . (1-p)n-1 . (1-p)n-1 = p . (1-p)2(n-1) P(success by any of N nodes) = n p . (1-p)2(n-1) - Bound: 1/(2e) = .18 14 Goodput vs. Offered Load protocol constrains effective channel throughput! 0.4 0.3 Slotted Aloha 0.2 0.1 Pure Aloha 0.5 1.0 1.5 2.0 G = offered load = Np 15 Dynamics of (Slotted) Aloha In reality, the number of stations backlogged is changing we need to study the dynamics when using a fixed transmission probability p Assume we have a total of m stations (the machines on a LAN): n of them are currently backlogged, each tries with a (fixed) probability p the remaining m-n stations are not backlogged. They may start to generate packets with a probability pa, where pa is much smaller than p 16 Model n backlogged each transmits with prob. p m-n: unbacklogged each transmits with prob. pa 17 Dynamics of Aloha: Effects of Fixed Probability desirable stable point dep. and arrival rate of backlogged stations 0 successful transmission rate at offered load np + (m-n)pa - assume a total of m stations - pa << p - success rate is the departure rate, the rate the backlog is reducing new arrival rate: (m-n) pa undesirable stable point offered load = 1 Lesson: if we fix p, but n varies, we may have an undesirable stable point m n: number of backlogged stations 18 Summary of Aloha Protocols Problems slotted Aloha has better efficiency but clock synchronization is hard to achieve low efficiency due to waste of collision or empty slots • when offered load is optimal (p = 1/N), the goodput is about 37% • when the offered load is not optimal, the goodput is even lower undesirable steady state at a fixed transmission rate, when the number of backlogged stations varies Thus problems to be addressed: approximate slotted Aloha without clock synchronization reduce the penalty of collision or empty slots infer optimal transmission rate 19 CSMA: Carrier Sense Multiple Access CSMA: listen before transmit Objective: approximate slotted Aloha without clock synchronization If backlogged, wait until channel sensed idle, then transmit pkt with prob. p human analogy: don’t interrupt others ! 20 CSMA Collisions propagation delay means two nodes may not hear each other’s transmission A B C D t0 time collisions can still occur: spatial layout of nodes along Ethernet Collision: entire packet transmission time wasted; still not very efficient! 21 CSMA/CD (Collision Detection) Human analogy: the polite conversationalist CSMA/CD: observations: • collisions can be detected within short time • if colliding transmissions are aborted, we can reduce channel wastage carrier sensing, deferral as in CSMA collision detection: • easy in wired LANs: measure signal strengths, compare transmitted, received signals • difficult in wireless LANs: receiver shut off while transmitting 22 CSMA/CD: Collision Detection spatial layout of nodes along Ethernet spatial layout of nodes along Ethernet C D A t0 t0 time B time A B C B detects collision, aborts D D detects collision, aborts instead of wasting the whole packet transmission time, abort after detection. 23 Efficiency of CSMA/CD Given collision detection, instead of wasting the whole packet transmission time (a slot), we waste only the time needed to detect collision. P/C P: packet size, e.g. 1000 bits C: link capacity, e.g. 10Mbps Use a contention slot of 2 T, where T is one-way propagation delay (why 2 T ?) When the transmission probability p is approximately optimal (p = 1/N), we try approximately e times before each successful transmission 24 Efficiency of CSMA/CD The efficiency (the percentage of useful time) is approximately P C P e 2T C 1 1 5PT 1 15 a , where a TC P C The value of a plays a fundamental role in the efficiency of CSMA/CD protocols. Question: you want to increase the capacity of a link layer technology (e.g., , 10 Mbps Ethernet to 100 Mbps, but still want to maintain the same efficiency, what do you do? 25 Outline Recap Non-partitioning MAC protocols Random access Taking turns 26 “Taking Turns” MAC Protocols: Motivation Channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node ! can bound worst case performance Random access MAC protocols efficient at low load: single node can fully utilize channel high load: collision overhead cannot bound worst case performance 27 “Taking Turns” MAC Protocols: Polling Basic idea: master node “invites” slave nodes to transmit in turn Example: Bluetooth uses a polling method, where M is Master; s1, s2 are two slaves Concerns: polling overhead and latency single point of failure (master) 28 Polling Example: Distributed Polling Time divided into slots Begins with N short reservation slots reservation slot time equal to channel end-end propagation delay station with message to send posts reservation reservation seen by all stations After reservation slots, message transmissions ordered by known priority 29 Token Passing Basic idea: control token passed from one node to next sequentially Example: Token Ring a token rotates around a ring to each node in turn all nodes (computers, routers, etc.) copy all data and tokens, and repeat them along the link of the stations when a node wishes to transmit packet(s), it grabs the token as it passes it holds the token while it transmits when it is done, it releases the token and sends it on its way Concerns: token overhead and latency single point of failure (token) 30 Token Passing: Illustration Listen: Talk: data l4 l1 l3 l2 token/data 31 Token Ring: Two Variants Release After Reception (RAR) Example: IEEE 802.5 Token Rings (4Mbps) station 1 station 2 station N station 1 Packet 1 token Release After Transmissions (RAT) Example: Fiber Distributed Data Interface (FDDI) (100Mbps) station 1 station 2 station N station 1 Packet 1 Packet 2 Packet 2 32 Efficiency of Token Ring: RAR Release After Reception (RAR) maximum efficiency RAR achieved when a station continuously transmits 1 2 N 1 a Packet 1 1 RAR Packet 2 1 1 a where a: E - 2 - E propagatio n delay Packet Transmissi on time if the sender always releases its token after a data transmission 1 2 n 1 Packet 1 a/N Packet 2 a 1 RAR 1 1 NN1 a 1 1 a Assume token very small, stations equally spaced where a: E - 2 - E propagatio n delay Packet Transmissi on time N: number of hosts 33 Efficiency of Token Ring: RAT Release After Transmission (RAT) maximum efficiency achieved when a station continuously transmits 1 2 n Packet 1 1 a 1 Packet 2 the efficiency is approaching 1 assume a station always releases its token after a packet transmission Assume token very small, stations 1 Time 0 2 3 n 1 a/N a Packet 1 Time 1+a/N Time 2+2a/N Packet 2 Packet 3 equally spaced RAT 1 1 a / N where a: E - 2 - E propagatio n delay Packet Transmissi on time N: number of hosts 34 Comparison of Efficiency 1 CSMA / CD 1 5a 1 RAR 1 a 1 RAT 1 a / N where a: E - 2 - E propagatio n delay Packet Transmissi on time N: number of hosts 35 Summary of MAC Protocols How do you access a shared media? Channel Partitioning, by time, frequency or code Random access, • ALOHA, S-ALOHA, CSMA, CSMA/CD “Taking-turns” • polling • token passing In real protocols, they are often combined to achieve given objective 36
© Copyright 2026 Paperzz