ppt - Dr. Wissam Fawaz

advertisement
M/M/1 queue
λ

μ
λ: arrival rate
μ: service rate
λn = λ, (n >=0); μn = μ (n>=1)
Pn 
 0 1 ...  n 1
 0  1 ...  n
P0  Pn 
 Pn   P0 ;  
n

n

n
P0


P0  P1  ...  Pn  ...  1
P0 (1      ...)  1  P0  1  
2
1
Traffic intensity

rho = λ/μ


It is a measure of the total arrival traffic to the system

Also known as offered load

Example: λ = 3/hour; 1/μ=15 min = 0.25 h
Represents the fraction of time a server is busy

In which case it is called the utilization factor

Example: rho = 0.75 = % busy
2
Queuing systems: stability

λ<μ


N(t)
busy
=> stable system

3
2
1
1
λ>μ
idle
2 3 4 5 6 7 8 9 10 11
Time
Steady build up of customers => unstable
N(t)
3
2
1
1
2 3 4 5 6 7 8 9 10 11
Time
3
Example#1

A communication channel operating at 9600 bps


Receives two type of packet streams from a gateway

Type A packets have a fixed length format of 48 bits

Type B packets have an exponentially distribution length
 With a mean of 480 bits
If on the average there are


20% type A packets and 80% type B packets
Calculate the utilization of this channel

Assuming the combined arrival rate is 15 packets/s
4
Performance measures

L


Lq


Mean queue length in the queue space
W


Mean # customers in the whole system
Mean waiting time in the system
Wq
 Mean waiting time in the queue
5
Mean queue length (M/M/1)

L  E[n] 


nP n 
n0

n  (1   )
n
n0

 (1   )   ( n 
n 1
n0

)  (1   )   (  )'
n
n0

  (1   )  (  )'
n
n0
  (1   )(
 L
1
1 
)' 

1 

 
6
Mean queue length (M/M/1)
(cont’d)

Lq 
 ( n  1) P
n
n 1


 nP
n 1

n

P
n
n 1
 L  (1  P0 )
 L  (1  (1   ))
 L
 L  Lq  
7
Little’s theorem

This result

Existed as an empirical rule for many years


And was first proved in a formal way by Little in 1961
The theorem

Relates the average number of customers L


In a steady state queuing system
To the product of the average arrival rate (λ)

And average waiting time (W) a customer spend in a system
L   .W
8
LITTLE’s Formula

𝑁 =𝜆×𝐷




𝑁: average number of messages in system
𝐷: average delay
λ: arrival rate
Little’s relation holds for any



Service discipline
Arrival process
Holding area
Graphical Proof

A(t)


L(t)


Nb. of customers that left system up to t
=> N(t) = A(t) – L(t)


Cumulative arrival process
Nb. of customers in system at time t
di : interval between ith arrival and its departure

∆ 𝑡 = 𝑑1 + 𝑑2 + … + 𝑑𝑛
Graphical Proof (continued)
Graphical Proof (continued)

𝜆 𝑇 =
𝐴(𝑇)
, 𝐷(𝑇)
𝑇

⇒𝜆 𝑇 ×𝐷 𝑇 =

Now, let 𝑇 → ∞

=
∆(𝑇)
𝐴(𝑇)
∆(𝑇)
𝑇
= 𝑁(𝑇)
lim 𝜆 𝑇 = 𝜆, lim 𝐷 𝑇 = 𝐷
𝑇→∞
𝑇→∞
⇒ lim 𝑁 𝑇 = 𝑁 = 𝜆𝐷
𝑇→∞
Mean waiting time (M/M/1)

Applying Little’s theorem
L   .W
W 
L


1
.

 1 

1
 
13
Z-transform: application in
queuing systems

X is a discrete r.v.

P(X=i) = Pi, i=0, 1, …

P0 , P1 , P2 ,…

g (z) 

Pi z
i
i0

Properties of the z-transform


