- The weeks ahead
- class on assignment 3
- possible tutorial

Only two services

- Speak and be heard on another telephone.
- Run an application

There is only one other function at this level of abstraction

Four processors

- A Codec (coder/decoder) that creates
- descriptions of sound (digitized packets )from an audio source
- audio from digital descriptions of sound

- A GPU that creates
- images from digital descriptions of images
- (Some descriptions are algorithms)

- A CPU that does general purpose computing including
- running the application, and
- receiving events.

- A user who
- produces sound for the codec,
- perceives pictures from the GPU and sound from the codec, and
- sends input to the CPU using the keypad

Speaking

- The user decides to make a phone call, and
- inserts a arrival, connexion request into the event queue

- The arrival, connexion request (1) enqueues the request at the CPU,
- puts a departure connexion request into the event queue, and
- inserts an arrival, teardown event into the event queue

- The departure event (2) enqueues the request at the user who
- puts a departure connexion events into the event queue
- puts an arrival connexion event into the event queue

- The departure event (3) enqueues the request at the codec who
- puts a departure connexion event into the event queue

- The departure event (4) transmits the digitized block of sound from the user
- The arrival event (3)enqueues the request at the CPU
- inserts an departure, connexion event into the event queue

- Continue from (3) until eventually the arrival teardown event occurs,
- all references to the set of requests generated on the call are removed from the system, and
- an arrival connexion event is put into the event-set

Running an application

- The user decides to run an application, and
- inserts a arrival, next request into the event-set

- The arrival, next request (1) enqueues the request at the CPU,
- puts a departure next request into the event-set, and
- inserts an arrival, stop event into the event-set

- The departure event (2) enqueues the request at either the codec or the
GPU who
- puts a departure next events into the event-set

- The departure event (3) enqueues the request at the user who
- puts a departure next event into the event-set

- The departure event (4) enqueues the request at the CPU, who
- puts a departure, next event into the event-set

- The arrival event (2)
- inserts an arrival, teardown event into the event-set

- Continue from (3) until eventually the arrival stop event occurs,
- all references to the set of requests generated on the application are removed from the system,
- an arrival start event is put into the event-set

- The phone call and the application circulate different ways in the system
- There can be only one application request at a time.
- There can be more than one connexion request at a time
- Serial numbers are essential for data analysis
- Associate one with all the events/requests for each phone call
- Associate one with all the events/requests for each application

- Times of events that begin and end applications and phone calls should be exponentially generated, not necessarily with the same average arrival rate
- Times of
**most**departure events should be generated from normal distributions, the mean of which is the average service time for that event type and processor - It is easier to discard data from a too-extensive log than it is to create data from a too-skimpy one.
- Start with two events in the event queue. What should they be?
- Make certain that the number of requests in each server is consistently defined
- The pattern
- initiation of an activity occurs in an open system
- continuation of the activity occurs in a closed system

is commonly encountered in interactive systems. This is easier if we conceive of the user as having a ghost, who initiates, while the user continues.

The example above is a Birth-death process. Why?

A special process where only transitions to neighbouring states are possible That is, if we are in S(j) then the next state can be

- S(j-1), a death occurs.
Death rate \mu_j.

- S(j+1), a birth occurs
Birth rate \lambda_j.

- S(j), neither a birth nor a death occurs, or both a birth and death occur.

We now want to examine what happens, in a birth-death process, in the short time between t and t + \Delta t. Use the Poisson distribution.

- Poission Distribution
- P( exactly k births ) = (1/k!) (\lambda dt)^k exp( -\lambda dt )
- P( exactly zero births ) = exp( -\lambda dt )
- P( exactly one birth ) = (\lambda dt)exp( -\lambda dt )
- P( exactly two births ) = (1/2) (\lambda dt)^2 exp( -\lambda dt )
- Notice that they sum to 1

- Since dt is very small terms in dt^2 are inconsequential compared to
terms in dt
- P( exactly zero births ) = exp( -\lambda dt ) = 1 - \lambda dt
- P( exactly one birth ) = (\lambda dt)exp( -\lambda dt ) = \lambda dt (1 - \lambda dt) = \lambda dt
- P( exactly two births ) = (1/2) (\lambda dt)^2 exp( -\lambda dt ) = (\lambda dt)^2 = 0
- Notice that they still sum to 1

