Have you ever noticed how various establishments make people line in a certain way? Have you gone to a bank and noticed a number of tellers servicing each client but there is only one line? Wouldn’t it be more natural to let people line up before each teller like you see in a grocery? The way customers are lined up in a server or system of servers is called **Queueing Discipline**.

In this article, we will learn how various queuing disciplines will affect the values of the performance metrics. We will use **continuous markov chain analysis** that we learned in the last article.

**Motivating Scenario**

Assume that the counter of a certain fast food store is arrange in a 2-stage way. The customers first place their order in counter 1, pays the cashier and proceeds to counter 2 to wait for their order to be picked up. Let be the rate at which customers arrive, the rate at which customers places their order and also the rate at which they leave the second counter. Let us draw the markov chain diagram of this system.

Each state is described by two numbers. The first number refers to the number of customers in the first counter. The second number refers to the number of customers waiting at the second counter. For example, state 00 mean that there are no customers being serviced. State “12” mean that one customer is in counter 1 and 2 customers in counter 2. The blue arrows represent arrivals at rate a and red arrows are represent the rate of customers going to counter 2 and those leaving the counter 2.

Let us examine the four states in the diagram below. There is a blue arrow from state “00” to state “10” because when the first customer arrives, the first station will have 1 customer but no one in line yet in counter 2. This means that when the first customer arrives, the system will be in state “10”. There is an arrow from state “10” to “01”. The means that the first customer is already in counter 2 to pickup his/her order but no new customer has arrived yet. There is a red arrow from state “01” to “00”. This means that the single customer has already picked up his/her food and has left leaving the system with no customers at both stations. Notice that there is no arrow from state “10” to “00” because the customer who is in counter 1 cannot just leave the system but has to go to counter 2 before leaving.

**Balance Equations**

*steady state*, the

*sum of flows going to one state must equal the sum of flows going out of that state*. By definition, the flow along an arrow is equal to the rate along the arrow multiplied by the probability of the system being in the current state.Let us do the balance equation for state “00”. There is one arrow going to state “00” and one arrow going out of state “00”. Therefore the flow going to state “00” is equal to the rate going from state “01” to “00” multiplied by the probability of the system being in state “01” : . This is equal to the flow going out of state “00” to state “10”: a*P00. Therefore,we have,

Doing this for all states, we get the following balance equations:

*sum of all probabilities is equal to 1*:

Solving for the probabilities using elementary algebra, we get the following:

**A simple Example**

Suppose that customers arrive on the average of 1 customer per minute and can place and pay for their order in 2 minutes. After that they wait on the average of 2 minutes at the second counter to take out their order. Using the formula above, we have and . We can now solve for the probabilities by substituting these values to the above formula.

Computing the rest of the values, we get the following table:

P00 | 4/13 |

P01,P10 | 2/13 |

P02,P11,P20 | 1/13 |

P03,P12,P21,P30 | 1/26 |

We can compute for the **Utilization **of the first counter by using it’s idle time. Notice that the first counter does not have anything to do when there are no customers lining in front of it. This happens in states P00, P01, P02 and P03. Notice that these states have the first number equal to 0 (which means: no customer in that counter). Therefore, the utilization is equal to 1 minus the idle time of counter 1, i.e,

Using the **Utilization law** we learned in a previous article, we can compute the **throughput **of counter 1 to be:

This happens to be the **system throughput** also since each customer will visit a counter only once per transaction.

Now that we know how to model using markov chains, in the next article, we will analyze other queueing disciplines and compare them according to throughput and response time.