Tutorials › Stochastic Processes › Worked M/G/1 Calculations for Exponential and Deterministic Service

M/G/1 Queues and Networks · Tutorial 679 of 994

Worked M/G/1 Calculations for Exponential and Deterministic Service

Calculate and verify the key mean performance measures for stable M/M/1 and M/D/1 queues using the Pollaczek–Khinchine formula.

Advanced 9 min read

What You'll Learn

  • Check stability using the traffic intensity for M/M/1 and M/D/1 queues
  • Calculate service-time moments for exponential and deterministic service
  • Apply the Pollaczek–Khinchine formula to find mean waiting time in queue
  • Convert between mean waiting time and mean queue length
  • Find mean sojourn time and mean number in the system
  • Verify calculations using queue-length and sojourn-time identities

From Queueing Formulas to Exact Calculations

For an M/G/1 queue, the arrival process is Poisson and there is one server, while service times follow a general distribution. Two familiar special cases are M/M/1, with exponential service times, and M/D/1, with a fixed service time. In both cases, the calculation begins with the same stability check and the same mean-waiting-time formula. The service-time distribution enters through its first two moments, so the two queues can have the same arrival rate and mean service time but different waiting times.

We consider a single-server, infinite-capacity queue with first-come, first-served service. Arrivals form a Poisson process of rate \(\lambda>0\). The successive service times are independent and identically distributed, independent of the arrival process, with a finite first and second moment. Write \(S\) for a service time, \(\mathbb{E}[S]\) for its mean, and \(\mathbb{E}[S^2]\) for its second moment. The service rate is \(\mu=1/\mathbb{E}[S]\). The traffic intensity is \(\rho=\lambda\mathbb{E}[S]=\lambda/\mu\). We use \(W_q\) for a typical customer's mean waiting time before service, \(W\) for mean time in the system (waiting plus service), \(L_q\) for mean number waiting, and \(L\) for mean number in the system.

Stability and calculation formulas: The queue is stable when \(\rho<1\). Under the assumptions above, the Pollaczek–Khinchine mean-waiting-time formula is \(W_q=\lambda\mathbb{E}[S^2]/(2(1-\rho))\). Then \(W=W_q+\mathbb{E}[S]\), \(L_q=\lambda W_q\), and \(L=\lambda W\). The last two equalities are Little's law applied to the queue and to the whole system.

The Pollaczek–Khinchine formula gives the stationary mean waiting time for a stable M/G/1 queue; its derivation is part of the earlier material on the M/G/1 waiting-time formula. It requires \(\rho<1\) and \(\mathbb{E}[S^2]<\infty\). The M/M/1 and M/D/1 calculations below use it only after checking those conditions. Little's law relates a long-run mean number in a system to the arrival rate and the mean time spent there; here all arrivals are accepted and the stable system's long-run departure rate equals \(\lambda\). The distinction between \(W_q,L_q\), which exclude service, and \(W,L\), which include it, is essential.

The Two Service-Time Moment Calculations

Exponential service: If service times are exponential with rate \(\mu\), then \(\mathbb{E}[S]=1/\mu\) and \(\mathbb{E}[S^2]=2/\mu^2\). Thus, for a stable M/M/1 queue, \(W_q=\rho/(\mu-\lambda)\), \(W=1/(\mu-\lambda)\), \(L_q=\rho^2/(1-\rho)\), and \(L=\rho/(1-\rho)\).

Derivation. For an exponential random variable with rate \(\mu\), its first and second moments are \(1/\mu\) and \(2/\mu^2\). Substituting the second moment into the Pollaczek–Khinchine formula gives \(W_q=\lambda/(\mu^2(1-\rho))\). Since \(1-\rho=(\mu-\lambda)/\mu\), this becomes \(W_q=\lambda/(\mu(\mu-\lambda))=\rho/(\mu-\lambda)\). Adding the mean service time gives \(W=\rho/(\mu-\lambda)+1/\mu=1/(\mu-\lambda)\). Little's law then gives \(L_q=\lambda\rho/(\mu-\lambda)=\rho^2/(1-\rho)\) and \(L=\lambda/(\mu-\lambda)=\rho/(1-\rho)\). These expressions require \(\lambda<\mu\); at or above that threshold, the stable-queue formulas do not apply.

Deterministic service: If every service time equals \(d>0\), then \(\mathbb{E}[S]=d\), \(\mathbb{E}[S^2]=d^2\), and \(\rho=\lambda d\). When \(\rho<1\), \(W_q=\lambda d^2/(2(1-\rho))\), \(W=d+W_q\), \(L_q=\lambda W_q\), and \(L=\lambda W\).

These formulas are direct substitutions into the same M/G/1 result. Exponential service has a larger second moment than deterministic service with the same mean: for mean \(d\), the exponential second moment is \(2d^2\), whereas the deterministic second moment is \(d^2\). Therefore, at a fixed arrival rate and fixed mean service time, the exponential model has twice the mean queueing delay of the deterministic model. This comparison concerns the mean waiting time in a stable single-server queue; it does not say that every customer's wait is twice as long.

Worked Calculations

Worked Example: M/M/1 with Arrival Rate 2 and Service Rate 5

Take \(\lambda=2\) customers per hour and exponential service with rate \(\mu=5\) per hour. The mean service time is \(1/5\) hour. First check the stability condition: \(\rho=\lambda/\mu=2/5<1\), so the stationary mean formulas apply. The service-time second moment is \(2/\mu^2=2/25\) hour squared.

Apply the Pollaczek–Khinchine formula and then add service time to obtain the sojourn time:

