# Tel Hai Academic College Department of Computer Science Prof. Reuven Aviv Markov Models for Access Control in Computer Networks Resource: Fayez Gebali,

## Presentation on theme: "Tel Hai Academic College Department of Computer Science Prof. Reuven Aviv Markov Models for Access Control in Computer Networks Resource: Fayez Gebali,"— Presentation transcript:

Tel Hai Academic College Department of Computer Science Prof. Reuven Aviv Markov Models for Access Control in Computer Networks Resource: Fayez Gebali, Analysis of Computer and Communication Networks

Contents ALOHA Protocol Slotted ALOHA CSMA/CD

ALOHA Protocol

Computers communicate over a broadcast channel Any computer: When you have a frame to send, send No medium sense before transmission Collisions (also called contentions) possible Sender senses medium during transmission (not before) If collision identified, retransmit after a random wait

Collisions between frames Assume: Frame have same length & transmission time, T Any frame transmitted in period T before and during the transmission of the focus frame will collide with it To have a successful transmission in a time-step, the channel must be quiet in the previous time-step

ALOHA Network: basic assumptions 1. Frames have same fixed length, same transmission time 2. Time-step T = frame transmission time 3. Propagation delay between any pair of stations < T 4. N stations 5. Any station can transmit any time 6. Collision occurs if frame sent at time t, and there are other transmissions during time interval [t-T, t+T] 7. All Stations identify collision during transmission

Markov Chain model The states of the channel are modeled by a Markov chain Idle, transmitting, collided Idle: No frame is being transmitted Transmitting: One frame is being transmitted Collided: two or more frames are being transmitted At any time some stations transmit:  Probability no station transmits: u 0  Probability 1 station transmits: u 1  Probability 2 or more stations transmit: 1-u 0 -u 1 How much are u k ?

State Transition Diagram Transitions into transmitting only from idle requirement of idle channel before a successful transmission No transition from Transmitting to transmitting No transition from colliding to transmitting

Transitions between channel states (1) idle (1) : remains idle with probability u 0  jumps from idle to transmitting, with probability u 1  jumps from idle to collided, probability 1-u 0 -u 1 Transmitting (3) : move to idle with probability u 0  Otherwise, (if one or more stations transmits) move to colliding with probability 1 –u 0 why? Collided (2) : Same idea. Move to idle with probability u 0, otherwise stay in collided, probability 1-u 0

Transition Matrix Row 2: Transitions to colliding  From idle: if more then 1 packet is transmitted:  Pr = 1-u 0 -u 1  From colliding or transmitting if at least one station is transmitting: Pr = 1 – u 0 Row 3: Transitions to transmitting  From idle: if just 1 packet is transmitted: Pr = u 1  From other state: impossible (current state is not idle)

ALOHA State Transition Diagram

Probabilities of transmissions Probability that a station has a frame to transmit: a  Note: Either a new frame or retransmission Probability that k stations will transmit at same time:  u k = [N!/k!(N-k)!]*a k (1-a) N-k  New and retransmitted frames Probability that no frame will be transmitted u 0 = (1-a) N Probability that 1 frame will be transmitted u 1 = Na(1-a) N-1

Steady State (Equilibrium) Probabilities State Probabilities at equilibrium (steady state):  Ps = s s 1 + s 2 + s 3 = 1 Solution: s 1 = u 0 s 2 = 1 – u 0 –u 0 u 1 s 3 = u 0 u 1 Probability to be in state idle  s 1 = (1-a) N Probability to be in state transmitting s 3 = Na(1-a) 2N-1 Probability to be in state collided s 2 = 1 – (1-a) N - Na(1-a) 2N-1

Performance: Input, Throughput & Access : Mean rate of attempted (input) transmissions  =  k ku k = Na frames/time-step 1 frame is successfully transmitted if system is in state 3 Probability s 3  0 frames successfully transmitted in other states  mean rate of transmitted (output) frames: Th = s 3  Th = u 0 u 1 = Na(1-a) 2N-1 frames/time-step Frames in Th are part of the set of input frames Probability of successful Access (transmit a frame): p A p A = output rate/Input rate = Th/  = (1-a) 2N-1 Also called efficiency 

