M/M/2 Queue with two servers

birth-death-processmarkov chainsprobabilityprobability theoryqueueing-theory

A system with two servers:

Service time at server 1 is $Exp(3)$

Service time at server 2 is $Exp(4)$

A customer will always choose server 1 if both are vacant. If both are filled then customers will wait. Suppose customers arrive according to a Poisson process with rate 2.

a) find the probability customer 1 finishes before customer 2?

b) what is the expected time customer 2 will be in the system?

c) what is the probability customer 3 won’t have to wait?

For a) this should just be the the probably that a random variable with mean 1/3 (exponential) is less than a random variable with mean 1/4 (exponential) so this should be $ \frac{1/3}{1/3+1/4}$

b) I would think this would just be the service rate for server 2 since customer 2 doesn’t need to wait.

c) this would depend on whether no new customers show up when customer 1 and customer 2 finish.

Best Answer

So, first, here is the tree of possibilities for how events will develop:

enter image description here

(It's not the complete tree - that would be infinite - but it contains all the relevant branching points.)

So, for example, after customer 1 arrives to server 1, one of two things could happen next: the customer could leave, or customer 2 could arrive to server 2.

To answer the questions, we also have to know the probabilities of taking each branch in this tree. These are proportional to the service and arrival rates. So, after customer 1 arrives to server 1, that customer's service time is exponential with rate $\frac13$, and the next customer's arrival time is exponential with rate $2$. Therefore the two arrows from the top node have odds $ \frac13 : 2$, and probabilities $\frac{1/3}{1/3 + 2} = \frac17$ and $\frac{2}{1/3 + 2} = \frac67$ respectively.

Similarly, if customer 1 and customer 2 are at servers 1 and 2, respectively, then three things could happen next: customer 1 could leave (rate $\frac13$), customer 2 could leave (rate $\frac14$), or customer 3 could arrive (rate $2$). So the odds of these outcomes are $\frac13 : \frac14 : 2$ and their probabilities are $\frac{1/3}{1/3+1/4+2}$, $\frac{1/4}{1/3+1/4+2}$, and $\frac{2}{1/3+1/4+2}$, respectively.

This is enough information to answer questions (a) and (c): you just decide which nodes in the tree tell you "customer 1 finishes before customer 2" or to "customer 3 won't have to wait", and then find the probability of ending up at those nodes of the tree - by multiplying the probability of taking each branch to get there.

Let's do this for question (a) as an example.

  • At the top node "1 arrives to server 1", we have already found that the probabilities of going to "1 leaves" and "2 arrives to server 2" are $\frac17$ and $\frac67$.
  • At the node "2 arrives to server 2", the rates of 1 leaving, 2 leaving, and 3 arriving are $\frac13$, $\frac14$, and $2$, so the probabilities of going to "1 leaves", "2 leaves", and "3 arrives and waits" are $\frac{1/3}{1/3+1/4+2} = \frac{4}{31}$, $\frac{1/4}{1/3+1/4+2} = \frac{3}{31}$, and $\frac{2}{1/3+1/4+2} = \frac{24}{31}$, respectively.
  • At the node "3 arrives and waits", the probabilities of going to "1 leaves" and "2 leaves" are $\frac{1/3}{1/3+1/4} = \frac47$ and $\frac{1/4}{1/3+1/4} = \frac37$, respectively.

Customer 1 leaves first in three cases:

  • we go directly to "1 leaves" from the top node, which has probability $\frac17$.
  • we go from the top node to "2 arrives to server 2" then "1 leaves", which has probability $\frac67 \cdot \frac{4}{31}$.
  • we go from the top node to "2 arrives at server 2" then "3 arrives and waits" then "1 leaves", which has probability $\frac67 \cdot \frac{24}{31} \cdot \frac47$.

Together, these add up to $\frac17 + \frac67\cdot\frac{4}{31} + \frac67 \cdot \frac{24}{31} \cdot \frac47 = \frac{31}{49}$.

(Note that we could ignore customer 3 and get a simpler tree without the "3 arrives and waits" branch, since that doesn't affect the probability of customer 1 leaving first. Then the calculation is simpler: $\frac17 + \frac67 \cdot \frac47 = \frac{31}{49}$.)

For question (b), there's a further step. Customer 2 takes an average of $3$ units of time in the system at server 1, or an average of $4$ units of time at server 2. So you should weight these averages by the probabilities that customer 2 will arrive at server 1, versus server 2.

Related Question