Elementary Stochastic Analysis

38
Chapter 5 Elementary Stochastic Analysis Prof. Ali Movaghar

Transcript of Elementary Stochastic Analysis

Chapter 5

Elementary Stochastic Analysis

Prof. Ali Movaghar

2

Birth and Death Processes

qk,k+1 = λ(k) : Arrival (birth) rate in state k

qk,k-1= μ(k) : Departure (death) rate in state k

qi,j = 0 : for |i-j|>1

-qkk= [λ(k) + μ(k)]

1

λ(0)

0

μ(1)

n

λ(n-1)

n-1

μ(n)

n+1

λ(n)

μ(n+1)

λ(1)

μ(2)

3

Birth and Death Processes (Con.)

The rate arrival depends on the current

system rate

Therefore interarrival times must be exponentially

distributed.

Similarly, service-time distribution must also be

exponential.

The probability of more than one arrival or service

completion in Δt is negligiable.

4

Birth and Death Processes (Con.)

The system is classical M/M :

Prob(one arrival in Δt | system is in state k )=λ(k)Δt

Prob(one service in Δt | system is in state k)=μ(k)Δt

Prob(no arrival/services in Δt| system is in state

k)= 1- λ(k)Δt - μ(k)Δt

5

Birth and Death Processes (Con.)

P(n,t) : Probability of finding n customers in the system at time t.

There are three ways for the system to be in state n at time t :

System is in state n-1 at time t and one arrival occurs at Δt

system is in state n+1 at time t and a service completion occurs during Δt

System is in state n at time t and no arrival/service completion occurs during Δt

6

Birth and Death Processes (Con.)

P(n, t+Δt) = P(n-1,t)λ(n-1)Δt+

P(n+1,t)μ(n+1)Δt+

P(n,t)[1-λ(n)Δt - μ(n)Δt ]

Taking limit Δt0, we get

The above differential difference equations describe the transient behavior of M/M system

dP(n, t)(n 1)P(n 1, t) (n 1)P(n 1, t) [ (n) (n)]P(n, t)

dt

dP(0, t)(1)P(1, t) (0)P(0, t)

dt

7

Birth and Death Processes (Con.)

To examine the steady-state solution, the

system should be ergodic :

The work should be handled faster than it arrives

k n k[ (n) / (n 1) 1]

8

Birth and Death Processes (Con.)

For steady state, we and P(n,t) is

shown by P(n)

P(n-1)λ(n-1)+ P(n+1)μ(n+1)=P(n) [λ(n)+ μ(n)]

Under steady state, the effective rate with which

the system enters state n should be equal to the

effective rate with which it exits state n

dP(n, t)0

dt

9

Birth and Death Processes (Con.)

We can derive equation in a more genera

form:

For any closed boundary, the effective flow inward

must equal the effective flow outward. (Global

balance equation)

If the boundary contains states 0 through n-1, we

get :

P(n-1)λ(n-1)= P(n)μ(n)

so

(0) (1)... (n 1)

P(n) P(0)(1) (2)... (n)

10

Steady-State Analysis of M/M Systems

We will derive detailed results for several

important M/M systems

Knedall‟s notation : M/G/c/FCFS/K/N

M : Poisson arrival

G : general service-time distribution

c : identical servers

FCFS : scheduling discipline

Storage capacity : K

N : population

11

Simple M/M/1/SI// Queue

Here both λ(n) and μ(n) are independent of

state n

Let =λ/μ, for ergodicity <1

P(n)= n P(0) ,

results P(0)=(1-)

From two above : P(n)= (1-) n

In a simple M/M/1 system, the queue length distribution is

geometric with parameter .

n

n 0

P(0) 1

12

Simple M/M/1/SI// Queue (Con.)

Various performance parameters can now be

obtained :

Utilization (U) = 1- P(0) =

Avg. queue length (Q) = E(X) = nP(n) = /(-1)

Avg. response time (R)=little low E(X)/λ=1/μ(1-)

Avg. number waiting (L) = (n-1) P(n)= 2/(1-)

Avg. waiting time (W) =little low L/λ = 2/λ(1-)

13

M/M/c/SI// Queue

This is the multiple-server extension of M/M/1

system.

λ(n) = λ

μ(n) = where μ0 is the basic service rate