Large N limit : Average rate of attempted (input) transmissions  =  k ku k = Na For large N, fixed :  u 0 = (1-a) N = (1- /N) N  u 0  e -  u 1 = Na(1-a) N-1 = (1- /N) N-1 = (1- /N) N /(1- /N)  u 1  e -  Th =  e -2   p     e -2

Retransmissions and delay Probability of successful Access (to transmit a frame): p A Probability of unsuccessful Access: 1- p A Probability of k unsuccessful Accesses followed by a successful Access: (1- p A ) k p A Retransmissions: mean number of unsuccessful attempts before successful transmission of a frame: n R  n R  k k* (1- p A ) k p A k goes from 1 to ∞ n R = (1-  p A )/  p A  p A  –  (1-a ) 2N-1 -1 n R is also average delay of transmitting a frame in Timesteps

Max Throughput situation For fixed N, find for what value of a, Th is maximal: dTh/da = 0  a M = 1/(2N) Th(max) = (1/2)[1- 1/(2N)] 2N-1 For N  ∞ Th(max) = 1/2e = 0.18394 frames/timestep Input rate:  = Na M = 0.5 frames/time-step efficiency (probability of successful Access) :  p A = (1- a M ) 2N-1 = (1 – 1/2N) 2N-1  p A  1/e = 0.367 when N  ∞ n R = [1 -1/e]/(1/e) = e -1 = 1.718 Failed Accesses per frame

Throughput vs load N = 10; horizontal axix is = Na Dotted line: ALOHA Solid line: Slotted ALOHA (next topic) Slotted Aloha Aloha

Numerical Example ALOHA network N = 20 Probability that a station has a frame to transmit in a time- step a = 0.01 Results: Throughput Th = 0.1351 frames/timestep mean number of time-steps before success, n R = 0.4799 Maximal throughput Th(max) = 0.1839 frames/time-step value of a for maximal throughput, a M = 1/40) = 0.025

Slotted ALOHA

Time is divided to slots Stations are synchronized, allowed to transmit at start of slots only (not at any time as in ALOHA) Time-step = time-slot Vulnerable period = 1 timeslot (not 2 as in ALOHA) Collisions occur only if two frames transmitted at same timeslot. Less collisions, better throughput and successful Accesses

Modeling As in ALOHA: States idle, collided, transmitting What’s the diff between ALOHA and Slotted ALOHA? Direct transitions from collided to transmitting and from transmitting to transmitting are now allowed  occurs if just 1 station requests access in next timestep. Frame will be transmitted in the next timestep, and will not collide with anything transmitted in current timestep. (Vulnerable period is 1 timeslot, no requirement of calm time-step) Probability u 1

State Transition Diagram

States and Transitions (1) idle (1): Stay idle as long as all stations idle in next timeslot. Pr = u 0  jump to transmitting if just 1 station requests access in next timeslot. Pr = u 1  otherwise jump to collided. Pr = 1 - u 0 - u 1 Transmitting (3): stay transmitting if just 1 station requests access in next timeslot. Pr = u 1  jump to idle if all stations idle in next timeslot. Pr = u 0  Otherwise jump to collided. Pr = 1 - u 0 - u 1

States and Transitions (2) Collided (2): jump to idle if all stations idle in next timeslot. Pr = u 0 jump to Transmitting if just 1 station requests access in next timeslot. Pr = u 1 Else stay in collided. Pr = 1 - u 0 - u 1  Values of u k : Assume requests for access are independent random events: Probability that a station on its own requests access: a Probability that in a system of N stations k stations requests access, u k – u k = [N!/(k!(N-k)!)]*a k (1-a) N-k binomial distribution

Transition Matrix and State Probabilities Steady state probabilities: s = [s 1 s 2 s 3 ] t Ps = s s 1 + s 2 + s 3 = 1 Solution: idle: s 1 = u 0 collided: s 2 = 1- u 0 – u 1 transmitting: s 3 = u 1

Slotted ALOHA vs. Pure ALOHA (1) idle (1): pure/slotted ALOHA have same probabilities (2) collided (2): Slotted ALOHA has a lower probability (3) Transmitting (3): slotted ALOHA has a higher probability Steady State Probabilities s1s1 s2s2 s3s3 Pure ALOHAu0u0 1-u 0 –u 0 u 1 u0u1u0u1 Slotted ALOHAu0u0 1- u 0 –u 1 u1u1