- We get exactly the same thing for deaths, with \mu in place of \lambda
- What about births and deaths together
- P( zero births AND zero deaths ) = P( zero births ) * P( zero deaths ) = ( 1 - \lambda dt ) * (1 - \mu dt ) = 1 - ( \lambda + \mu ) dt
- P( one birth AND zero deaths ) = P( one birth ) * P( zero death ) = \lambda dt * ( 1 - \mu dt ) = \lambda dt )
- P( zero births AND one death ) = \mu dt
- P( one birth AND one death ) = (\lambda dt) * (\mu dt) = 0

**Exercise for the reader.** Explain the equivalence of the
above to only Arrival and Departure events affecting the system state.

**Remember.** The state is the population N(t), having the
value j. The state j occurs with probability P( N(t) = j ) which we define as
p_j(t).

Then

- p_j(t+dt) = p_j(t) + ( \lambda_j-1 p_j-1(t) + \mu_j+1 p_j+1(t) - (\lambda_j + \mu_j) p_j(t) )dt
- (p_j(t+dt) - p_j(t) ) / dt = ( \lambda_j-1 p_j-1(t) + \mu_j+1 p_j+1(t) - (\lambda_j + \mu_j) p_j(t) ) dt / dt
- In the limit dt -> 0 dp_j(t) / dt = \lambda_j-1 p_j-1(t) + \mu_j+1 p_j+1(t) - (\lambda_j + \mu_j) p_j(t)

This equation looks as though we can solve it, and indeed we can!

**Reminder.** Transient and steady states are different. We
are interest in the steady state. The steady state is defined as having
stationary (not time-dependent) probabilities.

That is: dp_j(t) / dt = 0.

Then

- \lambda_j-1 p_j-1(t) + \mu_j+1 p_j+1(t) - (\lambda_j + \mu_j) p_j(t) = 0

Solve this iteratively

- l0 p0 = m1 p1 => p1 = (l0/m1) p0
- (l1 + m1) p1 = l0 p0 + m2 p2 => (l1 + m1) (l0/m1) p0 = l0 p0 + m2 p2 => p2 = p0 (l1*l0 / m1*m0)
- ...
- pn = p0 (l_n-1*...*l1*l0 / m_n-1 *...*m1*m0)
- Set p0 by the condition sum_n pn = 1.

This looks like you could solve it further, but you can't. How could you possibly solve the differential equation above, in that case?

What do we do? Try simplified examples.

First M: Markovian (Exponential) birth (interarrival) times

Second M: Markovian (Exponential) life/death (service) times

1: one server

Assumptions:

- \lambda_j = \lambda
- \mu_j = \mu
- Define r = \lambda / \mu

Then

- pn = r^n p0
- p0 = 1 / (1 + r + r^2 + ...) = 1 - r.
- pn = (1 - r) * r^n.

- S = 1 + r + r^2 + r^3 + ... = 1 + r * ( 1 + r + r^2 + r^3 + ... ) = 1 +
r * S

Therefore, S * (1-r) = 1and S = 1 / (1 - r) - dS/dr = 1 + 2r + 3r^2 + 4r^3 + ... = (1 + r + r^2 + ...) + ( r + 2r^2 +
3r^3 +... ) = S + r ( 1 + 2r + 3r^2 + ... ) = S + r dS/dr
Therefore, dS/dr = S + r dS/dr and dS/dr = S / (1 - r) = 1 / (1 - r)^2

But E(N) = sum_n n*p_n = (1 - r) (r + 2 r^2 + 3 r^3 + ... ) = (1 - r ) (dS/dr - S) = (1 - r ) (1 / (1 - r)^2 - 1 / (1 - r) ) = 1 / (1 - r) - 1 = r / (1 - r)

The mean number of jobs in the system is E(r) = sum_n n * (1 - r ) * r^n = r / (1 - r)

- Goes to infinity as r -> 1. Why?

Little's law

- Mean response time: E(r) = (1/\lambda) * E(n) = 1 / (\mu - \lambda)
- Goes to infinity as \lambda -> \mu from below. Why?
- What happens when \lambda > \mu?

Return to: