Title: Stochastic Process and Queuing systems incomplete
1Stochastic Process and Queuing systems(incomplete
)
- Summarized by
- Neetesh Purohit
- Lecturer, IIIT,
- Allahabad, UP, India
- http//profile.iiita.ac.in/np/
- 0532 2922236 (O), 0532 2922347 (R)
2Source
- Probability and statistics with reliability,
Queuing and Computer Science Applications, IInd
Edition, authored by K. S. Trivedi, John Wiley. - Communication Systems, IV Edition, A. B.
Carlson and others, McGraw Hills. - Notes of Prof. Anirban Mahanti, available at
- http//pages.cpsc.ucalgary.ca/mahanti/teaching/F0
5/CPSC531/
3Stochastic Process X(s,t)
- It represents a family of random variables
- Involves states, s
- (associated type of random variable )
- as well as time, t
- (either sampling is done at discrete instant of
time or continuously the system is being
monitored). - Four possible types
- DSDT, DSCT, CSDT, CSCT
4Basic Queuing Model
Service discipline
Arrival process
Queue
Servers
Customer population
5- Define stochastic processes W, X, Y, Z over the
queuing system such that - W is DSDT
- X is DSCT
- Y is CSDT
- Z is CSCT
- Write down and show your notebook.
6- W number of jobs in the system at the time of
departure of the kth customer. - X(t) number of jobs in the system at time t.
- Y time that the kth customer has to wait in the
system before receiving service. - Z(t) cumulative service requirement of all jobs
in the system at time t.
7Other types of stochastic processes
- Strictly stationary
- Widesense stationary
- Ergodic, etc
- Markov Process
- Birth-Death Process
- Poisson Process, etc
8Markov Process
- If future state probabilities independent of the
past states and depends only on the present, then
process called Markov. - Markov property makes analysis easier, since past
history need not be remembered. - Markov Chain Discrete-state Markov process
9Markov Chains
- Interested in Markov chains with stationary state
transition probabilities. I.e.,
10Birth-Death Process
- Birth-Death process A Markov chain that only
allows transitions to neighboring states - Represent states by integers. A process in state
n can transition to state n-1 or n1 - E.g., of jobs in queue in a single server
system can be represented by birth-death process - Birth gt arrival of a job gt 1 state transition
- Death gt departure gt -1 state transition
- Batched arrivals cannot be modeled!
11- Using stochastic flow balance, the steady state
probability of being in state n can be computed.
12Relationships between Processes
13Important parameters of a queuing system model
Service discipline
Arrival process
Queue
Servers
Customer population
14Population size
- Potential customers who can enter the queue
- Real systems have finite population
- However, if population is large, assume infinite
for ease of analysis.
15Arrival process
- Customers arrive at t1,t2,,tj
- Interarrival time ?j tj-tj-1
- Assume interarrival times ?j are IID (independent
and identically distributed) random variables - E.g., Poisson process, Erlang, hyperexponential,
general.
16Service time distribution
- Assume IID random variables
- E.g., exponential, Erlang, hyperexponential, and
general
17Service disciplines
- FIFO (or FCFS) most common
- Random
- Round Robin
- Priority disciplines
18- Number of servers
- One/many (identical) servers
- System capacity
- Waiting space number in service
- Infinite assume if cap. large
19The Kendal Notation
- A/S/m/B/K/SD
- A is interarrival time distribution
- S is service time distribution
- m is number of servers
- B is number of buffers (system capacity)
- K is population size
- SD is service discipline
20Some common abbreviations
- M (Markov) denotes exponential (and thus
memoryless distr.) - D (Deterministic) values are constant
- Ek (Erlang) Erlang distribution with k phases
- G (General) denotes distribution not specified
results are valid for all distributions - Bulk arrivals denoted using superscripts. E.g.
Mx
21Examples
- M/M/3/20/1500/FCFS is a single queue system with
- Interarrivals are exponentially distributed
- Service times exponentially distributed
- Three servers
- System capacity 20 queue size is 20 3 17
- Population size is 1500
- Service discipline is FCFS
- M/M/3 Typically, assume infinite system
capacity, infinite population, and FIFO service.
In such cases, last three parameters dropped.
22Random Variables for Queues
r
All variable except ? and ? are random
- nq of jobs waiting in queue
- ns of jobs recv. service
- n of jobs in system
- n nq ns is the queue length
- r response time
- Waiting for service plus time receiving service
- w waiting time
- Start of service minus arrival time
- ? interarrival time
- ? mean arrival rate 1/E?
- May depend upon of jobs in system
- s service time per job
- ? mean service rate per server 1/Es total
service rate m?
23Rules for All Queues
- Stability Condition
- For stability, mean arrival rate should be less
than mean service rate - ? lt m?
- Does not apply to finite population systems and
finite capacity systems - Queues for finite population systems cannot grow
indefinitely - By definition, queues for finite buffer systems
cannot grow indefinitely.
24- Number in System versus Number in Queue
- Number of jobs in system equals those waiting and
servicing - n nq ns
- En EnqEns
- That is, mean number of jobs in system equals
mean number in queue plus mean number being
serviced - If service rate of servers independent of number
of jobs in the queue, then - Varn VarnqVarns
- Cov(nq,ns) 0
25- Number versus Time
- If jobs not lost due to buffer becoming full, the
mean jobs is related to response time as - mean of jobs in system arrival rate x mean
resp. time - mean of jobs in queue arrival rate x mean
waiting time - The above are obtained by applying Littles Law
- Littles law can be applied for finite buffer
systems by considering the effective arrival rate
26- Time in System versus Time in Queue
- Time spent by a job in system is sum of waiting
time and service time. That is, r w s - Mean response time equals sum of the mean waiting
time and the mean service time. Er Ew
Es - If service rate independent of of jobs in queue
- Cov(w,s) 0
- Varr Varw Vars
27Analysis of existing systems
28Operational Laws
- Operational gt directly measured
- Operational assumptions (e.g. number of arrivals
number of completions) verifiable by
measurements - Operational quantities can be directly measured
during a finite observation period
29Notation
-
- T observation period
- A number of arrivals
- ? arrival rate A/T
- C number of completions
- X throughput C/T
- B busy time
- U utilization B/T
-
30Notation
-
- S mean service timeB/C
- R mean time in system (residence time)
- Z think time of a terminal user
- D service demand
- V number of visits
- N mean number in system
31Utilization Law
- Utilization is the fraction of time a system is
busy. - U is always between 0 and 1.
Utilization of a system (or resource) is equal to
the throughput times the average service time
32Utilization Law Example 1
- A disk is serving 50 requests/sec each request
requires 0.005 seconds of service. - 1) What is the Utilization?
- U 50x0.005 .25 (25)
-
- 2) Maximum possible service rate?
- U 1 (0.005)X
- X 200 requests/sec
33Utilization Law Example 2
- A router forwards 100 packets/second onto a link.
The transmission time (i.e., time to put packets
onto the link), on average, is 1 ms. What is the
link utilization? - Link throughput X 100 packets/sec
- Service time S 0.001 sec
- U XS 0.1 (10)
- Link capacity?
34Littles Law
- Assume Job Flow Balance
- - Number of arrivals equal number of
completions - New jobs not generated in the system
- Jobs not lost (forever) in the system
- If jobs lost in the system (e.g., due to finite
capacity), law applies with adjusted arrival rate
35- Mean in system arrival rate x mean response
time - N ? R X
- Average number in system equals product of the
throughput of the system and the average
residence time of a customer.
36Littles Law Example 1
- During a busy hour, approximately 20 clients
arrive at a barbershop. Each client, on average,
spends 15 minutes in the shop. How many clients
are simultaneously present in the shop? - From Littles law N ? R
- 20 customers/hour x (15/60)
- 5 customers
37Littles Law Example 2
- Littles law can be applied to any subsystem
- A disk is serving 50 requests/sec each request
requires 5 ms of service average time to satisfy
a request is 20 ms - Consider subsystem 1 X 50, S 0.005 U .25.
In this case, N U and S R. Why? - Consider subsystem 2 X 50, R 0.02 N XR
- N 1 (queued at server) Avg. waiting for
service ?
38Response Time Law
- N avg. of terminals
- Z avg. think time
- R avg. sys. Resp. time
- Using Littles law on the system (see the fig. in
the bottom RHS) -
- N X(RZ)
- R (N/X) - Z
RZ
A Model of a Time Sharing System
39- Littles law applicable at both Box 1 and Box 2
- Littles law on Box 2
- NS XR
- Littles law on Box 1
- NT XZ
- Note that
- N NT NS
A Model of a Time Sharing System
40Response Time Law Example 1
- 64 interactive users avg. think time of 15 s
system throughput is 4 interactions/sec. What is
R? - R (N/X) Z 1 Sec
41Response Time Law Example 2
- A Web server was measured for a one hour period.
During this period, 50 clients were observed. The
average CPU time demand per request was measured
to be 5ms, with CPU utilization being 0.25. The
average response time for requests was 0.25 sec.
What was the average client think time (in
seconds)?
42- N 50 Scpu 0.005s Ucpu 0.25 R 0.25s
- Using utilization law
- X Ucpu/Scpu 50 req./s
- Using the response time law
- Z (N/X) R 0.75s
- At any given time, how many clients are
thinking?
43Forced Flow Law
- Each system-level request may require multiple
visits to a system resource. - E.g., A database transaction may require several
disk accesses - Visit ratio (Visit count) ratio of number of
subsystem completions to the number of system
completions Vk Ck/C
44- If Vk visits are made to resource K in time T and
a total of X system-level completions are
observed in time T, then - Xk VkX
- Uk XkSk
- X VkSk
- XDk
- Sk mean service time per visit to res. K
- Dk total service demand at resource K
45Forced Flow Law Example 1
- A database server is monitored for 15 minutes.
During this time, the servers CPU was busy for
12 minutes. It was observed that each transaction
required on average 2 visits to the CPU, and the
service requirement per visit was 1 ms. What is
the system throughput (in transaction per
second)? -
46- T 15 min
- BC 12 min
- VC 2 SC 1 ms
-
- UC B/T 0.8
- UC X VCSC gt
- X 0.8/(2x0.001) 400 transactions/sec
47Forced Flow Law Example 2
- Consider an interactive system with the following
characteristics - no. of terminals 18
- avg. think time 10s
- visits to a specific disk per interaction 20
- utilization of this disk 0.3
- avg. service req. per visit to disk 20 ms
- Determine 1) disk throughput ? 2) system
throughput ? 3) response time ? -
48Analytical analysis
49M/M/1 Queue
- One server, one queue, FIFO service
- exponentially distributed interarrival and
service times - infinite population, infinite capacity
- Can model as a birth-death process
Notation pn steady-state probability of being
in state n
50- Using stochastic flow balance equations
- pn (?/?)n p0 ?np0, n0,1,,?
- ? is traffic intensity (lt1 for stability)
- Probabilities sum to one. Therefore,
- ? pn 1, n 0, 1, , ?
- p0(?0 ?1 ?2 ) 1
- p0 (1-?)
- pn ?n(1-?)
- Important performance measures follow
51- Utilization prob. of one or more jobs in system
- U 1- p0 ?
- Mean jobs in System
- En ?npn , n 0, 1, , ?
- En ?/(1-?)
- Mean response time (Littles law)
- number in system arrival rate x response time
- En ?Er
- Er (1/?)(?/(1-?)) (1/?)(1/(1-?))
52- Mean of jobs in queue
- Enq ?(n-1)pn , n 1, , ?
- Enq (?2)/(1-?)
- Can also be obtained using En Enq Ens
- Mean waiting time in queue (Littles Law)
- Number in queue arrival rate x mean waiting
time - Enq ?Ew
- Ew (1/?)((?2)/(1-?)) ?((1/µ)/(1-?))
53- Prob. of finding n or more jobs in system
- P( in system n) ?pj , j n,n1, , ?
- ?(1-?)?j ?n
- Waiting time and response time distributions
- Waiting times in queue exponentially distributed
- P0 lt w t 1 - ?e-?t(1-?)
- Response times exponentially distributed
- P0 lt r t 1 - e-?t(1-?)
54M/M/1 Queue Example
- Packets arrive at 100 packets/second at a router.
The router takes 1 ms to transmit the incoming
packets to an outgoing link. Using an M/M/1
model, answer the following - What is utilization?
- Probability of n packets in router?
- Mean time spent in the router?
- Probability of buffer overflow if router could
buffer only 5 packets? - Buffer requirement to limit packet loss to 10-6?
55- Arrival rate
- ? 100 pps
- Service rate
- ? 1/.001 1000pps
- Traffic intensity
- ? 0.1
- Mean packet residence time at router
- r (1/?)(1/(1-?))
- 1.01 ms
- Prob. of buffer overflow
- P( 6) ?6 10-12
-
- To limit loss to less than 10-6
- ?n 10-6
- n gt log(10-6)/log(0.1) gt 3
56M/M/c Queue
- c servers, one queue, FIFO service, exponentially
distributed interarrival and service times - infinite population, infinite capacity
- Model as a birth-death process with K states
State transition diagram for M/M/C Queue with C3
57- Mean arrival rate ?
- Mean service rate c?
- Traffic Intensity (avg. utilization) ? ?/(c?)
- ? lt 1 for stability
- Flow balance equations yield
- pn ((c?)n/n!)p0 n 1,,c-1
- pn ((c?)n/(c!cn-c))p0 n c
- Using law of total probability
58- Newly arrivals wait if all servers are busy,
i.e., c or more jobs are in the system - P( c jobs) pc pc1 pc2
- ? (c?)c/c!(1-?) p0
- ? Known as Erlangs C formula
- Mean of jobs in system
- En ?npn n 0, 1, , ?
- p0(c?)c/c!(1-?)2 c?
- c? ??/(1-?)
59- Mean of jobs in queue
- Enq ?(n-c)pn n c, , ?
- p0?(c?)c/c!(1-?)2
- ??/(1-?)
- Mean response time (Littles law)
- En ?Er
- Er 1/? ?/c?(1-?)
- Mean waiting time
- Ew Enq/ ? ??/(1-?)/? ?/c?(1-?)