Slotted ALOHA Performance : mean rate of attempted (input) transmissions   =  k ku k = Na  Also called load One frame is transmitted whenever system at state 3  Probability s 3 0 frames are transmitted at any other state  mean rate of transmitted frames: s 3 (per timestep)  Th = s 3 = u 1 = Na(1-a) N-1  Compare Pure ALOHA: s 3 = u 0 u 1 = Na(1-a) 2N-1 Slotted ALOHA Th higher by factor (1-a) -N

Retransmissions and delay Probability of successful attempt to transmit a frame:  Access Probability: p A = Th/  = (1-a) N-1  also called efficiency,  Probability of unsuccessful attempt: 1- p A Probability of k unsuccessful attempts followed by a successful attempt: (1- p A ) k p A Retransmissions: Average number of unsuccessful attempts before successful transmission of a frame: n R  n R  k k* (1- p a ) k p a k goes from 1 to ∞ n R = (1-  p A )/  p A  p A  -1 = 1/ (1-a) N-1 - 1

Max Throughput For fixed N, find a so that throughput is maximal: dTh/da = 0  a M = 1/N Th(max) = [1- 1/N] N-1 For N  ∞ Th(max) = 1/e = 0.3679 frames/timestep Compare ALOHA: For N  ∞ Th(max) = 1/2e = 0.18394 frames/timestep

efficiency at max throughput, large N Input rate: = Na M = 1 frames/timestep Compare ALOHA:  = Na M = 0.5 frames/timestep Efficiency (probability of successful access) :  p A = (1- a M ) N-1 = (1 – 1/N) N-1  1/e = 0.367 Compare ALOHA:  p A = (1-a M ) 2N-1 = (1 – 1/2N) 2N-1  1/e = 0.367 At max throughput, large N limit, both models have same efficiency and same number retransmissions! n R = [1 -1/e]/(1/e) = e -1 = 1.718 attempts per frame  Compare ALOHA: same

Throughput as a function of load N = 10; horizontal axis is = Na Dotted line: ALOHA; Solid line: Slotted ALOHA Both system show max throughput at very low traffic  = 0.5, 1.0 frames/timestep respectively As input rate increases, both throughputs decrease rapidly Slotted Aloha Aloha

CSMA/CD

CSMA/CD (1) CSMA/CD (also Ethernet) used when bit propagation time  p between farthest LAN stations is much smaller than transmission time  t of a frame (transmission delay) Unlike ALOHA - Station sense the medium. Then either:  1-persistent CSMA: if idle, send. Else continuously monitor channel; send when idle  nonpersistent CSMA: if idle, send. Else wait random time, sense again, send if idle. Else, wait again…  p-persistent: if idle, send frame with probability p, or defer for next timeslot with probability 1-p if next timeslot channel is idle. Else sense again…

CSMA/CD (2) within transmission time  t a station will identify a collision if there is one, by Carrier Detection mechanism Upon collision: stop transmitting, wait random, sense etc.. If collision during retransmission, double the range of wait time (exponential backoff)

Markov Model Assumptions and parameters Channel shared by N stations States of the channel: Idle, Transmitting, Collided Time-step (time-slot) = propagation time: T =  p Transmitted frames have equal lengths Frame transmission time:  t = n timesteps Usually n >> 1 There are n Transmitting states! t 1, t 2, …t n

The backoff assumption After Transmitting state t n, system jumps to Idle  To sense the medium  Stations with frame to send will request access after the Idle Timestep After Collided:  colliding stations have definitely a frame to send  But we assume that the stations backoff to Idle  To sense the medium why? 1 persistent CSMA/CD with backoff

Basic Probabilities request probability a probability that a station created during T has a frame to send  the frame will be sent in the next T Probability that k stations request to send in (next) T:  u k = [N!/(k!(N-k)!)]a k (1-a) N-k  u 0 = (1-a) N u 1 = Na(1-a) N-1

States and transitions Idle:  System stays Idle if no station request access. Pr = u 0  jump to Transmitting state 1 if just one stations request access. Pr = u 1  Otherwise jump to collided. Pr = 1-u 0 –u 1 Transmitting state j, t j : (j = 1, 2, …n-1)  jump to Transmitting state t j+1. Pr = 1 why? Transmitting state n:  jump to idle. Pr = 1 Collided:  jump to idle. Pr = 1. why we did not have that in ALOHA ?

