You are on page 1of 14

Models Queuing

the lo be should used determrne appropnate analysis Prcducerhonsumer consumption can datawhenproduction exceed for buffersizes buffered for shonbu$ts probability models are discrete digitalnature, of : . Because lheir inherent real time systems bestusedwhenmodeling reaftime interuptdriven lo qDeue beused modela simple can 3 . An MM/l system in theory its application and to provtdes brief infioduction queuing a Thischapter of in application theprcdiction and discusses systems, of rhe analysis real-time buffer sizes and in performancemeasutementThe reader is assumedto be of space, probability and event'sample of familiarwith the concepts expenment, in theory of the who readers wish to pursue slDdy queumg occurenceInterested gilen in [28] and [82]' the consult treatments greater detailshould

FUNCTIONS 10.1 PROBABILITY of modeling a sysem is the in concept the mathematical The most important of is a funclionthat maPselements the A rardom variable. randomvariahle into ihe real line Iftle to the samplespace, setof outcomes someexPdment' roMom variable sajdrobe a dtscrete is then is space discrete, therandom sample is to variable sard be then is sPace continuous, therandom rdri;ble. If thesample

Chap.i0 r Queuing Models

a continuous random ran,rble Wewill usetheappropriate discrete continuous or random variables associated and probability drstnbutions descnbe to processes depending thenafure th€underlying on of sample spaceFor example, arrival the timeofan interuptcanbemodeled a continuous by random variable, wher%s the number packets of received a cefiain by process modeled a dtscrete is by random variable.

10.1,1 Contlnuous
The continuousreal-valuedfunction/is called a prcbabilit\t densit,f nctnn or probabiliry distribwion for t}le continuousnndom vaiable X lf the followine conditlonshoid:

t . flr) > 0 for all -r e ill 2. flr) d, = | 3 . The prcbability that the randomvariableX takeson a value between and lr, a p(a denoted < X < b) is givenby p(a<x<b) = 1 \ xd , t )

Note that for a confinuousprcbability drstriburion and conslant c, the value p(,r =.)=0 Moreover,recall that the "averagevalue," or mea, ofthe density functronf A denoted p whie ils rariance, a fieasure of how widely scafteredthe values ofr are from the mean. is denoted.'2. Some common continuousprobabilily dntnbutions include exponential, Weibull, and Caussian. I EXAMPLE IO.I TheGaDsieor nomaldislnbudon a random fo! variable is given X by
hlx) = G-p), I E=a ,c

(10 r)

with meanp andvaaance An exampleoi sucha densiryfuncnonwirh F = 0 andd, = I is given o': in Figure101 I I EXAMPLE10.2 The exponentialdistribut'o.n a randod vanabler is given by for /d=L "

(10.2) I

The "average" valDe rhisdisrriburion be shoM lo be i t821. for can The graph disriburion b shown in Figrre l0 2

Sec 102 I DiscreE


P =0 probablllty function {ith F = 0 and0: = | Figur€ l0.l The Gaussan

disLribulion Figure l0: The exponential

I EXAMPLE,1O.3 variable is given ? by disLriburiona rdndofr for TheWeibull lil)= "BP-'--'/>o


for density funcdon vdious values of where > 0 md p > 0. The graphs theWeibdllProbability d I of rhepamete^ o andp aregivenin FLg!rel0 3

The real-valueddiscretefunction/ is a called a prcbabiliry distributianfunction or probabilit! dislributio, for the discreterandomvariableXifthe folowing three conditionshold:

Models Chap l0 I Queuing

Figure 10.3 The weibull prcbability tunction for different p and o = l

1. /(i) > 0 for all lalues t € X. 2. >J€) = l. wherer rangesover values of X. 3 The probability that the random variable X tates on a value i, denoted p(X = .r), is siven by /(i).

form of prcbabilitydistdbutions includea discrete discrcte Somecommon distribulioL disttibutlon, thePoisson and ihe unifom distribution, binomial
dishbutionis usedlo A fEquendyuseddiscEleprobabity distibnlion,lbe Poisson of phenon€nain which the occurence of individual eventsis independeni my Previou Fomally, it rs definedas