=λ/cμ0 so we get

0

0

n for n c

c for n c

n n

n

0

n n

n n c n c

0

P(0) (c )P(0) for n c

n! n!P(n)

P(0) (c )P(0) for n c

c!c c!c

14

Using , we can compute P(0)

M/M/c/SI// Queue (Con.)

n 0

P(n) 1

n cc 1

1

n 0

(c ) (c )P(0)

n! c!(1 )

15

Simple M/G//SI// Queue

The arrival rate is state independent

λ(n) = λ

μ(n)=n μ0

=λ/μ0. P(0) can be computed by the requirement that

all probabilities sum to 1.

n n

n

0

P(0)P(n) P(0)

n! n!

nn

n 0

P(n) e sin ce / n! en!

16

Simple M/G//SI// Queue (Con.)

Thus the distribution is Poisson with mean .

The Avg. queue length Q=

Utilization U=

By little „s law Avg. Response time R=1/μ0

17

Simple M/M/c/SI/K/ Queue

This is the finite storage case where system

hold at most K customers:

μ(n)=min(n,c,K)μ0

P(n) can be easily abstained as before.

Note that this system has only min(c,K)+1 states.

0 for n K(n)

0 for n K

18

Finite Population Systems

Let N denote the total number of customers

in the “universe”.

the arrival rate λ depends on n and the

underlying physical situation.

a) Each customer has its own independent arrival

rate λ0.

Thus the overall arrival is proportional to the number of

customers left in universe: λ(n)=N-n) λ0

b) The customers are released sequentially. Thus

arrival rate is constant

19

Finite Population Systems (Con.)

As an example, consider M/M/1/SI/K/N

station with arrival model (a).

μ(n)=μ0

The state probabilities and performance

parameters could be obtained as before.

Note that system suffers from blocking if K<N

0(N n) for n min(N,K)(n)

0 for n min(N,K)

20

Finite Population Systems (Con.)

An isolated station with finite population can

be view as a closed network of two stations :

1

2

μ1(n)

μ2(n)

1

μ1(n)

λ1(n)= μ2(N-n)

21

Example

A telephone exchange is to be set up for a small

community of 50 customers, each of whom

independently attempts to call at the average rate of

one per hour and talks for 12 minutes on the

average. The call attempts (including reattempts by

customers who get a busy tone) can be adequately

described by Poisson process. System has a

capacity of K voice channel. Find the minimum value

of K such that the probability of service denial is 2%

or less.

22

Example (Con.)

Solution : The system can be modeled as a

M/G/K/SI/K/N, with N=50

,λ0=1/60

μ(n)=nμ0, μ0= 1/12

=λ0/μ0=0.2

So we get

0(N n) for n min(N,K)(n)

0 for n min(N,K)

n50

P(n) P(0)n

23

Example (Con.)

The probability reject call P(K) is given by

Setting P(K)0.02 and solving the equation we get

K=14.

1K

K n

n 0

50 50P(K)

K n

24

Response-Time Distribution

We briefly discuss how to determine

response-time distribution for M/M systems

The general approach is to pick a tagged

customer and account for all the delays it

encounters.

25

Response-Time Distribution (Con.)

Suppose M/M/1 system

Let R denote the response time for a tagged

customer

Let X denote the number of customers that it finds

on its arrival

So the distribution function R is:

0

( ) Pr( | ) Pr( | ) Pr( )R

n

F t R t X n R t X n X n

26

Response-Time Distribution (Con.)

Let R(n) denote response time of the tagged customer given that if finds n customers ahead of iteself.

R(n)= R1 + S2 +…+ Sn + Sn+1 R1 is the remaining service time of the customer

currently receiving service

Each Si has exponential distribution with mean 1/μ

Distribution of R1 is the same as Si (memoryless property of exponential distribution)

R(n) is sum of n+1 independent, identically distributed random variables

27

Response-Time Distribution (Con.)

Let f denote the density function of R:

The response-time distribution is also exponetial

The mean average response time is 1/μ(1-)

( ) ( )

0

(1 )

0

( )( ) Pr( ) (1 )

!

( )(1 ) (1 )

!

nt n

R t R t

n

nt t

n

tf f t X n e

n

te e

n

28

Batch Systems and Method of Stages

We examine M/M systems with batch arrivals

