# Queue M/M/2, proportion of unserved customers

In my work, I managed to arrive at the following scenario: Consider that I have a queue with two servers whose arrival rate is a poisson process $$\lambda = 2$$ customers per hour and the service time is exponential with an average of $$E(T) = 1$$ hour . In this queue, if a customer arrives and no one is waiting, the customer waits, otherwise the customer leaves. My interest is to know the proportion of customers that will not be served.

In a stable queuing system it is necessary that $$\lambda > \mu$$, but as my interest is in knowing the proportion of unserved customers, I believe that this restriction is not a problem, but as for this case, $$\rho$$ (occupancy rate) is equal to $$1$$, I'm kind of lost. Does anyone have any suggestions.

What you have is an $$M/M/2/3$$ queue with $$1$$ waiting capacity (the last $$3$$ refers to the maximum number of people in the system.) The queue occupancy probabilities are found in the general case $$(M/M/c/K)$$ using the following formulae, which give the probability $$p_n$$ of $$n \, (0 \leq n \leq K)$$ people in the system:

\begin{align} p_n &=& &{\lambda^n \over n!\mu^n}p_0 && 1 \leq n < c \\ &=& &{\lambda^n \over c^{n-c}c!\mu^n} p_0 && c \leq n \leq K \end{align}

$$p_0$$ can be derived from the condition that the probabilities must sum to 1.

The probability that the system is full at any time is:

$$p_c = {r^K \over c^{K-c}c!}p_0$$

where $$r = \lambda / \mu$$. Since Poisson Arrivals See Time Averages (PASTA), the fraction of arrivals that will see $$K$$ people in the queue when they arrive and will leave as a consequence is equal to the probability that there are $$K$$ people in the queue in the steady state.

In your case $$r = 2$$ and $$K = 3$$, giving:

$$p_0 + \left(2 + {2^2\over 2} + {2^3 \over 2\cdot 2}\right)p_0 = 1$$

resulting in $$p_0 = 1/7$$ and, after some minor calculation, $$p_3 = 2/7$$.

We can demonstrate the $$M/M/c/K$$ queue result with a little simulation. Here we make use of the fact that since all the interarrival times are distributed Exponentially, time is irrelevant; we have a continuous time Markov chain, and the transition probabilities are independent of time due to the memoryless property of the Exponential distribution.

lambda <- 2
mu <- 1

n_arrive <- 0
n_balk <- 0
n_servers_occupied <- 0
queue_length <- 0

for (i in 1:1000000) {
p_arrival <- lambda  / (lambda + n_servers_occupied*mu)
if (runif(1) <= p_arrival) {
n_arrive <- n_arrive + 1
if (n_servers_occupied == 2 & queue_length == 1) {
n_balk <- n_balk + 1
} else if (n_servers_occupied == 2) {
queue_length = 1
} else {
n_servers_occupied <- n_servers_occupied + 1
}
} else {
if (queue_length == 1) {
queue_length <- 0
} else {
n_servers_occupied <- n_servers_occupied - 1
}
}
}

n_balk / n_arrive
[1] 0.2862546
> 2/7
[1] 0.2857143

• Hi, @jbowman! I don't know if I made it clear in the question, but if there's no one in queue (and both servers are busy), the next customer that arrives will wait. Therefore, there is a possibility of having 3 customers in the system. Apparently the result would be something like 2/7. Commented Jan 3, 2023 at 11:45
• I've replaced the answer with one appropriate for the $M/M/c/K$ queue, where $K$ is the maximum capacity. Commented Jan 3, 2023 at 16:54
• Thanks @jbowman! Accepted answer ^^ Commented Jan 4, 2023 at 11:31
• Sorry about my initial misunderstanding, and thanks! Commented Jan 4, 2023 at 15:09