P,(t =

(r 0' -k!

with t,/ > 0 Plr) de.otes the probabihty of t occuren@s in time r, atd I r ihe per @cuEences unit lime. Nore that the probrbility distribution of the inlemrivdl lime 'rL betw@n two consecutiveevents)in a Poissonproce$ is given by $e ex?onential disdbulionwith mean i.

The Poissonprccessis a good model for many naturally occuring the phenomena. a Poissonprocess, prcbability distribution for lhe In
occufiences in time I is Poisson, and the probability distribution of &

between occufences is exponential We will be ushg ihese lwo exclusively. distibutrons

SizeCalculat'on S€c.10.3t BasicBulTer


storage that Recallthata bufferis a sel of memo4/locations providetemporary to whenthe receiving from one process ailother, for dafathat arebeingpassed calleda burst perncl. placed overthecrankcase imaginean oil funrrel this To visualize scenario,

this problem seekto examine beinglost?The next sections

system Figure10.4 Butrering

Burstsol Data 10.3.1 Handling
If both P(l) and C(t) arc constant,denoted P and C, respectively-itnd ii'r^' consumption mte C is grealer than or equal to P, then no buffer is needcd since +lie

a burst of penod f, note that the total dala Produced is Pa handle the ovedlow while the total data coosumedin that time is CZ Thus, there is ail excessol


Chap.l0 r Queuing Models



( 1 05 )

in Thrsis how muchdatamustbe stored thebuffer. Thus,lhe buffersizeis




$here C is the consumptionrate, P is the production rate, and I is the burst time I EXAMPLE 10.5 A device prcviding to a realtime is data computer DMAat9600 via bytevsecond in busts one' of
durdtron The compdLer clpableof processi.g data,t E00bytev is ihe second evcry20 seconds dne ro emprylhe bufferbeioreanother secondAssumrng thereis suliicient bu6t occurswhat Lhe l0 should ninidum buiiersizebe?Usingequation 6 yields B = (9600 E00)I = 8800bytes

Handlingdala that occur in burstswilh equatlon 106 is possible only if the buffer can be emptledbeforeanofher bulst occurs. For example, Exanple in 105, emptying bufferw l take11 seconds sufTicrent beforefhe next the time expected burst If bwstsoccurfoo ftequently, thenno stzebufferw l avail.In and thjs casethe systemis unstable, eitherupgradrng processor downthe or gradingthe production process necessary solvethe problem is to

10.3.2 Variable Buffer Size Calculation It is oftennot accuate assume production consumption to that and ratesaswell as production fimesare fixed; they wili ftequently variable. be In thrs section examine casem which prcduction we a and consumptron rates are variable Although we will pedolm the analysis for continuous variables,the results can be adaptedfor discretevanablesby replacmg summaiionfor integrahonm the formulas.In addltion, they can be generalized and cases employilgRiomann-Stieljes by to handle boththediscrerc continuous (see,for example, integration [163]) process produces we that dan at a rategivenby Suppose havea producer that another task consumes usesthe data or the functionp(t) AIso suppose produced the first task at a late deteminedby the funchon.(l). The data by are produced duringa burstpedodf = t2 -,r, wheret1 and 12represent ihe start and finish times of the burst- Then the buffer size neededat time I > 4 can be exDressed as B(7) = tp(r) - c(t)) dt


Thus, we need to know when B(O is a maximum to detemine the rcquied buffer size. Note that when p(l) and c0) are constant, then equation10.7 becomes equation 10.6(seeExercises).

S€c 10I r BasicBufferSizeCalculation

I EXAMPLE10.6 per A taskproduces al a rare(in bytes second) is d.refr,nedby thefuncrion data Ihar

wth r.oprcsenting blnt periodThe dalam c.nsutued a raskat a ratedeternined rhe the by by

The eraphs pG) and.G) de depided FigureI0 5 The quest'on is: If thebuat period for in then is knownto be 1.5seconds, is thenaessary what buffersize? ibis case canbe seen inspecling In it by