and services

Customers may arrive or get served as a group

with a number of K, where K can be a random

variable : Mk/M or M(x)/M.

Server may have K stages, each has an

exponential service time distribution with rate kμ.

So the overall service time distribution is Erlang

with the rate equal to μ : M/Mk

The behavior of Mk/M/1 is similar to M/Mk/1

29

Analysis of Batch Systems

The batch size is a random variable denoted C.

Let Prob(C=k)=ck

Services occur singly, backward transitions occur only to adjacent states and have rate μ

Forward transitions from state n can occur to any n+k, k>0 state with rate ckλ

n-1

λc1

n-2

μ

n+1 n

μ

n+2

λc1

μ

λc1 λc1

μ

λc2 λc2

30

Analysis of Batch Systems (Con.)

The global balance equation are given by:

where for n=0, λP(0)= μP(1)

n-1

λc1

n-2

μ

n+1 n

μ

n+2

λc1

μ

λc1 λc1

μ

λc2 λc2

1

( ) ( 1) ( ) ( )

n

k

k

P n k c P n P n

31

Analysis of Batch Systems (Con.)

To solve the equation we use Z-transform:

Let C(z)= znc denote the z-transform of the

sequence c1, c2, …

Let (z) denote the z-transform of state

probabilities.

Multiply both sides of equation by zn and then sum

over n, we get :

1

( ) ( ) ( ) (0) (1 ) ( ) (0)

(1 ) (0)( )

1 (1 ( ))

C

C

z z z P z Pz

z Pz

z z z

32

Analysis of Batch Systems (Con.)

We use Utilization law to compute P(0)

1-P(0)=U=λtotal/μ, where λtotal= λ

P(0)=(1- )

To ensure ergodicity, P(0)>0, <1/

We assume C has a geometric distribution

ck = (1-a)ak-1 for k= 1.. . 0<a<1

C(z)=z(1-a)/(1-az) and = C(1)=1/(1-a)

C

C

C

33

Analysis of Batch Systems (Con.)

The expression for (z) simplifies to

The average queue length is

It can be noted that Qbatch=Qexpo

(1 )(1 )( )

(1 )(1 ( ))

a azz

a z a

(1 )

CQ C

C

C

34

Staged Service with FCFS Scheduling

The k-stage Erlang system is shown below.

At most one customer is allowed to enter the

“service box”

State system is pair (n,j) where n gives the total

number of customers at station and j=1..k gives

the total number of customers at the station

1st stage 2nd stage kth stage

… kμ kμ kμ

35

Staged Service with FCFS Scheduling

(Con.)

The balance equations are as follows:

(λ+μ)P(n,1) = λP(n-1,1)+kμP(n+1,k) for j=1

(λ+μ)P(n,j) = λP(n-1,j)+kμP(n,j-1) for j>1

(λ)P(0) = kμP(1,k)

0

1,1

1,2

1,k

λ

λ

λ

2,1

2,1

2,k

λ

kμ λ

λ

… …

n-1,1

n-1,2

n-1,k

λ

λ

λ

n,1

n,2

n,k

λ

λ

λ

n+1,1

n+1,2

n+1,k

36

Staged Service with FCFS Scheduling

(Con.)

Let =λ/(kμ) , P(0) can be found by utilization

law

U=1-P(0)= λ/μ=k P(0)=1-k

Let P(n) denote the probability of finding n

customers in the system :

1

( ) ( , )

k

j

P n P n j

37

Staged Service with FCFS Scheduling

(Con.)

Use two dimensional z-transform of P(n,j):

Let (z) denote the z-transform of P(n):

By determining *(1,z), we can determine

(z): (1 )(1 )( )

1 [1 (1 )]kk z

zz z

*

1 1

( , ) ( , )

kj n

j n

y z y z P n j

*

1

( ) ( , ) (0) (1, )

kn

j

z z P n j P z

38

Staged Service with FCFS Scheduling

(Con.)

Differentiating (z) and evaluating z=1, we

get the average queue length:

Note that the queue length is smaller for a comparable

M/M queue and decrease monotonically with k.

Let k with the utilization U=λ/μ=k, the Avg. queue

length is :

(2 ( 1))

2(1 )

k kQ

k

/ /1

(1 / 2)

1M D

U UQ

U