Solution (source code)

= Solution

An <M M 1 queue> has a Poisson arrival process of rate $\lambda$, independent exponential service times of rate $\mu$, and one server, with an unlimited waiting room and the usual first-come-first-served discipline. Its number-in-system process is a continuous-time <birth-death chain> with $q_{j,j+1}=\lambda$ and $q_{j,j-1}=\mu$ for $j\geq1$. For $\rho=\lambda/\mu<1$, <detailed balance> gives
$$
\boxed{\pi_j=(1-\rho)\rho^j,\qquad j=0,1,\ldots.}
$$
This sums to one and satisfies $\pi_j\lambda=\pi_{j+1}\mu$. The nonexplosive irreducible chain therefore has an invariant probability and is positive recurrent. Equivalently its negative drift above zero gives finite mean return cycles. Here queue length includes the customer in service.

In equilibrium, <PASTA> gives an arriving customer's number of predecessors the distribution $\pi$. Conditional on $j$ predecessors, <memoryless property> makes its total waiting-plus-service time a sum of $j+1$ independent $\operatorname{Exp}(\mu)$ variables. Its <Laplace transform> is
$$
\sum_{j=0}^\infty(1-\rho)\rho^j\left(\frac\mu{\mu+s}\right)^{j+1}
=\frac{\mu-\lambda}{\mu-\lambda+s}.
$$
Therefore
$$
\boxed{W\sim\operatorname{Exp}(\mu-\lambda).}
$$
This is the sojourn time including service, not just the time until service begins.