Solution (source code)

= Solution

A multiclass queue must specify its <service discipline> as well as its arrival and service rates. Here is an ordered-queue model that includes the usual class-independent exponential single-server queue. Let class-$r$ arrivals be independent <Poisson processes> of rates $\alpha_r$, and let a class-$r$ service requirement have the <exponential distribution> of rate $\mu_r$. A state is a finite word $x=(c_1,\ldots,c_n)$ of customer classes.

Choose service fractions $\gamma_i(n)\geq0$ with $\sum_{i=1}^n\gamma_i(n)=1$, and insertion probabilities $\delta_i(n)\geq0$ with $\sum_{i=1}^n\delta_i(n)=1$. The customer at position $i$ departs at rate $\mu_{c_i}\gamma_i(n)$; a class-$r$ arrival is inserted at position $i$ at rate $\alpha_r\delta_i(n+1)$. All rates leading to the same word are added. For class-dependent $\mu_r$, impose the <symmetric service discipline> $\delta_i(n)=\gamma_i(n)$. If all $\mu_r=\mu$, arbitrary class-independent $\gamma,\delta$ are permitted, including <first come first served> with insertion at the tail and service at the head.

Put $\rho_r=\alpha_r/\mu_r$ and $\rho=\sum_r\rho_r$. For $\rho<1$, the equilibrium word law is
$$
\boxed{\pi(c_1,\ldots,c_n)=(1-\rho)\prod_{i=1}^n\rho_{c_i}.}
$$
For the <symmetric service discipline>, insertion and deletion satisfy <detailed balance for a continuous-time Markov chain> because
$$
\pi(x)\alpha_r\gamma_i(n+1)=\pi(\operatorname{ins}_{i,r}x)\mu_r\gamma_i(n+1).
$$
For the common-service-rate case, use <time reversal of a continuous-time Markov chain> instead: the reversed queue inserts with probabilities $\gamma$ and serves with fractions $\delta$. A forward insertion gives a reverse deletion rate $\mu\delta_i$, and a forward deletion gives a reverse insertion rate $\alpha_r\gamma_i$. Forward and reverse total rates both equal $\sum_r\alpha_r+\mu\mathbf1_{\{n>0\}}$, proving <global balance for a continuous-time Markov chain>.

Summing the weights of all words of length $n$ gives $(1-\rho)\rho^n$, so the law is normalized. If $n_r$ counts class-$r$ customers and $n=\sum_r n_r$, the <multinomial coefficient> counting class orderings gives
$$
\boxed{\pi((n_r)_r)=(1-\rho)n!\prod_r\frac{\rho_r^{n_r}}{n_r!}.}
$$
For <processor sharing>, $\gamma_i(n)=\delta_i(n)=1/n$, the class-count vector itself is a <Markov chain>, with arrival rate $\alpha_r$ and departure rate $\mu_r n_r/n$. Under <first come first served>, the ordered word is generally necessary. Class-dependent service rates combined with <first come first served> do not in general have the displayed simple equilibrium law; the discipline assumption matters.