Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Introduction to Queueing Theory First developed to analyze statistical behavior of phone switches. Queueing Systems used to model processes in which customers arrive, wait their turn for service, are serviced and then leave. Eg: supermarket checkouts stands, world series ticket booths, doctors waiting rooms etc.. Five components of a Queueing system: May 3, 2017 Page 1 Chap. 4 handout 1. Interarrival-time probability density function (pdf) 2. service-time pdf 3. Number of servers 4. queueing discipline 5. size of queue. ASSUME an infinite number of customers (i.e. long queue does not reduce customer number). Bad assumption in a time-sharing model, with finite number of customers, if half wait for response, input rate will be reduced. May 3, 2017 Page 2 Chap. 4 handout Interarrival-time pdf – e.g. record elapsed time since previous arrival, list the histogram of interarrival times (i.e. 10 0.1 sec, 20 0.2 sec ...) This is a pdf character. Service time - how long in the server? i.e. one customer has a shopping cart full the other a box of cookies. Need a PDF to analyze this. Number of servers - banks have multiserver queueing systems, food stores have a collection of independent single-server queues. May 3, 2017 Page 3 Chap. 4 handout Queueing discipline - order of customer processing i.e. supermarkets are first-come-first served. Hospital emergency rooms use sickest first. Some queues have finite length: when full customers are rejected. ASSUME infinite-buffer, single-server system with firstcome, first-served queues. A/B/m notation A=interarrival-time pdf B=service-time pdf May 3, 2017 Page 4 Chap. 4 handout m=number of servers. A,B are chosen from the set: M=exponential pdf (M stands for Markov) D= all customers have the same value (D is for deterministic) G=general (i.e. arbitrary pdf) M/M/1 is known, G/G/m is not. For M/M/1 the probability of exactly n customers arriving during an interval of length t is given by the Poisson law: May 3, 2017 Page 5 Chap. 4 handout (1) ( t) n t Pn (t ) e n! This law appears in: physics (radio active decay (P[k alpha particles in t seconds] with = avg # of prtcls per sec operations research planning switchboard sizes P[k calls in t seconds] with =avg number of calls per sec biology water pollution monitoring P[k coliform bacteria in 1000 CCs] =avg # of coliform bacteria per cc Transportation planning size of highway tolls P[k autos in t minutes] =avg# of autos per minute May 3, 2017 Page 6 Chap. 4 handout optics in designing an optical recvr P[k photons per sec over the surface of area A] =avg# of photons per second per unit area Communications in designing a fiber optic xmit-rcvr link P[k photoelectrons generated at the rcvr in one second] with =avg # of photoelectrons per sec. =rate parameter=event per unit interval (time distance volume...) The Poisson law results from asymptotic behavior of the binomial law (in the limit as the prob[event]->0, # of trials -> infinity and the number of events is small compared with the number of trials) May 3, 2017 Page 7 Chap. 4 handout May 3, 2017 Page 8 Chap. 4 handout let interarrival rate 10 cust. per min n the number of customers = 100 t interval of finite length P10 (t), 10 P0 (t ) e t t 0 P1 (t) te t a(t)t e t te t May 3, 2017 Page 9 Chap. 4 handout a(t)dt 1 t0 proof: e ax e dx a ax e t t 0 e dt e e e 1 a(t)dt e t dt t a(t)t prob. that an interarrival interval is between t and t + t e.g. May 3, 2017 Page 10 Chap. 4 handout interarrival rate 10 cust. per min n the number of customers = 100 we should get 100 custs in 10 minutes (max prob). In maple: P10 (t), 10 May 3, 2017 Page 11 Chap. 4 handout 0.04 0.03 0.02 0.01 0 5 10 15 t 20 0 May 3, 2017 Page 12 Chap. 4 handout To obtain numbers with a Poisson pdf, you can write a program: total=length of sequence lambda = avg arrival rate exit x() = array holding numbers with Poisson pdf local num= Poisson value r9 = uniform random number t9= while loop limit k9 = loop index, pointer to x() May 3, 2017 Page 13 Chap. 4 handout for k9=1 to total num=0 r9=rnd t9=exp(-lambda) while r9 > t9 num = num + 1 r9 = r9 * rnd wend x(k9)=num next k9 (returns a discrete Poisson pdf in x()) Prove: that Poisson arrivals generate an exponential interarrival pdf. May 3, 2017 Page 14 Chap. 4 handout a(t)t prob. that an interarrival interval is between t and t + t This is the prob. of 0 arrivals for time t times the prob. of 1 arrival in t: a(t)t P0 (t)P1 (t) ( t) n t e subst into (1) Pn (t ) and you get: n! P0 (t) e t and P1 ( t ) te t In the limit as t 0, the exponential factor in P1 ( t ) te t approaches 1 so by subst.: a(t)t P0 (t)P1 (t) = a(t)t e t te t and May 3, 2017 Page 15 Chap. 4 handout a(t)dt e t dt (2) with a(t )dt 1 t 0 proof : e ax e dx a ax e t e t dt e t e e 0 1 We have made several assumptions: May 3, 2017 Page 16 Chap. 4 handout 1. exponential interarrival pdf. 2. exponential service times (i.e. long service times become less likely) The M/M/1 queue in equilibrium queue server There are 4 people in the system (and this describes the state of the system). May 3, 2017 Page 17 Chap. 4 handout 3 in the queue, 1 in the server. The amount of time the person in the server has already spent being served is independent of the probability of the remaining service time. M/M/1 queues are memoryless (a popular item with queueing theorists, and a feature unique to exponential pdfs). Pk equilibrium prob . that there are k in system In a birth-death system once serviced a customer moves to the next state. This is like a non-deterministic finite-state machine. The following state-transition diagram is called a Markov chain model. Directed branches represent transitions between the states. Exponential pdf parameters appear on the branch label. May 3, 2017 Page 18 Chap. 4 handout These are the states for a single-server queueing system. Po 2 1 0 P1 P k -1 P1 ... k k-1 P k P 2 P k k+1 P k +1 mean arrival rate (cust. /sec) P0 mean number of transitions / sec from state 0 to 1 mean service rate (cust./sec) P1 mean number of transitions / sec from state 1 to 0 May 3, 2017 Page 19 Chap. 4 handout State 0 = system empty State 1 = cust. in server State 2 = cust in server, 1 cust in queue etc... Prob. of a given state is invariant wrt time if system is in equilibrium. The prob. of k cust’s in system is constant. This is like AC current entering a node and is called detailed balancing thus, the number leaving a node must equal the number entering: 3 May 3, 2017 P 0 P 1 Page 20 Chap. 4 handout P0 3a P1 4 P1 P 2 4a P2 P1 by 3a 4b P2 P0 2 P 0 = P2 2 since May 3, 2017 Page 21 Chap. 4 handout P k P k+1 5 then k P0 P k k k P0 6 where = traffic intensity < 1 since all prob. sum to one, 6a k0 k P0 1 P0 k 1 k 0 and since the sum of a geometric series is May 3, 2017 Page 22 Chap. 4 handout k 7 k0 1 1 subst 7 into 6a : 7a P0 1 1 and 7b P0 1 =prob server is empty subst into(6) 8 P k (1 ) k let N=mean number of cust’s in the system May 3, 2017 Page 23 Chap. 4 handout To compute the average (mean) value use: E[k ] 8a kPk k 0 subst (8) into (8a) to obtain 8b 8 P k (1 ) k 8b E[k ] k(1 ) k 0 k (1 ) k k differentiate (7) wrt k k0 1 1 8c Dk Dk k k 1 1 k 0 (1 ) 2 k0 multiply both sides of (8c) by May 3, 2017 k Page 24 Chap. 4 handout 8d 9 May 3, 2017 (1 )2 k0 E[k ] N (1 ) (1 ) 2 (1 ) k k Page 25 Chap. 4 handout 80 60 40 20 0 0.2 0.4 0.6 0.8 rho 1 0 as approaches 1, N grows quickly. T=mean interval between cust. arrival and departure, including service. May 3, 2017 Page 26 Chap. 4 handout mean arrival rate (cust. /sec) In 1961 D.C. Little gave us Little’s result: 10 T N / 1/ 1 1 1 For example: A public bird bath has a mean arrival rate of 3 birds/min in Poisson distribution. Bath-time is exponentially distributed, the mean bath time being 10 sec/bird. Compute how long a bird waits in the Queue (on average). May 3, 2017 Page 27 Chap. 4 handout 0.05 cust / sec = 3 birds / min * 1 min / 60 sec = mean arrival rate = 0.1 bird / sec = 1 bird =mean service rate 10 sec So the mean service-time is 10 seconds/bird =(1/ service rate) T 1 1 20 sec for wait + service 0.1 0.05 May 3, 2017 Page 28 Chap. 4 handout The mean queueing time is the waiting time in the system minus the time being served, 20-10=10 seconds. Tannenbaum says that the mean number of customers in the system for an M/G/1 queueing system is: 1 Cb2 N 2(1 ) (11) Cb 2 standard deviation mean of the service time. This is known as the Pollaczek-Khinchine equation. Note: M/G/1 means that it is valid for any service-time distribution. May 3, 2017 Page 29 Chap. 4 handout For identical service time means, the large standard deviation will give a longer service time. May 3, 2017 Page 30 Chap. 4 handout