g(1) = 1, P0 = g(0); P1 = g’(0); P2 = ½ . g’’(0)
𝐸𝑋 =
𝑑
𝑑𝑧
𝑔 𝑧
𝑧=1
,𝐸
𝑋2
=
𝑑2
𝑑𝑧 2
𝑔 𝑧
𝑧=1
+
𝑑
𝑑𝑧
𝑔 𝑧
𝑧=1
14
M/M/1 Queue – Infinite Waiting Room

Probability generating function


Mean


𝑃 𝑧 =
∞
𝑛
𝑛=0 𝜌
𝑁=
𝜌
(1−𝜌)
Variance

𝑉𝑎𝑟 𝑁 =
𝜌
1−𝜌 2
𝑛
1−𝜌 𝑧 =
1−𝜌
1−𝑧𝜌
M/M/S
n  
n ; n  s
n  
 s ; n  s
n s
Pn 
 0  1 ...  n 1
 1 ...  n
P0 

n
 . 2  . 3  ... n 
n
  1
   . . P0
   n!
16
M/M/S (cont’d)
n S
Pn 

n
 . 2  . 3  ... S  . S  . S  ...
P0
n
 
1
  
P0
nS
   S !. S

 

Pn  

 

P0 
n
  1

P0 ; n  S
  n!
n
 
1

P0 ; n  S
nS
  S !. S
1
S 1
n
S
  1   1
1
.

.
.




    n!    S !

n0 

 
1
S .
17
S servers
μ
M/M/S
λ
n  
n ; n  S
n  
S ; n  S
n  S , Pn 
 0 1 ...  n 1
 1 ...  n


  1
. P0    . . P0
 . 2  . 3  ... n 
   n!
n
 
1
P0   
P0
nS
 . 2  . 3  ... S  . S  . S  ...
   S !. S
n  S , Pn 

 

Pn  

 

P0 
n
n
n
n
  1

P0 ; n  S
  n!
 
n
1

P0 ; n  S
nS
  S !. S
18
M/M/S: normalizing equations
P0  P1  ...  PS  PS  1  ...  Pn  ...  1
n
  1
    n! P0 
n0 

S 1
n
 
1


    S !. S n  S P0  1
nS 


 S 1    n 1
P0    

 n  0    n!
n
 
1
    S !. S n  S
nS 


n

 1

n
 
 
1
1
1
    S !. S n  S  S !     S n  S 
nS 
nS 




S
S 1
S2


 
1  
1  
1
      .    . 2  ...  
S !   
S  
S

 

 
 
 
S
1
2


  1   1
1
. 1    .    . 2  ... 
S! 

  S   S

19
M/M/S: stable queue

is λ/Sμ < 1 ?

Otherwise you will not get a stable queue, as such
 
 
 
S
1
2


  1   1
1
. 1    .    . 2  ...  
S! 

  S   S

S
  1
1
  . .
   S! 1  
S
 P0 
1
S 1
n
S
  1   1
1
    . n!     . S !. 
n0 

 
1
S .
20
M/M/S: performance measures

Mean queue length
Lq 

S
 
  .
(
n

S
)
P


S
nS


( / S )

 
S !. 1 

S 

2
Mean waiting time in the queue (Little’s theorem)
L q   .W q  W q 

Lq

Mean waiting time in the system
W  Wq 

. P0
1

Mean # of customers in the whole system
L   .W  L   .W q 


21
Erlang C formula

A quantity of interest


Probability to find all s servers busy
𝑠
𝑠𝜌
∞
𝑠! (𝑠 − 𝜌 )
𝑃𝑐 𝑠, 𝜌 =
𝑃𝑛 =
𝑛
𝑠𝜌𝑠
𝑠−1 𝜌
𝑛=𝑠
𝑛=0
𝑛! +
(𝑠! (𝑠 − 𝜌))
Ratio between Lq and Pc
𝐿𝑞
𝜌
𝑃𝑐 𝜌
=
⇒ 𝑊𝑞 =
𝑃𝑐 (𝑠 − 𝜌)
𝜆 𝑠−𝜌
22
M/M/S: stability revisited

Stable
If λ/Sμ < 1


Arrival rate to an individual server


