M/M/1 Lab

M/M/1 Lab

CSM §6.4.4. A birth–death chain on 0, 1, 2, … with the same rates in every state: arrivals at rate λ, departures at rate μ, and ρ = λ/μ. For ρ < 1 the stationary distribution is π*j = (1−ρ)ρj.

How it works and what to try

How it works: In four panels. (1) Sample paths from a chosen starting state, with the stationary mean ρ/(1 − ρ) as a reference line. (2) The distribution π(t), found by solving Equation 6.20 numerically, shown as a heat map and as a bar chart against π*, with E[N(t)] and π0(t) over time. (3) One long first-come-first-served run, whose running averages of customers and delay are compared with Equations 6.37 and 6.38 and checked against Little’s theorem. (4) A ρ slider that plots the M/M/1 formulas and the simulated averages together.

Try this: Start 15 customers deep and see how long the paths take to forget where they began. Try different initial distributions and watch π(t) reach the same limit. Move ρ from 0.5 to 0.95 and see delay grow like 1/(1 − ρ), and the long-run averages take longer to settle.

Section and equation numbers refer to Chapter 6 of S. Keshav, Mathematical Foundations of Computer Networking, Addison-Wesley, 2012.

Rates, same in every state

Horizon

Sample paths

Initial distribution π(0)

Weights are normalised to sum to 1.

Sample paths from state k

Each colour is an independent path from the same start. When ρ < 1 they forget where they started and wander around the stationary mean ρ/(1−ρ) (dashed).

Time evolution of π(t)

Solves dP(t)/dt = P(t)Q (Eq. 6.20) numerically. Each column of the heat map is the distribution over states at that time; darker means more probability.

π(t) at the chosen t

πj(t)π*j = (1−ρ)ρj

Mean population E[N(t)] and π0(t)

E[N(t)]π0(t) (right axis)stationary values

Long-run averages

One long first-come-first-served run of the queue. The bold lines are running averages: the time average of the number of customers up to time t, and the mean delay of the first n customers. For ρ < 1 they settle on the M/M/1 values (dashed). Convergence is slow when ρ is close to 1, so use long runs there.

Number of customers, time average

in system, N̄(t)in queue, N̄q(t)N(t) itself

Delay per customer, running mean

time in system, T̄wait in queue, W̄qeach customer

Effect of utilisation ρ

Moving ρ changes the arrival rate to λ = ρμ, keeping μ fixed, and updates every panel on this page. The curves are the M/M/1 formulas; the open circles are the simulated averages from the long run above.

Expected number of customers

in queue, ρ²/(1−ρ)in system, ρ/(1−ρ)

Expected delay (time units)

wait in queue, ρ/(μ−λ)time in system, 1/(μ−λ)