Document Sample

Medium Access Control Tanenbaum (Chapter 4) Others References: Walrand J., Communication Networks: A first Course Bertesekas and Gallager, Data Networks Where in the OSI Reference Model ? Application Presentation Session Transport Network Medium Access Control Link Layer Data Link Layer Physical 6/22/2010 Medium Access Control 2 Why Do We Need a MAC Layer ? • Let us consider different topologies – Point-to-point channel • full duplex • half duplex – Broadcast channel 6/22/2010 Medium Access Control 3 Management of Broadcast Channels • Contention free: allocating statically shares of the channel to all stations (by TDM, FDM, or other) Servers • Contention: let stations compete for the ALL channel One server 6/22/2010 Medium Access Control 4 Objectives of This Chapter: Establish A Key Result • 1) Efficiency: with heavy load, contention free systems are better than contention systems. • 2) For average delay: contention systems are better than contention free (Whatever is the protocol! ) Introduction to Queueing Theory 6/22/2010 Medium Access Control 5 Objectives of This Chapter (cont’d): Establish some Properties • Relationship between a MAC protocol and physical properties of network: – Upperbound on efficiency – Maximum length of medium – Bandwidth – Minimum packet size 6/22/2010 Medium Access Control 6 Objectives of This Chapter (cont’d): Techniques of Analysis • Initiate students to the techniques used to analyze the performance of MAC protocols: – Aloha protocol – Slotted Aloha – CSMA – CSMA/CD 6/22/2010 Medium Access Control 7 Objective 1: Establish A Key Result on Average Delay Queueing Theory Introduction to Analytical Modeling L.Kleinrock, “Queueing Systems” R.Jain, “The Art of Computer Systems Performance Analysis” E. Modiano, MIT course on Communications Packet Switched Networks PS PS PS PS PS PS PS Buffer Packet Switch PS 6/22/2010 Medium Access Control 10 Queues Everywhere • Processes waiting for CPU • I/O Disk requests • Network interface card • IP input (output) queues • Events (mouse click, keyboard…) • ……………………… 6/22/2010 Medium Access Control 11 Queueing Theory • What creates queues? – Randomness!!! • Used for analyzing network performance • In packet networks, randomness comes from: – random packet arrival – Random packet length • Information of interest: – Delay in buffer (queueing delay) – Buffer size 6/22/2010 Medium Access Control 12 Queueing Theory Servers jobs Job Sources Or customers 6/22/2010 Medium Access Control 13 A Queueing System A/S/m/B/K/SD • A : Interarrival time of jobs distribution • S : The service time distribution • m : Number of servers • B : Capacity of the system (max # of jobs allowed) • K : population size • SD : Service discipline – Default values B = ∞; K=∞; and Z=FCFS – For A and B • G : General distribution • M : Exponential Distribution (memoryless property) • D : Deterministic 6/22/2010 Medium Access Control 14 Example • M/D/2/15/20000/FCFS – Time between arrivals exponentially distributed – Service time constant (no variation) – 2 servers – System capacity is 15 (2 places for currently served + 13 waiting) – Population is 20000 (20000 customers will ever come to the system) – Service discipline is first come first served 6/22/2010 Medium Access Control 15 Queueing Models • Model good for – Requests received by Google – Customers waiting in line – Packets waiting to be transmitted over a line • Information of interest – Average number of customers in the system – Average delay experienced by a customer 6/22/2010 Medium Access Control 16 Queueing System: Variables of Interest • Mean arrival rate: l • Mean service rate: m (service time per job) • Number of customers in system: n • Waiting time (in queue+service): w Servers jobs Job Sources Or customers 6/22/2010 Medium Access Control 17 A Key Result : Little’s Law Arrivals Departure Black Box Mean # in system = Mean arrival rate X mean time spent in system E(n) = l.E(w) Remarks : - Result independent of A/B distributions or SD - Can be applied to all system or part of it - Crowded system long delays 6/22/2010 Medium Access Control 18 A Key Result : Little’s Law Example A monitor on an HTTP server showed that the average time to satisfy a request was about 50 milliseconds. The requests arrival rate is 200 requests per second. What should be the buffer size (unit is requests) at the http server For the requests ? Little’s law states E(n) = l. E(w) Here l =200 req/s and E(w) = 0.050 s The expected number of customers in the system is E(n) E(n) = 200 x 0.050 = 10 It would be safe to have a buffer size of 20 6/22/2010 Medium Access Control 19 Arrival Process • Packets arrive according to some random process • There are many stochastic processes. • A nice stochastic process is the Poisson process – Mean arrival rate of l packets per second – Prob(n arrivals during T) = [(l.T)n e-lT]/n! 6/22/2010 Medium Access Control 20 Example • The number of phone calls arriving to a switch can be closely modeled as a Poisson process. Suppose that the mean arrival rate is 100 per hour. • What is the probability to receive 10 calls in 6 minutes? T = 0.1 hour, l = 100/h Prob(n arrivals during T) = [(l.T)n e-lT]/n! Prob(10 arrivals during 0.1 h)= (100x0.1)10xe-(100x0.1)/10!=0.12 Prob(10 arrivals during 15 mn) = 0.003 6/22/2010 Medium Access Control 21 InterArrival Times of Poisson Process • This is the time between consecutive arrivals. IA is a continuous random variable • What is its probability distribution function? • Prob(IA <= t) = 1 – Prob(IA > t) • = 1 - Prob(0 arrivals within t) • Prob(0 arrivals during t) = [(l.t)0 e-lt]/0!= e-lt • So, Prob(IA <= t) = 1 - e-lt 6/22/2010 Medium Access Control 22 InterArrival Times of Poisson Process (2) • The cumulative distribution function (CDF) is: – Prob(IA <= t) = 1 - e-lt • The probability distribution function is the derivative of CDF, i.e., PDF = l.e-lt • This what is called the exponential distribution • This distribution is largely used to model the service times, time between error losses, .. 6/22/2010 Medium Access Control 23 Memoryless Property • Def: A random variable X is said to be without memory, or memoryless, – P(X>s+t|X>t) = P(X>s) for all s, t ≥ 0 • In words: “When I get to the bus station, I am told that the probability that the bus comes within the next 10 minutes is 0.90. After one hour waiting, I am told that the probability that the bus comes within the next 10 minutes is still 0.90 ” • Important result : X is memoryless iff it is exponentially distributed 6/22/2010 Medium Access Control 24 More Examples • Suppose that the time to graduate from AU is exponentially distributed with mean 4 years. • Given that a student already spent 3 years at AU, what is the expected remaining time before he graduates? 6/22/2010 Medium Access Control 25 Properties of Poisson Process (PP) • Merging of K P.P with mean rate li results in a P.P with mean rate the sum of the li’s. l1 S li l 2 li ln • Splitting (randomly) a P.P with mean rate l with probabilities pi results in P.Ps with mean rates pi. l. p1.l1 p2.l2 l pi.li pn.ln 6/22/2010 Medium Access Control 26 Analysis of an M/M/1 Queue Jobs Source Server • Interarrival exponentially distributed (Memoryless) • Service time exponentially distributed (Memoryless) • One server • Infinite capacity of system • Infinite population • First come, first served 6/22/2010 Medium Access Control 27 Analysis of an M/M/1 (2) • We are interested in the average number of jobs in the system, the average waiting time in the system, or in the probability to have a given number of customers in the system. • Notations – N(t): number of jobs in system at time t – Pn(t) = Prob{N(t)=n} – Pn = lim t-->∞ Pn(t) – l= arrival rate – m = service rate (service time = 1/ m) 6/22/2010 Medium Access Control 28 Markov Chain for M/M/1 System l.d l.d l.d l.d l.d l.d 0 1 2 3 4 5 1-l.d m.d m.d m.d m.d m.d m.d • Circle i = state i means there are i customers in the system • What is the probability Prob(i,j), i.e, the probability of transition from state i and j? • Prob(j,j+1) = l.d, and Proj(j,j-1) = m.d 6/22/2010 Medium Access Control 29 Remarks about M/M/1 l l l l l l 0 1 2 3 4 5 m m m m m m • l > m, otherwise the system will be instable • After some time in operation, an M/M/1 gets into some equilibrium. l • When in equilibrium l.Pi = m.Pi+1 i m 6/22/2010 Medium Access Control 30 Determining Pn l l l l l l 0 1 2 3 4 5 m m m m m m l.Po = m.P1 P1 = (l\m).P0 l.P1 = m.P2 P2 = (l\m).P1 Pn = (l\m)n.P0 ………….. ………….. l.Pn = m.Pn+1 Pn+1 = (l\m).Pn Using the equations above and the sum SP =i 1, we can derive Pi’s SP = S (l\m) .P i i 0 = P0. S (l\m) = P /(1-(l\m)) = P /(1-r) = 1 i 0 0 P0 =(1-r) Pi = ri.(1-r) 6/22/2010 Medium Access Control 31 Mean Queue Length E(N) = r/(1-r) r =l/m is the traffic intensity • The average number of customers in the system is E(N) • E(N) = Si.ri.(1-r) = r/(1-r) • E(N) = (1-r).Si.ri • E(N) = r/(1-r) • E(N) = l/(m-l) 6/22/2010 Medium Access Control 32 Mean Waiting Time E(W) = 1/(1-r)m • What is the average time in the system? (queueing delay + service time) • We use Little’s formula: E(N) = l.E(W) 6/22/2010 Medium Access Control 33 Prob{Server is busy} ? 6/22/2010 Medium Access Control 34 Prob{Server is idle} ? 6/22/2010 Medium Access Control 35 Analysis of M/M/m (m=3) l l l l l l 0 1 2 3 4 5 m 2m 3m 3m 3m 3m lPo = mP1 lP1 = 2mP2 ………….. lPn = 3mPn+1 Using the equations above and the sum Spi = 1, we can derive Pi’s 6/22/2010 Medium Access Control 36 Example • Comparison source partition vs global FCFS • Let the system have n sources and m servers.Jobs generate at each source as P.P with rate l • Job’s computation time is exponentially distributed 1/m • Source partition is m M/M/1 while global FCFS may be viewed as M/M/m with Arrival rate n.l. 6/22/2010 Medium Access Control 37 A Fundamental Result In Queueing Theory • One powerful server for all is better than one weak server for each one ! One server • Why ? Better utilization, as a dedicated channel may stay IDLE. 6/22/2010 Medium Access Control 38 Analysis of MAC Protocols Read Tanenbaum Chapter 4 Key sections (Intro, 4.1, 4.2.1,4.2.2, 4.3) Multiple Access Protocols • Competing stations (possible collisions) – Aloha – Slotted Aloha – CSMA – CSMA/CD • Collision-free – Bit-map protocol – Binary countdown • Limited contention – Adaptive tree walk protocol 6/22/2010 Medium Access Control 40 Pure Aloha • Designed by Abramson (wireless) • A station emits whenever it has something to send • If other station emits, a collision happens • If collision, frame must be resent • Best possible utilization at high load 18% 6/22/2010 Medium Access Control 41 Analysis of Pure Aloha • Assume infinite population of users • Let Tr=time to trasmit a frame (“frame time”) • The population generates a traffic that is Poisson with mean N per “frame time” (new frames) • Since there are also retransmissions, the total traffic generated is Poisson with mean G • What is the throughput S? • S = G.Po where Po is the probability that a frame does not suffer a collision 6/22/2010 Medium Access Control 42 Analysis of Pure Aloha (2) (Example) • Suppose that the bandwidth is 10 Mbps, and packet size is 1500 bytes • Tr= 1500.8/10 Mbps = 1.2 ms • Possible values for N (mean number of frames generated per time frame): between 0 and 1 • Values for generated traffic (G > N) – No retransmissions at all G = N – Low load G~N – High load G > N • Po will be higher at low load 6/22/2010 Medium Access Control 43 Analysis of Pure Aloha (3) • What is the probability to generate k frames during a “frame time”? – Prob(k arrivals during 1) = [(G.1)k e-G.1]/k! (page 20) • What is the probability Po that that a frame does not suffer a collision? Tr 6/22/2010 t0 +Tr t0Medium Access Controlt0+2Tr t0+3Tr 44 Analysis of Pure Aloha (4) • Po is the probability that ZERO frame is generated during the vulnerable period – Po = Prob(0 arrivals during 2) = – = [(G.2)0 e-G.2]/0! – Po = e-G.2 – S = G.Po = G. e-G.2 (When is S maximum?) – The maximum throughput S is 1/(2.e) = 18.4% Tr 6/22/2010 t0 +Tr t0Medium Access Controlt0+2Tr t0+3Tr 45 Slotted Aloha • Designed by Roberts (wireless) • Requires synchronization and division of time in discrete slots • A station emits whenever it has something to send AND must wait for beginning of slot • Best possible utilization at high load 37% t 6/22/2010 t0 +t t0Medium Access Controlt0+2t t0+3t 46 Analysis of Slotted Aloha (2) • The key: slotted time reduces the vulnerable period to Tr (instead of 2Tr). – Po = Prob(0 arrivals during 1) = – = [(G.1)0 e-G.1]/0! – Po = e-G.1 – S = G.Po = G. e-G (When is S maximum?) – The maximum throughput S is 1/e = 36% • Exercise: derive the average number of transmissions of one frame before being t successful. 6/22/2010 t0 +t t0Medium Access Controlt0+2t t0+3t 47 Carrier Sense Multiple Access CSMA • Designed by Metcalfe, analyzed by Kleinrock and Tobaggi • A station listens to the channel before sending. • If channel busy, wait until it becomes idle • When channel free, send with probability 1 • Are collisions still possible? 6/22/2010 Medium Access Control 48 Collisions with CSMA • Key: signal takes time tp to propagate • Problem 1: If two stations are listening to grab the channel… • Problem 2: If S1 starts transmitting, S2 may well send during tp. • Problem 3: S1 is not aware of the collision Sender S1 Sender S2 tp 6/22/2010 Medium Access Control 49 Solving Problem 1: p-persistent CSMA • 1-persistent: after collision, waits a random time and starts over (slide 48) • Non persistent: if channel busy, the station does not keep listening, but rather waits for a random time before listening again. • p-persistent: for slotted, if idle, send with probability p, otherwise defers to next slot • Much better utilization than Aloha, may go beyond 95%. 6/22/2010 Medium Access Control 50 Problem 2 and 3: Vulnerability Period with CSMA • At time t, S1 sends a frame f1 • At time tp-e, S2 may well send a frame f2 because S2 does not hear yet first bit of f1 • At time 2tp-e, S1 does not hear yet first bit of f2 • Vulnerability period is 2tp Sender 1 Sender 2 tp 6/22/2010 Medium Access Control 51 Solving Problem 2 and 3: Collision Detection (1) • Objective: 1) Sender must detect collision 2) Stop transmission of damaged frames to avoid waste of medium • CD: while sending, a sender must keep listening to detect a collision • Can the sender always detect collisions? • Relationship with medium length 6/22/2010 Medium Access Control 52 Solving Problem 2 and 3: Collision Detection (2) • Collision detection imposes a minimum frame length based on bandwidth and maximum medium length • Sender must listen for at least the time it takes for the signal to tral between the farthest points on the medium (tmax) • The sender listens while sending: it takes Tr to send a frame. • To detect collision: Tr > 2.tmax 6/22/2010 Medium Access Control 53 Solving Problem 2 and 3: Collision Detection (Example) • A medium has a length of 1 km, the speed of light on the medium is 2/3 the speed in free space. What is tmax? • The bandwidth is 10 Mbps • What should be the smallest Tr? • What is the minimum size of a frame? 6/22/2010 Medium Access Control 54 Binary Exponential Backoff • Problem: CSMA/CD does not adapt to the number of competing stations. • What should be INTERVAL of the random time to wait after a collision occurs? • Should it be 1 second? • Should it be 1ms? • Should it be 2.tmax? Or 8.tmax? 6/22/2010 Medium Access Control 55 Binary Exponential Backoff (2) • Problem: If the INTERVAL I is constant, there is NO ADAPTATION to the number of competing stations. • How to solve the problem? – Use (2.tmax) as the unit of time – At the ith collision for the same frame, choose randomly a number B beween 0 and 2i-1. (Max is i=10) – Wait B.(2.tmax) before trying again 6/22/2010 Medium Access Control 56 Efficiency of Ethernet • Efficiency = Tr/T • Tr: transmission of one frame • T: T is the average time it takes to get a frame from a sender to a receiver • T= Tr + X.(2.tmax) where X is the number of slots we “waste” before sending out a frame successfully • X is a random variable: we can compute E(X) 6/22/2010 Medium Access Control 57 Efficiency of Ethernet (2) • Efficiency = Tr/(Tr+E(X) .(2.tmax)). What is E(X)? • We have to find the average number of collisions before a frame makes it. • In others words, we have to find the average number of attempts before we get a frame through • Suppose that I know the probability A that a frame makes it through. • What would be E(X), based on A? 6/22/2010 Medium Access Control 58 Efficiency of Ethernet (3) • Recall that A is the probability for a packet to get transmitted successfully • X takes the value 1 with probability A • X takes the value 2 with probability (1-A).A • X takes the value 3 with probability (1-A)2.A • ……………………………………………… • X takes the value i with probability (1-A)i-1.A • What is E(X), based on A? 6/22/2010 Medium Access Control 59 Efficiency of Ethernet (3) • Efficiency = Tr/(Tr+E(X) .(2.tmax)). What is E(X)? • We found that E(X) = 1/A • Then, Efficiency = Tr/(Tr+(2.tmax)/A). 6/22/2010 Medium Access Control 60 Efficiency of Ethernet (4) • Efficiency = Tr/(Tr+(2.tmax)/A). • Nice! But, what is the value of A? • Recall: the probability A that a frame makes it through • In other words: A is the probability that one station attempts to transmit while the other stations do not. 6/22/2010 Medium Access Control 61 Efficiency of Ethernet (5) • Efficiency = Tr/(Tr+(2.tmax)/A). • Suppose that there are k stations. • Each station tries to send in each slot with probability p. • Question 1: What is the probability that SOME station acquires the medium? • A = k.p.(1-p)k-1 • Do we want A to be high or low? • A is maximal for p = 1/k. What is Amax? • Amax = 1/e when k gets large. 6/22/2010 Medium Access Control 62 Efficiency of Ethernet (6) • Efficiency = Tr/(Tr+(2.tmax).e). • We could express as a function of the bandwidth Bw, the maximal length of the medium L, and the packet size F. • What is the expression of the Efficiency? • Hint: 2.tmax is the is the smallest time to send a frame 6/22/2010 Medium Access Control 63 Collision Free MAC • Token Ring MAC Protocol (IEEE 802.5) • N nodes are connected in a ring topology • A special packet (token) is circulated periodically: only a station possessing the token can transmit: • IEEE 802.5 Strategy: – Wait for the token and grab it – Transmit packets for at most q (10ms in 802.5) – Release the token 6/22/2010 Medium Access Control 64 Collision Free MAC • Token Ring MAC Protocol (IEEE 802.5) • N nodes are connected in a ring topology • A special packet (token) is circulated periodically: only a station possessing the token can transmit: • IEEE 802.5 Strategy: – Wait for the token and grab it – Transmit packets for at most q (10ms in 802.5) – Release the token 6/22/2010 Medium Access Control 65 Efficiency of Token Ring • Suppose, we have N stations • We want to establish the proportion of time the medium is used to send frames • We assume that all stations have a frame to send. • We neglect the transmission time of a token 6/22/2010 Medium Access Control 66 Efficiency of Token Ring (2) • The function of a Token Ring is periodical • Let us consider one cycle: – Station 1 gets the token and sends for q. – Station 2 gets the token and sends for q. – Station i gets the token and sends for q. – Station N gets the token and sends for q. • The duration of one cycle is then S=N.q + t. (t is the propagation time around the ring) 6/22/2010 Medium Access Control 67 Efficiency of Token Ring (3) • Recall that the cycle duration is S=N.q + t • The question now is: how long was the medium used during a cycle • The answer is N.q. • Efficiency = N.q/S = 1/(1+t/(N.q)) • Example: N= 40 stations, Ring of 2500m, what is the efficiency? 6/22/2010 Medium Access Control 68 Maximum Access time of T.Ring • If all stations have packets to send, a station may well have to wait for: – All other stations to send their packets ((N-1).q) – Wait for the token (t) • What is the maximum with the previous example? 6/22/2010 Medium Access Control 69 Problem of CSMA on Wireless Networks Air Is A Broadcast Medium • Can we use CSMA/CD ? – Talking/Listening problem – Hidden Terminal problem – Exposed Terminal Problem 6/22/2010 Medium Access Control 71 Hidden Terminal Problem A B C D •A wants to send to B •AND •C wants to send to B •A and C do not hear each other, they cannot detect collisions 6/22/2010 Medium Access Control 72 Exposed Terminal Problem A B C D •B wants to send to A •AND •C wants to send to D •B and C believe they are bothering each other 6/22/2010 Medium Access Control 73 MACA (Phil Karn) • When X wants to send to Y: – X sends an RTS frame – if Y gets RTS frame, Y sends a CTS frame • If you hear an RTS, you should keep quiet (to let the CTS come back) • If you hear a CTS, keep quiet (to let the incoming frame data) 6/22/2010 Medium Access Control 74 MACAW • Improved version of MACA – Adds acknowledgements for successful data frames – Use of CSMA – Exponential Backoff mechanism 6/22/2010 Medium Access Control 75 MAC Layer for 802.11 • Two kinds of policies – Distributed (with contention) : Distributed Coordination function – Centralized contention free: Point coordination function • The two may be used simultaneously 6/22/2010 Medium Access Control 76 Distributed Coordination function • Check first a logical maintained variable (NAV: Network allocation vector) • If NAV not null wait • if NAV null, then sense carrrier • if idle, transmit (if collision, random exponential backoff) • otherwise Random exponential backoff 6/22/2010 Medium Access Control 77 Delay After Sensing Idle DIFS PIFS SIFS Medium Busy ACK PCF DCF time CTS 6/22/2010 Medium Access Control 78

DOCUMENT INFO

Shared By:

Categories:

Tags:
media access control, medium access control, mac address, mac layer, the network, mac protocols, access control, media access control address, random access, multiple access, wireless networks, network access control, token ring, physical layer, mac sublayer

Stats:

views: | 16 |

posted: | 6/23/2010 |

language: | English |

pages: | 78 |

OTHER DOCS BY xit16869

How are you planning on using Docstoc?
BUSINESS
PERSONAL

By registering with docstoc.com you agree to our
privacy policy and
terms of service, and to receive content and offer notifications.

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.