FiguE 10.5 Producered consumd distribnlion fu.ctions

t h ea r e au n d etrt l e w e s f o r 4 r ) e d . ( 4 r f i a A ' d r n m | B i c r dds inio equalion 10.?, B(16) = Ip<t) c<t)ldt ltt - tt4t)l.h + l {ffi 1 '' l\2



= 10000



28 d I00o0ll/8) lo + l0il00(2)l, '
^ l r 1 1 6

Cbap.10 r Queuin8Models

10000(5/E) r L

- l r q

10000(3/8) + l0(X,0(3.22)- 10000(5/8X2 l) 566000bytes

If the burstperiodis also variably detemined by function r.(r), then for a bursloccuringat trmelt,
tu\tt) .


lr(r\ - c(t\ldt


I EXAMPLE 10.7 In theprevjDus exmple. lhebusr sta$s a ijmederemined theGausio distribution if at by
L(t) = == e-T

tnenu(0) = 0.053991Inspecting production consDnprion tJre dd cbes againsbowsthar tte qben i = 0.053991RecatculaLion rhe butrersize now ddinum butrersib is needed of yields B(os199l) = = l0m0 Iplt) - c(t)l dl I$ - 1t4t)l dl

= loooo(3iE) I i""""'
= l00(n(3/8)t0-0029151 = l lbyles I

Determining whenth€rmaximum buffer sizeis needed easilydoneb) is graphingthe consumer and producer function cu es,andtheninspectingthemro determinewhen the differ,ancein the areasunder the cuavesis atest, Use equation10.7to determine this differenceand thus the maximumbuffer size.

The classicalqueuingprol)lem involves one or more prcdueerprocesses called seners alLdone or mort) coDsumerprocesses called calomer,r, A standard notationfor a queuingsyslem is a three-ruple. The first component descdbes rbe probability dislribution for ihe time betweenarrival of customers, second the i the probabilitydistlibution of tjme needed serviceeachcustomer, the third to and is the number of servers (see Figure 10.6). ln a real{ime system,the firsr cohponentmight be tbe arrival time probabilily distributionfor a certainintem.F rcqDest, second the would b e the time needed servicethat interruptrequestad to the third componentwoulC be "1" for a single-processing system,morc for

Theory I Cldlsrcal Queujn8


of Figure10.6 ComPonenLsa queuing

to of We Properties thismodel predict systems canuseknown multiprocessing system in for times tasks a real_time service
'10.4.1 The M/M/l Queue

available. Fufiher study of the *" *iU presenf these results without denvation can a\pects be foundinl28lorlS2l FofexamplelelNbethenumbel heorelicai '' numberof cu\tomer5 tr'" qu"ue t'ellinB p = I/F rhenlhe average oi *.tot*rs in the queue in such a system is


with variance
J -

(I p)'?

in time a customerspends the systemis The average
I /!L


l-p has pmb€bilit\ The random variable y for the dme spent In the system distribution (10.1:, s()') =
P(1 P)tP('-Pt

with ) > 0.


Models Chap 10 r Queuing

are that tr Fmally, carlbeshown[82] thattheprobability at least customen 1t queue in the is P[>ftjosysteor]=pr

(10. ) r3

In the MA4/l model, the probabilily of exceedinga certain number ol custome$ in the system decreasesgeometrically, If interrupt requests are m customers a ceflain system,then two suchrequests the systemat in considered the same time (a trme overloadedcondition) have a far greaterprobability of Thus, building systemsthat can occurrencethan thrce or more such requests, toleratea single time-overloadwill contrjbutesignificantly to systemreliabllity, conditionsis probablynot wofth lhe while worrying aboutmultrpletime-overload bother Let us now show how the MA4/1 queue can be used in real-tlme syslems,

'10.4.2 Serviceand ProductionRales
Consider an MA4/l system in which ihe customer reprcsentsan interupt the required for requestof a certain tlTe ard the se er reprcsents processing queuercpresenta model, waiters m the that req est. ln this single-processor of time-overloaded condition. Because the naiureof the arrivaland processing times, this condition could theoretically occur. Suppose,however, that you could vary either the arrival or the processingtimes. Varying the arrival time, by by which is r€presented the parameterI could tle accomplished changing hardwareor altenng the processcausingtbe irterrupt. Changingthe processng by time, represented lhe parameterp, corild be accomplished one of the by in techniques discussed Chapter9. In any case,fixing one of theqetwo paramete$,and selecting secondparameterin such a way as to reducethe probability that more thaDone intefrupt will be in the systemsimultaneously, will ensfie that time-overloadingcannot occur wilhin a specific confidenc€ inreflal.

I EXAMPLE10.8 is SuppoieI ihe meo inteluval time belweenintempt rcqDests, tued to be l0 millisecondsl-e to us find themq4 processing tme, l, necessary gueetee that the prcbability of tine-ovedoadint (nore thd one inienpt requestjn Lhesy3ten) is lets than 1',6 We cd use eqration 10.13as

= ; P r > 2 i t r s y s , e(n lr= , "


6.or= .

t ltootXto to1'


Theory 5d 104 I Cla$icalQueuing




< 0001 second

to ftat be time,i, should no hore than I millisecond Sueanle€ dne_ Thus,lhe meo gocessing I occurwith 99%coifidenceove.loading cannot



we Suppose fix l. {he mean seflice line, to be 5 mrlliteconds,md seekto find the avenge aEivar lhat the !rcbability ofiime ovedoadinsh les thd l% We can use tine, i, necesary to gua.anree equation10.13 ds follows



j il> ro
1 =+->0.050second A Hence, the averageinlelarival time beNeen two inrenll reqDestsshould be at least 50 I ro only a l% risk of lime'overlodding milliseconds gueantee I g

10.4.3 MoreBufterCalculalions
A secondmodel using ihe l\4A/Vl queueportraysthe "customers"as data being to lime is lhe time needed pick up thedataby placed a buffer The "service" in is task.Hereour k[owledgeof MA4/1 queues usedto calculate someconsumer 10.9,and the to average buffersize needed hold the datausingequa'tion the (its age)usingequation 1011 in average time a datumsPends the system
1 I EXAMPLE 0.10 a, and h datawith ,ntermival tihes given by the eJgonflriat dist ibution rk A prccessprodnces 5'.To calculale$e avease dislribution5d by,apr@e$ at a dle Srvenby theexponentidl consumed 109: lse rdmberof dal! 'ren! In $e butrer, equdnon - =P N 4 = /- = 5 4 l p l 4 / 5


he rly'


The aveEge"age" of I dala item co be calcul.led with equation10111

rltL \15 7=-=-=lsecond l-p 1 415

A prcbability distributionfor the randomvariabledeterminhgtb€ ate of tu datumcan be found by qsinge4ualion10.12.

Models Cbtp l0 I Queuing

Response-Time irEDPvrrev " - Modelinq 10.4.4

lhe _o an inkrrupt requeslin _average response dme for a prccesshandling MA/V! nodel Tte '""" .,,re.l if an proc<:ssr!q'r' - in time dblenceof other compenng rure the average '" "pent In thrscaseute equal'on, ll-^-. - ,,-., i\ assumed 'ime\ (the respon:e

