4&5-2 TopicsMarkov Chains M/M/1 Queue Poisson Arrivals See Time Averages M/M/* Queues Introduction to Sojourn Times... 4&5-3 The M/M/1 QueueArrival process: Poisson with rate λ Service t
Trang 1TCOM 501:
Networking Theory & Fundamentals
Lectures 4 & 5 February 5 and 12, 2003 Prof Yannis A Korilis
Trang 24&5-2 Topics
Markov Chains M/M/1 Queue Poisson Arrivals See Time Averages M/M/* Queues
Introduction to Sojourn Times
Trang 34&5-3 The M/M/1 Queue
Arrival process: Poisson with rate λ Service times: iid, exponential with parameter µ Service times and interarrival times: independent Single server
Infinite waiting room
N(t): Number of customers in system at time t (state)
Trang 44&5-4 Exponential Random Variables
Trang 54&5-5 M/M/1 Queue: Markov Chain Formulation
Jumps of {N(t): t ≥ 0} triggered by arrivals and departures
{N(t): t ≥ 0} can jump only between neighboring states
Assume process at time t is in state i: N(t) = i ≥ 1
X i: time until the next arrival – exponential with parameter λ
Y i: time until the next departure – exponential with parameter µ
T i =min{X i ,Y i }: time process spends at state i
T i : exponential with parameter νi= λ+µ
P i,i+1 =P{X i < Y i}= λ/(λ+µ), P i,i-1 =P{Y i < X i}= µ/(λ+µ)
P01=1, and T0 is exponential with parameter λ
{N(t): t ≥ 0} is a continuous-time Markov chain with
, 0 , 1
0, | | 1
i i i i i
i i i i i ij
Trang 64&5-6 M/M/1 Queue: Stationary Distribution
λ
µ
λ µ
Trang 74&5-7 The M/M/1 Queue
Average number of customers in system
Little’s Theorem: average time in system
Average waiting time and number of customers in the queue – excluding service
µ
λλ
λµ
W N
T
Trang 84&5-8 The M/M/1 Queue
0 2 4 6 8 10
ρ
ρ=λ/µ: utilization factor
Long term proportion of
time that server is busy
M/G/1 queue
Stability condition: ρ<1
Arrival rate should be less
than the service rate
Trang 94&5-9 M/M/1 Queue: Discrete-Time Approach
Focus on times 0, δ, 2δ,… (δ arbitrarily small)
Study discrete time process N k = N(δk)
Show that transition probabilities are
Discrete time Markov chain, omitting o(δ)
1 ( ), 1
( ), 0 ( ), 0 ( ), | | 1
ii
i i
i i ij
λδ λδ
Trang 104&5-10 M/M/1 Queue: Discrete-Time Approach
λδ µδ
λδ λδ
Discrete-time birth-death process → DBE:
Taking the limit δ→0:
Trang 114&5-11 Transition Probabilities?
A k : number of customers that arrive in I k =(kδ, (k+1)δ]
D k : number of customers that depart in I k =(kδ, (k+1)δ]
Transition probabilities P ij depend on conditional probabilities:
Calculate Q(a,d | n) using arrival and departure statistics Use Taylor expansion e -λδ=1-λδ+o(δ), e-µδ=1-µδ+o(δ), to express as
a function of δ
Poisson arrivals: P{A k ≥ 2}=o(δ)
Probability there are more than 1 arrivals in I k is o(δ)
Show: probability of more than one event (arrival or departure)
in I k is o(δ)
☺ See details in textbook
Trang 124&5-12 Example: Slowing Down
Trang 134&5-13 Example: Statistical MUX-ing vs TDM
m identical Poisson streams with rate λ/m; link with capacity 1;
packet lengths iid, exponential with mean 1/µ
Alternative: split the link to m channels with capacity 1/m each,
and dedicate one channel to each traffic stream
Delay in each “queue” becomes m times higher
Statistical multiplexing vs TDM or FDMWhen is TDM or FDM preferred over statistical multiplexing?
Trang 144&5-14 “PASTA” Theorem
Markov chain: “stationary” or “in steady-state:”
Process started at the stationary distribution, or
Process runs for an infinite time t→∞
Probability that at any time t, process is in state i is
equal to the stationary probability
Question: For an M/M/1 queue: given t is an arrival
time, what is the probability that N(t)=i?
Answer: Poisson Arrivals See Time Averages!
( )lim { ( ) } lim i
Trang 154&5-15 PASTA Theorem
Steady-state probabilities:
Steady-state probabilities upon arrival:
Lack of Anticipation Assumption (LAA): Future inter-arrival times and service times of previously arrived customers are independentTheorem: In a queueing system satisfying LAA:
1.If the arrival process is Poisson:
2.Poisson is the only process with this property (necessary and sufficient condition)
Trang 164&5-16 PASTA Theorem
Doesn’t PASTA apply for all arrival processes?
Deterministic arrivals every 10 secDeterministic service times 9 sec
Upon arrival: system is always empty a1=0
Average time with one customer in system: p1=0.9
“Customer” averages need not be time averagesRandomization does not help, unless Poisson!
1
Trang 174&5-17 PASTA Theorem: Proof
Define A(t,t+δ), the event that an arrival occurs in [t, t+ δ)Given that a customer arrives at t, probability of finding the system in state n:
A(t,t+δ) is independent of the state before time t, N(t-)
N(t - ) determined by arrival times <t, and corresponding service times A(t,t+δ) independent of arrivals <t [Poisson]
A(t,t+δ) independent of service times of customers arrived <t [LAA]
δ δ
Trang 184&5-18 PASTA Theorem: Intuitive Proof
ta and tr: randomly selected arrival and observation times, respectively
The arrival processes prior to ta and tr respectively are
The probability distributions of the time to the first arrival before ta
and tr are both exponentially distributed with parameter λ Extending this to the 2nd, 3rd, etc arrivals before ta and tr
establishes the result
State of the system at a given time t depends only on the arrivals (and associated service times) before t
Since the arrival processes before arrival times and random times are identical, so is the state of the system they see
Trang 194&5-19 Arrivals that Do not See Time-Averages
Example 1: Non-Poisson arrivals
IID inter-arrival times, uniformly distributed between in 2 and 4 secService times deterministic 1 sec
Upon arrival: system is always empty
λ=1/3, T=1 → N=T/λ=1/3 → p1=1/3
Example 2: LAA violated
Poisson arrivals
Service time of customer i: S i= αTi+1, α < 1
Upon arrival: system is always empty
Average time the system has 1 customer: p1= α
Trang 204&5-20 Distribution after Departure
Steady-state probabilities after departure:
Under very general assumptions:
N(t) changes in unit increments
limits a n and exist d n
a n = d n , n=0,1,…
In steady-state, system appears stochastically identical to an arriving and departing customer
Poisson arrivals + LAA: an arriving and a departing customer see
a system that is stochastically to the one seen by an observer looking at an arbitrary time
Trang 214&5-21 M/M/* Queues
Poisson arrival process
Interarrival times: iid, exponential
Service times: iid, exponential Service times and interarrival times: independent
N(t): Number of customers in system at time t (state)
{N(t): t ≥ 0} can be modeled as a continuous-time
Markov chain Transition rates depend on the characteristics of the system
PASTA Theorem always holds
Trang 224&5-22 M/M/1/K Queue
M/M/1 with finite waiting room
At most K customers in the system Customer that upon arrival finds K customers in system is dropped
1
n n
K
p
ρ ρ
1
K K
Trang 234&5-23 M/M/1/K Queue (proof)
ρ ρ
Trang 244&5-24 Truncating a Markov Chain
{X(t): t ≥ 0} continuous-time Markov chain with stationary distribution {p i : i=0,1,…}
S a subset of {0,1,…}: set of states; Observe process only in S
Eliminate all states not in S
Set
{Y(t): t ≥ 0}: resulting truncated process; If irreducible:
Continuous-time Markov chain Stationary distribution
Under certain conditions – need to verify depending on the system
if
0 if
j i
j i S
p
j S p
Trang 254&5-25 Truncating a Markov Chain (cont.)
Possible sufficient condition
Verify that distribution of truncated process
1. Satisfies the GBE
2. Satisfies the probability conservation law:
Another – even better – sufficient condition: DBE!
Trang 264&5-26 M/M/1 Queue with State-Dependent Rates
Trang 27Arriving customer finds n customers in system
n < c: it is routed to any idle server
n ≥ c: it joins the waiting queue – all servers are busy
Birth-death process with state-dependent death rates
[Time spent at state n before jumping to n -1 is the minimum of
, 1 ,
n
µµ
Trang 294&5-29 M/M/c Queue
Probability of queueing – arriving customer finds all servers busy
Erlang-C Formula: used in telephony and circuit-switching
Call requests arrive with rate λ; holding time of a call exponential with mean 1/µ
c available circuits on a transmission line
A call that finds all c circuits busy, continuously attempts to find a
free circuit – “remains in queue”
M/M/c/c Queue: c-server loss system
A call that finds all c circuits busy is blocked
Erlang-B Formula: popular in telephony
Trang 304&5-30 M/M/c Queue
Expected number of customers waiting in queue – not in service
Average waiting time (in queue)
Average time in system (queued + serviced)
Expected number of customers in system
2
( ) ( ) ( ) ( )
! ! (1 ) (1 )
Trang 314&5-31 M/M/ ∞ Queue: Infinite-Server System
Trang 324&5-32 M/M/c/c Queue: c-Server Loss System
c servers, no waiting room
An arriving customer that finds all servers busy is blockedStationary distribution:
Probability of blocking (using PASTA):
Erlang-B Formula: used in telephony and circuit-switching
Results hold for an M/G/c/c queue
Trang 334&5-33 M/M/ ∞ and M/M/c/c Queues (proof)
Trang 344&5-34 Sum of IID Exponential RV’s
X1, X2,…, X n: iid, exponential with parameter λ
The probability density function of T is:
[Gamma distribution with parameters (n, λ)]
If X i is the time between arrivals i -1 and i of a certain type of events, then T is the time until the nth event occurs
For arbitrarily small δ:
Cummulative distribution function:
Trang 354&5-35 Sum of IID Exponential RV’s
Example 1: Poisson arrivals with rate λ
τ1: time until arrival of 1st customer
τi : ith interarrival time
τ1, τ2,…, τn: iid exponential with parameter λ
t n= τ1+ τ2+…,+τn : arrival time of customer n
t n follows Gamma with parameters (n, λ)
For arbitrarily small δ:
Trang 364&5-36 Sojourn Times in a M/M/1 Queue
Proof:
1. Direct calculation of probability distribution function
2. Moment generating functions
3. Intuitive: Exercise 3.11(b)
Trang 374&5-37 M/M/1 Queue: Sojourn Times (proof)
Proof 1: Let ti be the arrival time of customer i, and Ni = N (t¡i ), the number of customers in the system right before the ith arrival.
Trang 384&5-38 M/M/1 Queue: Sojourn Times (proof)
Proof 1: Note that:
² Time customer i stays in the system is greater than t, given that it ¯nds k customers in the system, i® the number of departures in interval (ti; ti + t) are less than k + 1 The server
is always busy during that interval, thus times between departures are iid, exponential with parameter ¹ Then:
Trang 394&5-39 M/M/1 Queue: Sojourn Times (proof)
Proof 2:
² N i : number of customers in system upon arrival of customer i
² T i(k): sojourn time of customer i when it ¯nds k customers in system
Ti(k) = S i + S i ¡1 + : : : + S i ¡k+1 + R i ¡k
S j is service time of customer j, and R i ¡k the residual service time
of the customer in service.
² S i ; : : : ; S i ¡k+1 : iid, exponential with parameter ¹
² R i ¡k : exponential with parameter ¹, independent of S i ; : : : ; S i ¡k+1
² T i(k) is the sum of k iid exponential RV's
² T i = T(Ni )
i is the sum of a random number of iid exponential RV's
² Use moment generating functions
Trang 404&5-40 M/M/1 Queue: Sojourn Times (proof)
Trang 414&5-41 Moment Generating Function
1 De¯nition: for any t 2 IR:
n
dt n M X (0) = E[Xn]
4 Moment Generating Functions and Independence:
X; Y : independent ) M X +Y (t) = M X (t)M Y (t) The opposite is nottrue.