S

Utilization of a server


 1
.
S 
Utilization of all servers



23
M/M/1/N
λ
% loss
μ
N

Birth and death equations
n  ,n  0
 ; n  N  1
n  
 0; n  N
Pn 
 0 1 ...  n 1
 1  2 ...  n

n
 
P0  n . P0    P0 , n  0 ,1,..., N

 
n
24
M/M/1/N: normalizing constant

Let ρ=λ/μ
P0  P1  ...  PN  1
 P0   . P0  ....   . PN  1
N
 P0 (1    ...   )  1
N
 P0

(1  
N 1
)
1 
 1  P0 
1 
1 
N 1
As such
 (1   )
n
Pn   . P0 
n
1 
N 1
 PN 
(1   ) 
(1  
N
N 1
)
Probability of arriving
to a full waiting room
25
M/M/1/N: what percent of λ
gets into the queue?

Percentage of time the queue is full
 is equal to PN
.75
.25
Not full
full

Rate of lost customers = λ.PN

Rate of customers getting in : λ.(1-PN)
 Often referred to as effective customer arrival rate
   .(1  PN )

Utilization of server




 .(1  PN )

26
M/M/1/N: performance
measures

Mean # of customers in the system
L

1 

( N  1) 
1 
N 1
N 1
LM/M./1

Mean queue length
L q  L  (1  P0 )

Waiting time in system: W = L/λ

Waiting time in queue: Wq = Lq/λ
27
M/M/1/N: equivalent systems

When an M/M/1/N queue is full

Continuous arrival



A system with loss
is equivalent to shutting up the service

For the duration during which the queue is full

And starting it up again when system no longer ful

This system is called a shut down system
This equivalence holds only when

the inter-arrival is exponential
28
Proof: rate diagrams

M/M/1/N system with loss

Consider the special case where N = 5
0
λ
1
μ
λ
2
μ
λ
μ
3
λ
μ
4
λ
5
λ
μ
 . P0   . P1
(    ). P1   . P0   . P2
.
.
(    ). P5   . P4   . P5   . P5   . P4
29
Proof: rate diagrams (cont’d)

M/M/1/N shut down system

Consider the special case where N = 5
0
λ
1
μ
λ
μ
2
λ
3
μ
λ
μ
4
λ
5
μ
 . P0   . P1
(    ). P1   . P0   . P2
.
.
 . P5   . P4
30
M/M/infinity: birth and death
equations Infinite number of
servers
μ
λ
.
.
n  
 n  n .
Pn 
 0 1 ...  n 1
 1  2 ...  n

n
  1

P0  n . . P0    . . P0 
. P0
 n!
n!
   n!
n
1
n
31
M/M/infinity: normalizing
constant
Pn 

n
n!
. P0
P0  P1  ...  Pn  ...  1 
P0 

1!
P0 

2
2!
. P0  ... 

n
n!
. P0  ...  1 
2


 


P0 1 

 ...   1  P0 .e  1  P0  e
1!
2!


Pn 

n
.e

n!
32
Erlang system: M/M/S/S
Finite number of
Servers = S
μ
λ
.
.
Pn 

n
n!
. P0
2
S

 
 
P0 1 

 ... 
 1
1!
2!
S! 

P0 
1


n0

n
n!
33
Erlang loss formula

What percent gets in and


What percent gets lost
PS = prob S customers in system
 / S!
S
PS 
S

n0


n
Erlang loss formula
n!
Effective arrival rate
   .(1  PS )

Rate of lost customers = λ.PS
34
Erlang B formula

Probability of finding all s servers busy
𝑃𝐵 𝑠, 𝜌 =

𝑠!
𝜌𝑠
𝜌𝑛
𝑠
𝑛=0
𝑛!
In an iterative form:
𝜌𝑃𝐵 (𝑠 − 1, 𝜌)
𝑃𝐵 𝑠, 𝜌 =
𝑠 + 𝜌𝑃𝐵 (𝑠 − 1, 𝜌)
𝑃𝐵 0, 𝜌 = 1
35
Download