:;1#;' il:;:JT:tJ":H"ililH"Ifxr*,n.t*l#::l
i;:l'r'L# o,;iJ;;i
10.1'! I EXAMPLE


I1 ro be en i' \eenIrcm equatonl0 I = 15 tnlttite"onos




Tlil:'tr"il:il t':t"3kffi .".*L*"i:oili'*''il*i",";-H;lf
glves s(i\ = - eI


Notethattheresponsetimewillbedeleteriouslyaffectediftheinterruptmle greaterihan ihe meanservlceIarc'


;" --;;.;be

;il*.X ;.'l'# $"X*.i.':iT :,*ti'::*ilfi Tff:l',' ,ilJf.':::t:i:'r*t*liig*,,**'H:." be ror i:':.T:ff '#Js can rrxedmodering
f,::il:"H1ii'1l"T;#,lt*1ll$ffi:'"" queues

or:*::;""f"f"'Tf:ti"J;l-1: in used a.vanetv


TffI il.'Ii:'Jf"L"":1.0:IL,:.:i'liT:H:ii'H.'ff l',*"i:il*l'"*ffi :r*I"l'.y,fJ: iffi ..".;,'ff :$iff;l '".,.'i+:i* Til:'t$ ^trT:.T 3:Tl::T"*', d; :i:r:'-:::":::.':*1'3"T;1'" F*1ii;.*tt*:T?liTi*'* ' :l'ffi1'il"1'1T"ff# il'ff :ffi'Tl;;ffi+:'i'::: i'#,H::ff $:i:I"15"$f

or t'"',"otstime-overroads i"illllii,i"Jii"*i.iJ"'i-

Sec.10.6r Edang\ Fomula

10.5 LITTLE'S LAW An imponant resultin queuing theory,litfu'r 1dlr,hassomeapplication real_ in timesystem perfomance prediction. Lirtle s la\ twhichappearid 196l) slares in thal the avetage number customers a queuing of in system, is equalto the N,_ avemge arrivalmte of the customers tha!system, timesthe avetage to r"u, time sPent thatsystem, in 1av ( 10.14)
If ft serversare present,$en