CSMA/CD: State Transition Diagram

Transition Matrix We organize the n+2 states: Idle, t 1, t 2, …t n, collided

Steady State Probabilities s = [s i s t 1 s t 2 … s t n s c ] t Ps = s  k s k = 1 Solution: Denote: K = 1/(2 + u 1 (n-1) – u 0 ) Probability to be in the Idle state  s i = K  Probabilities to be in Transmitting state t i s t 1 = s t 2 = s t 3 = … = s t n = Ku 1 Probability to be in Collided state  s c = K(1-u 0 -u 1 )

CSMA/CD Performance: Throughput Throughput Th: Mean rate of transmitted frames (1/n) of a frame is transmitted at each state t k : Pr = s t k 0 frames are transmitted at any other state  Throughput = (1/n)  k s t k = Ku 1 Packets/Time-step  Th = nu 1 /[2 + u 1 (n-1) – u 0 ] Packets/Time-step  Large n: Th  1  Very little time wasted during Collision Reminder:  u 0 = (1-a) N u 1 = Na(1-a) N-1

Throughput vs load Load : Average rate of attempted transmissions  =  k ku k = Na Draw Th as a function of N = 10, n = 10, 0 < <10 CSMA/CD Slotted ALOHA ALOHA

CSMA/CD performance: Access Probability Probability of successful attempt to transmit a frame: p A p A = output rate/Input rate = Th/  also denoted  p A = (nu 1 /  ) / [2 + u 1 (n-1) – u 0 ] Draw p A v.s  : N = 10, n = 10 CSMA/CDSlotted ALOHAALOHA

Retransmissions Probability of successful attempt to transmit a frame: p A Probability of unsuccessful attempt: 1- p A Probability of k unsuccessful attempts followed by a successful attempt: (1- p A ) k p A Retransmissions: Average number of unsuccessful attempts before successful transmission of a frame: n R  n R  k k* (1- p A ) k p A k goes from 1 to ∞ n R = (1-  p A )/  p A  p A  -1 n R is also the delay of transmitting a frame in timesteps

CSMA/CD Performance: Delay Draw Delay v.s for: N= 10, n = 10 CSMA/CDSlotted ALOHAALOHA

Carrier Sense Multiple Access Collision Avoidance (CSMA/CA)

CSMA/CA CSMA: Carrier Sense, Multiple Access  “Listen before Talk”, Used in Wireless LANs (Wifi) Transmitting station unable to determine if collision occurred while transmitting  The transmitted signal will hide arriving signals Station knows about collision via NACK or timeout  Collision Detection is not used  Carrier Sense Multiple Access /Collision Avoidance

Simple CSMA/CA Model: Basic properties Channel states: Idle, Transmitting, Collided Max propagation time between stations:  p Time step T =  p Frame transmission time  t = nT  n > 1 long frame, small LAN If channel Idle, and frame available, transmission starts  1-persistent CSMA/CA A transmitting station will keep transmitting a whole frame without attempting to identify collision n transmitting states: t i

Simple CSMA/CA Model: Basic properties (2)  A collided frame will continue to be collided – its transmission will not be stopped  n collided states: c i When transmitting ends, or when collided ends, all stations go back to sense the medium (Idle) a: Probability that a station has a frame to transmit u k : Probability that k stations have frames to transmit u k = [N!/(k!(N-k)!)]*a k (1-a) N-k  u 0 = (1-a) N u 1 = Na(1-a) N-1

Simple CSMA/CA: State Transition Diagram

Transition Matrix Organize states: [i, t 1, t 2, …t n. c 1, c 2, …c n ] Example Transition Matrix (n = 3)

Simple CSMA/CA: Steady State Probabilities Ps = s   k s k = 1 Solution: Denote: K = 1/(n(1-u 0 ) + 1) s i = K s t 1 = s t 2 = … =s t n = Ku 1 s c 1 = s c 2 = … =s c n = K(1-u 0 -u 1 )

