Presentation is loading. Please wait.

Presentation is loading. Please wait.

Random Variables r Random variables define a real valued function over a sample space. r The value of a random variable is determined by the outcome of.

Similar presentations


Presentation on theme: "Random Variables r Random variables define a real valued function over a sample space. r The value of a random variable is determined by the outcome of."— Presentation transcript:

1 Random Variables r Random variables define a real valued function over a sample space. r The value of a random variable is determined by the outcome of an experiment, and we can assign probabilities to these outcomes. r For the role of a die and rv Y: P{Y=i} = 1/6 for any number i=1,2,3,4,5,or 6. r For the role of a pair of dice and rv X: P{X=2} = 2/36 P{X=3} = 2/36 P{X=4} = 4/36 P{X=5} = 4/36 and so on...

2 Bernoulli and Binomial RVs r Suppose a trial can be classified as either a success or failure (arrival of a packet or not). r For an rv X, let X=1 for an arrival, and X=0 for a non-arrival, and let p be the chance of an arrival. r p(0) = P{X=0} = 1 - p p(1) = P{X=1} = p r Suppose we had n trials. Then for a series of trials, define a binomial RV with parameters (n,p) as:

3 Poisson Random Variables r Poisson is an estimation of a binomial RV with params (n,p) r Let =np, therefore p= /n. r Remember that terms in box equal to about 1

4 Poisson RVs r In short, for poisson rv, we have the following distribution r The mean is r Take an interval [0,t] and N(t), the number of events occurring in that interval. r Without additional derivation, take it as true that r The number of events occurring in any fixed interval of length t is stated above. (It’s a Poisson random variable with parameter t and mean of t.)

5 Exponential RVs r The exponential rv arises in the modelling of the time between ocurrence of events. m Packet interarrival times r exponential rv X with parameter lambda: r The probability that this time exceeds h seconds r For a poisson random variable, the time between events is an exponentially distributed r.v.

6 Relationship Between RVs r The number of trials (time units) until the arrival of a packet is a geomtric random variable. r As the number of trials gets large, the approaches an exponential random variable.... 0 T The interval [0,T] has been divided into n sub-intervals. The number of packets arriving is a binomial random variable, but with a large number of trials, can becomes a Poisson r.v.... 0 T

7 Generic Delay Model The Big Black Box of delay (T seconds) Arriving customers Departing Customers

8 Some terms… r Each customer spends T seconds in the box, representing service time. r Let N(t) represent the number of customers in the system at time t. r Throughput: average number of messages per second that pass through the system.

9 Generic Delay Model The Big Black Box of delay (T seconds) Arriving customers Departing Customers A(t) N(t)= A(t) - D(t) D(t)

10 Arrivals r Let A(t) be the number of arrivals from time t=0 to time t. r Let D(t) be the number of departures. r Then number in system at time t: N(t) = A(t) - D(t). Assuming the system was empty at t=0.

11 Generic Delay Model The Big Black Box of delay (T seconds) Arriving customers Departing Customers A(t) N(t)= A(t) - D(t) D(t)

12 Num. of Customers in the system r Let a 1 be the 1 st arrival in the system. The 2 nd comes a 2 time units later a1a1 a2a2 a3a3 a4a4 A(t) t

13 Avg num in the system r The number in the system at time t. T1T1 T2T2 T3T3 T4T4 a1a1 a2a2 a3a3 a4a4 A(t) t D(t)

14 Avg num in the system r The number in the system at time t. T1T1 T2T2 T3T3 T4T4 a1a1 a2a2 a3a3 a4a4 A(t) t D(t) N(t)

15 Arrivals r Let a 1 be the 1 st arrival in the system. The 2 nd comes a 2 time units later. r Therefore the n th customer comes at time a 1 + a 2 + a 3 +  + a n. r The avg arrival rate,, up to the time when the n th customer arrives is n / (a 1 + a 2 +  + a n ) = customer/sec r Note the avg interarrival rate of customers is the reciprocal of : (a 1 + a 2 +  + a n ) /n sec/customer r Arrival rate = 1/(mean of interarrival time).

16 Queuing fun r The long-term arrival rate is therefore customers/sec r Similarly, we can derive throughput  Throughput = customers/sec Note the average service time is 1/ .

17 Example r We are in line at the bank behind 10 people, and we estimate the teller taking around 5 minutes/per customer. r The throughput is the reciprocal of average time in service = 1/5 persons per minute r How long will we wait at the end of the queue? The queue size divided by the processing rate = 10/(1/5) = 50 minutes.

18 Kendall Notation r Queuing systems are classified by a specific notation denoting: m The customer arrival pattern m The service time distribution m The number of servers m The maximum number of customers in the system. r E.g., M/M/1/  Exponential interarrivals, exponential service times, 1 server, infinite buffer. (usually “M/M/1”) r M= exponential, D= deterministic, G= general r E.g., M/M/c/K exponenetial interarrivals, exponential service times, c servers, K customers can queue. queue server