$$ W_q=\frac{2(2/25)}{2(1-2/5)} =\frac{4/25}{6/5} =\frac{4}{25}\cdot\frac{5}{6} =\frac{2}{15}\text{ hour}, \qquad W=\frac{2}{15}+\frac{1}{5} =\frac{2}{15}+\frac{3}{15} =\frac{1}{3}\text{ hour}. $$

Convert these time means to mean numbers using Little's law:

$$ L_q=2\cdot\frac{2}{15}=\frac{4}{15}, \qquad L=2\cdot\frac{1}{3}=\frac{2}{3}. $$

Check: The mean number in the system must be the mean number waiting plus the mean number in service. Here \(L_q+\rho=4/15+2/5=4/15+6/15=2/3=L\). The closed M/M/1 formulas give \(W=1/(5-2)=1/3\) hour and \(L=(2/5)/(1-2/5)=2/3\), agreeing with the calculation.

Worked Example: M/D/1 with Arrival Rate Three-Quarters and Service Time One

Suppose arrivals occur at rate \(\lambda=3/4\) per hour and each service takes exactly \(d=1\) hour. Then \(\mathbb{E}[S]=1\) hour, \(\mathbb{E}[S^2]=1\) hour squared, and \(\rho=(3/4)(1)=3/4<1\). The queue is stable, so the M/G/1 mean formula applies.

The mean waiting time is

$$ W_q=\frac{(3/4)(1)}{2(1-3/4)} =\frac{3/4}{2(1/4)} =\frac{3/4}{1/2} =\frac{3}{2}\text{ hours}. $$

Adding the one-hour service time gives \(W=3/2+1=5/2\) hours. Little's law gives \(L_q=(3/4)(3/2)=9/8\) customers and \(L=(3/4)(5/2)=15/8\) customers.

Check: The mean number in service is the utilization \(3/4\). Thus \(L_q+\rho=9/8+3/4=9/8+6/8=15/8=L\). Also, recomputing the sojourn time from the system mean gives \(L/\lambda=(15/8)/(3/4)=(15/8)(4/3)=5/2\) hours, as required.

Worked Example: Compare Exponential and Deterministic Service at the Same Load

Compare two queues with arrival rate \(\lambda=1/2\) per hour and mean service time \(1\) hour. In the first queue service is exponential with rate \(\mu=1\) per hour; in the second, service is deterministic with \(d=1\) hour. Both have \(\rho=(1/2)(1)=1/2<1\), so both are stable. The common first moment is \(1\) hour, but the second moments differ: \(2\) hours squared for exponential service and \(1\) hour squared for deterministic service.

For the M/M/1 queue,

$$ W_q=\frac{(1/2)(2)}{2(1-1/2)} =\frac{1}{1}=1\text{ hour}, \qquad W=1+1=2\text{ hours}, $$ $$ L_q=(1/2)(1)=\frac{1}{2}, \qquad L=(1/2)(2)=1. $$

For the M/D/1 queue,

$$ W_q=\frac{(1/2)(1)}{2(1-1/2)} =\frac{1/2}{1} =\frac{1}{2}\text{ hour}, \qquad W=\frac{1}{2}+1=\frac{3}{2}\text{ hours}, $$ $$ L_q=(1/2)(1/2)=\frac{1}{4}, \qquad L=(1/2)(3/2)=\frac{3}{4}. $$

Check: In the exponential case, \(L_q+\rho=1/2+1/2=1=L\). In the deterministic case, \(L_q+\rho=1/4+1/2=3/4=L\). The exponential queue's mean waiting time is \(1\) hour, exactly twice the deterministic queue's \(1/2\) hour; the two calculations differ because their service-time second moments differ, not because their loads or mean service times differ.

When the Formulas Do Not Apply

The stability check is not optional. For example, if \(\lambda=1\) per hour and deterministic service takes \(d=1\) hour, then \(\rho=\lambda d=1\). Substitution into \(\lambda d^2/(2(1-\rho))\) would put zero in the denominator. This is not a finite waiting-time answer: the stable stationary mean formula is inapplicable because the queue is at the boundary \(\rho=1\). If \(\rho>1\), offered work arrives faster than the server can process it on average, so there is likewise no stable stationary queue with the finite means calculated here.

Common mistake: using the service rate where a second moment is required. In the first example, incorrectly replacing the exponential second moment \(2/25\) by \(1/25\) would yield \(W_q=2(1/25)/(2(3/5))=1/15\) hour. That is not the M/M/1 waiting time: the exponential second moment is \(2/\mu^2=2/25\), not \((1/\mu)^2=1/25\). Using the correct moment gives \(W_q=2/15\) hour. The mistake amounts to treating exponential service as deterministic service with the same mean.

For a reliable calculation, keep the sequence explicit: identify the service-time distribution, compute its first and second moments, check \(\rho<1\), find \(W_q\), add the mean service time to get \(W\), and use Little's law for \(L_q\) and \(L\). The final consistency check \(L=L_q+\rho\) catches common mix-ups between the queue and the whole system.

Check Your Understanding

For each problem, state the stability check before using a stationary mean formula, and verify the final quantities with an identity.

  1. An M/M/1 queue has \(\lambda=1\) per hour and \(\mu=4\) per hour. Calculate \(\rho,W_q,W,L_q,\) and \(L\).
  2. An M/D/1 queue has \(\lambda=1/2\) per hour and deterministic service time \(d=1/2\) hour. Calculate both service-time moments and the four mean performance measures.
  3. At a fixed mean service time and arrival rate, which service-time moment distinguishes the M/M/1 and M/D/1 mean waiting-time calculations?
  4. Why is it incorrect to substitute \(\rho=1\) into the stable M/G/1 waiting-time formula and report a finite answer?