wherer",, is the average arival ratefor customers serer i and l,.rv is lhe to av average servicetime for serverL Viewingeach process a seflerandinterrDpt as arrivals cusfomers, as Little-s law canbe usedas a roughestimate CpU utilization sporadic, for in periodic, or mixed interrupt systems. For example, system knownto havepeiodic interup$ occufiing lu, a is at 20 and 100 millisecondsalld a spomdic interrupt that is known to occur on avemge every I second. The average processing time for theseinterruptsis 3, E, 25,and30 milliseconds. Thenby Litde'slaw theavemge number customers of in rne queue ls N," = (1/10)3 (1/20)E (1/100)25 (1/1000)30 0.98 + + = + This resultis thesame \re obtained usingequation in Chapter one by 9.7 9 of the!ext.Remembet although is anestimate that lhis ofaverage CpU urilizadon, fanstent overloads might still be present, we will see in the followinc as secuon.


assume that the avemgeservice(process)rime is p and the average arival time (mterruptmte) is I, then the fraction of time that all serversare busy (a rifteoverloaded condition)is given by

(.\lp\-/nt >rd'Q/t')rlkl
This resultdates backto 1917!



Chap. r Queuing 10

ApplyingErlang's Formula theprevious to givesm = 4, )r = example F = 1 65 : (380^6 14 /4 l + (380/16.5) (390/16.5)2t2(380/16.5)38! (380/l6.r1t4l + + + theaverage timeloading figureof987, andwhatwe learned from

= 0.81

This means there is a potenhal for time-ovedoading 83.4% of the time. Based analysis (707, or less timeloading is needed to guaGntee no overloacls ir pefect world), this seems reasonable.

l. In Exanple l0 5 whar would b€ the requiredburer size lor a Crventine / if rhe were at 2400 baud,2 seconds long, md occuEedevery 5 seconds? generates 2, A prodDcer data at 1 byre pe. ?00 naoseconds in bu6ls of 64 ,ilobE consumerce Md the data in 32 bit words bDr only at a Ere of one *ord dw nicros€conds Calculate minimumiizebutre..equired avoidspillovea tbe to thereis enoughtime betw@r burststo empty the buffer 3. Show that q,hentbe producersd consumer larks haveconstdl rates,thenequarjo! becomes equation 6 10 4, A prcduer prcce\ is l$oqn ro be rble'o proces daracr a are $d i< per dishbuL€dwrth average senice tine of 3 millisecodds dalum wllat is the allowable average dle if theprobability data ofcollisionis (o be0 l%? A$ume H datadive at iniedals Lhatde erponentially dsrributed 5. Discu$ losible inle.pretations equarion of 10.10 N ls the eipecled if nunberof i.ems in somebutrn