19 M/M/1 Queue r In a steady state, i.e., < . r Interarrival time are random and have an exponential distribution. r FIFO servicing. r Service time is random and has an exponential distribution. r 1 server r No limit to the size of the queue. queue server

20 M/M/1 Queue: busy period r Let’s derive traffic intensity . r Let P 0 be the probability of that the system is idle. r The system is defined to be in steady state, so what goes in must come out. = (0 customers)P 0 +  (1-P 0 ) =  (1-P 0 ) P 0 = 1 - ( /  ) r The utilization is 1-P 0 = ( /  ) =  r  is in Erlang units and is a measure of traffic intensity.

21 M/M/1: Coming and Going r The interarrival times are exponential with mean ; We know the number of arrivals A(t) in an interval t is given by a Poisson random variable r It has a mean E[A(t)]= t r We can say the same of the departure times: they are exponential with a rate . The number of departures are a Poisson rv, the mean is E[D(t)]=  t

22 More Derivation Fun r So what can we do with E[A(t)]= t and E[D(t)]=  t? r With some derivation, we can figure out probabilities and expected means of m The mean number of customers in the system m The mean time customers spend in the system m The mean number queued up. m The mean time spent being queued up. r To do this we are going to set up a state diagram and solve for equations.

23 States r Let the “state” of our system be equal to the number of customers in the system. r Because we are modeling using Exponential RVs, the M/M/1 queue is memoryless. r The transition to a new state is independent of time spent in the current state, all that matters is the number in the system. r There is a certain probability of being in any state n. r In a steady state, this probability becomes independent of time and is written P n. r Hence, that’s why we considered the idle time as P 0.

24 Markovian Models r For any small interval of time t, there is a small chance of an arrival, and a small chance of a departure. r Let’s make t small enough that the chance of both a departure and arrival is negligible. 0 1 t tt 2 3 t tt

25 r For an arbitrary set of states, we have the following set of transition probabilities r Because we are in steady state, the flow between states (the transition probabilities) must balance. ( P n-1 )t= (  P n )t States n- 1 n t tt n+1 t tt 0 1 t tt 2 t tt...

26 Transition Probabilities r Because we are in steady state, the flow between states (the transitions) must balance. (  P n+1 )t= ( P n )t P n+1 = /  P n P n+1 =  P n r Let’s use this recurrence to solve for P n. For n=1, P 1 =  P 0. For n=2, P 2 =  P 1 =  2 P 0 P n =  n P 0 r These probabilities must sum to 1…

27 Solving the Recurrence r P n =  n P 0. These probabilities must sum to 1: and therefore and substituting above P n =  n (1-  )

28 Mean number in system r What can we do with this? r It tells us the probability that there are n customers in the system. r Therefore, to find the mean number of customers in the system, it’s and substituting above P n =  n (1-  )

29 Mean number of packets in the sys r What’s the mean number of packets in the system? r It’s the sum of the number of customers times the probability of that state.

30 Mean number in Queue r Notice the mean number in queue is larger than 1 even for the smallest traffic intensities. r And that the queue size tends towards infinity even though the service rate is larger than the arrival rate

31 Mean time in system r Call the mean time packets are in the system E[T]. r We know from Little’s Law that: E[N] = E[T] r Therefore, E[T] = E[N]/ =  / (1-  )

32 Meantime waiting in Queue r The mean time waiting in queue E[Q], is the time spent in the system not being serviced. r How long do we wait in service on average? m The reciprocal of the departure rate (1/  `.

33

34 Summary r E[N] = mean number in system r E[T] = mean time in system r = average arrival rate r avg number in system is equal to the avg number in queue and the avg number in service E[N] = E[N q ]+E[N s ] r Avg time in systems is equal to the avg time in queue and the avg time in service E[T] = E[Q]+E[X] r From Little’s Law that E[N] = E[T] r And E[N q ] = E[Q]

35 Summary r From Little’s Law that E[N] = E[T] r And E[N q ] = E[Q] r Given any one of E[N], E[N q ], E[T], or E[Q], we can calculate the other three; assuming we know and E[X]. r For example, if I tell you E[T], then E[N]= E[T], E[Q]= E[T]-E[X] E[N q ]= E[Q] = (E[T]-E[X])

36 Summary r We also know that E[N]=  /(1-  ) E[T] = E[N]/ =  / (1-  ) r We know that E[X] = 1/  =  / m therefore E[T]= E[X]/(1-  ) r and E[Q] =  /(1-  )  r and E[Q]=  E[X]/(1-  ) r E[N q ] = E[Q]=  /(1-  )  =  2 /(1-  )


Download ppt "Random Variables r Random variables define a real valued function over a sample space. r The value of a random variable is determined by the outcome of."

Similar presentations


Ads by Google