Simple CSMA/CA: Throughput (1) Throughput Th: Average rate of transmitted frames (1/n) frame transmitted at each transmitting state t k  Pr = s t k 0 frames are transmitted at any other state  Throughput: (1/n)  k s t k (Packets per timestep)  Th = nu 1 /[n(1- u 0 ) + 1] (Packets per Frame Time) Where:  u 0 = (1-a) N  u 1 = Na(1-a) N-1

Simple CSMA/CA: Throughput (2) : Average rate of attempted (input) transmissions  =  k ku k = Na For large N, fixed :  u 0 = (1-a) N = (1- /N) N  e -  u 1 = Na(1-a) N-1 = (1- /N) N-1  e -  Th  n  e -  n(1- e -  For large N, large n (large net, long frames): Th  e -  (1- e -  (e  

Simple CSMA/CA: Throughput (3) Draw Th as a function of  Na  N = 10, n = 50 Simple CSMA/CA ALOHA Slotted ALOHA

Throughput: CSMA/CA vs. CSMA/CD CSMA /CA: lower throughput Probability of transmitting is lower, due to many Collided N = 50, n = 10 Simple CSMA/CA ALOHA Slotted ALOHA CSMA/CD Slotted ALOHA ALOHA

Access Probability p A = Th/ Draw p A as a function of  Na: N = 10, n = 50 CSMA/CA Slotted ALOHA ALOHA

Retransmissions and Delay Retransmissions: Average number of unsuccessful attempts before successful transmission of a frame: n a  n R  k k* (1- p A ) k p A = (1-  p A )/  p A  p A  -1 n R is also the delay of transmitting a frame in timesteps Draw n R as a function of  Na  N= 10, n = 50) CSMA/CA Slotted ALOHAALOHA

Distributed Coordination Function (DCF) Medium Access Control for Ad Hoc Wireless LANs

DCF Medium Access Control Part of IEEE802.11 Standard, Based on CSMA/CA Algorithm for a station, when it has a frame:  Sense the medium, when idle, wait PCF/SIF time  Choose a random value r (backoff, reservation number)  If channel idle during a timeslot, decrement r by 1  else do not decrement r  When r == 0 (and channel still idle), transmit Basic idea: Small Probability that two stations choose same value (collision)  Note: No collision detection procedure

DCF: Using the Backoff counter Assume Max backoff (reservation) value: 5 Station chose r =2 After PCF/SIF, channel was idle during timeslots 0, 1  Station started transmitting  Note: timeslot assumed smaller than Time Step

Using the Backoff Counter example Tag-User chose r=7 X-User chose r=2  Channel idle 2 slots X-User transmits Tag-User: r=5 Y-User chose r=1  Channel idle 1 slot Y-User transmits Tag-User: r= 4 Channel idle 4 slots  Tag-User transmits

Classification of stations to r-sets Each station choose a reservation value r from 0…w-1 Stations divided into “r-sets” according their r values Stations sense the medium at beginning of Time Step, then: A station from {r-set k} transmits (if it has a ready frame…) if none of {r-set j} stations, j = 0,1, 2,..k-1 have frames to transmit

Markov Model: Assumptions and parameters (1) T: Time Step: max expected propagation delay  p plus the time to sense the medium to determine if idle  Also called Distributed Inter-frame Separation (DIFS)  At least w time slots Channel states: Idle, Transmitting, Collided Frame transmission = n Timesteps n >1  n transmitting states, t 1, t 2, …t n Station finds it had collision via NACK/ Timeout  After full transmission of its (colliding) frame  n Collided states, c 1, c 2, …c n

Markov Model: Assumptions and parameters (2) Reservation values 0…w-1; w sets of stations: {r-set 0}, {r-set 1}, …{r-set w-1} Each set has N’ = N/w stations  N’ stations competing to access medium at each timeslot  N’ < N  Less competition relative to CSMA/CA

Markov Model: Assumptions and parameters (2) A station can have at most 1 frame waiting for transmission. a: Probability of having a ready frame in the beginning of the Time Step (during the timeslot of its r-set) v k : Probability that k stations from a set, size N’, attempt transmission in a Time Step v k = N’!/[k!(N’-k)!]*a k (1-a) N’-k 0 ≤ k ≤ N’  Where N’ = N/w

States and transitions (1) Channel states: Idle, Transmitting t k, Collided c k Idle:  channel stays Idle if all stations, in all w r-sets have no frame to transmit  Pr ≡ x = (v 0 ) w = (1-a) N  Otherwise the channel will jump to other state (next slides)

States and transitions (2) Channel jumps from idle to t 1 if: 1 station from {r-set 0} has ready frame; Probability v 1 OR 1 station from {r-set 1} has ready frame & no station from {r-set 0} has ready frame; Pr = v 0 v 1 OR 1 station from {r-set 2} has ready frame & no station from {r-set 0}, {r-set 1} has ready frame; Pr = (v 0 ) 2 v 1 …… OR 1 station from {r-set w-1} has ready frame & no station from {r-set j}, j < w-1 has ready frame; Pr = (v 0 ) w-1 v 1  Pr y = u 1 + v 0 v 1 + (v 0 ) 2 v 1 + (v 0 ) 3 v 1 + …(v 0 ) w-1 v 1  y = v 1 *(1-(v 0 ) w )/(1-v 0 )

States and transitions (3) Channel jumps from Idle to Collided in all other cases: More then one station in any r-set requests access z = 1-x –y Channel jumps from transmitting state t j to transmitting state t j+1, Pr = 1 Channel jumps from transmitting state t n to idle, Pr = 1 Channel jumps from collided state c j to collided state c j+1, Pr = 1 Channel jumps from collided state c n to idle, Pr = 1

DCF Markov Model: State Transition Diagram

Transition Matrix Organize the states: idle, t 1, t 2, …t n, c 1, c 2, …c n Example Transition Matrix for n = 3

Steady State Probabilities Ps = s   k s k = 1 Solution: s = K*[ 1 y y …y z z … z] t  K = 1/(n(1-x) +1)  s t k = Ky Probability to be in transmitting state  s c k = Kz Probability to be in colliding state where  x = (v 0 ) w = (1-a) N ; y = v 1 *(1-(v 0 ) w )/(1-v 0 ); z = 1-x –y  v k = N’!/[k!(N’-k)!]*a k (1-a) N’-k ; N’ = N/w

DCF Performance: Throughput (1) Throughput Th: Average rate of transmitted frames 1/n frame is transmitted whenever system at states t k  Probability s t k 0 frames are transmitted at any other state  Throughput = (1/n)  k s t k = Ky Frames per Time Step  Th = ny/[n(1- x) + 1] Frames per FrameTime Probability that k frames are ready to be transmitted irrespective of the reservation number: u k = N!/[k!(N-k)!]*a k (1-a) N-k Load (Average input rate): =  k ku k = Na

DCF Performance: Throughput (2)  Graph of Th vs load: N = 2, n = 10, w = 8 DCF Protocol CSMA/CA Slotted ALOHA ALOHA

Throughput (3): Effect of the reservations Dependence on the “reservation window” size, w N = 32, n = 10, w = 4, 8, 16

Throughput (4): Effect of the reservations Introducing reservation distributes access requests between slots  less chance of collisions  increase throughput Reducing n  larger probability to listening (idle)  Smaller throughput

DCF Performance: Access Probability Probability of successful attempt to transmit a frame: p A p A = output rate/Input rate = Th/  p A = ny/[{n(1- x) + 1}  Draw p A as a function of the load,  N=32, n=10, w=8 DCF Protocol CSMA/CA Slotted ALOHA ALOHA

DCF: Retransmissions and Delay Retransmissions: Average number of unsuccessful attempts before successful transmission of a frame: n R  n R  k k* (1- p A ) k p A = (1-  p A )/  p A  p A  -1 n R is also the delay of transmitting a frame in timesteps Draw n R as a function of (N= 32, n = 10, w=8) DCF Protocol CSMA/CA Slotted ALOHA ALOHA

Limitations of the Model 1. Errors were not consider. Is that serious? Access control is data link protocol  One may assume that errors were dealt with by the physical layer 2. We used simple backoff procedure, not binary backoff 3. We assume that in every timestep there is a probability for a station to create a frame. If the frame is transmitted, fine, but if it is not new frames are not queued.  That means that the station transmission buffer has only a single frame storage.  One need to add another queue

Download ppt "Tel Hai Academic College Department of Computer Science Prof. Reuven Aviv Markov Models for Access Control in Computer Networks Resource: Fayez Gebali,"

Similar presentations