Module 4 -- Queueing Theory


Index

  1. What is Queueing Theory?
  2. Case 1 M/M/1 (∞ / FIFO) Poisson Queueing Model.
  3. Example 1 (Infinite capacity)
  4. Example 2 (Infinite capacity)
  5. Case 2 M/M/1(N/FIFO)-- finite capacity queueing model
  6. Key symbols/reminder
  7. Two cases
  8. Example 1 p<1 case. (finite capacity)
  9. Example 1 p<1 case. (finite capacity)
  10. M/M/1 (∞) vs M/M/1 (N) — Formula Comparison Table

What is Queueing Theory?

Queueing theory is all about understanding systems where “customers” arrive, wait, get served, and leave.
Customers can be people, packets, jobs, tasks — anything that “queues”.

Now we all know what a queue is.

A queue is a linear data structure that follows the First-In, First-Out (FIFO) principle, meaning the first item added to the queue is the first one to be removed. Items are added to the rear of the queue (called enqueue) and removed from the front (called dequeue), much like people waiting in a line for a service.

Pasted image 20251113124859.png

So, what's with the new stuff then? Queueing Models, Poisson, λ, L, etc? Why do we need all this?

Case 1: M/M/1 (∞ / FIFO) Poisson Queueing Model.

Step 1: The need for Queueing Models

Think of queues in real life.
Are arrivals perfectly regular?

❌ No — people don’t arrive at exactly one every 10 seconds.
They come randomly: sometimes 2 people at once, sometimes no one for a minute.

Queueing Theory models random arrivals and random service times.

To describe randomness mathematically, we use a standard tool:

Poisson process → a way to model random arrivals.

And it uses one simple symbol:

λ (lambda) -- the average arrival rate

That’s it. No magic.


Step 2: Service time is also random

You cannot serve every customer in exactly 5 minutes.
Sometimes 4, sometimes 7, etc.

So, we define:

μ -- the average service rate

If μ = 12/hour  server can serve 12 customers per hour on average.

Again — nothing complicated.


Step 3: Why do we need utilization?

This is the most intuitive part.

Utilization just means:

How busy is the server?

This is answered by this formula:

p = λμ

Example:

Thus, p = 1012 = 0.833, the server is busy 83.3 % of the time.

Now,

If λ  μ, this means that customers arrive faster than they can be served, which makes the queue grow to infinity and the system breaks.

So the only condition for a working queue is:

μ > λ
(server must be faster than arrivals)


Step 4: The M/M/1 Queueing Model

M/M/1 literally means:

You do not need to study distributions deeply.
All you need to accept is:

Poisson arrivals + exponential service = simplest realistic queue model.


Step 5: Important Terminologies

These are just average quantities:

They are connected by the famous but simple:

Little's law

L = λW

If more customers arrive per hour, L increases.
If each customer spends more time in the system, L increases.
Simple.


Formula set for M/M/1 (∞ / FIFO)

Let λ be the arrival rate (customers per hour), μ be the service rate (customers per hour), p = λμ


Whoops. Too many formulae? Hell nah I myself am not memorizing all that, so let's simplify all this with the core formulae that we can use to build all these.

We need to remember 3 rules and 2 definitions.

Definition 1: λ is the arrival rate of customers per hour.
Definition 2: μ is the service rate of customers per hour.

Rule 1: The utilization of the server is given by the ratio of the arrival rate to the service rate of the customers per hour. (Or the average number of customers that are being served.)

Just “how busy the server is”.

Thus:

p = λμ

Now, for the probability that the system is empty, we can just get the value by subtracting it from 1:

P0 = 1  p = μ  λ

Then, the probability of n customers in system becomes:

Pn = P0 × pn = (1  p) × pn

Rule 2: Average number of customers in the system (This means the people waiting in the queue plus the one person that is being served (if there is one)). This one formula unlocks everything else.

Intuition:
If the server is almost full most of the time, L becomes large.
If server is fast compared to arrivals, L stays small.

L = p(1  p)

Rule 3: Little's Law!

L = λW

From here we can get the average time in system W:

W = Lλ

or:

W = p(1  p)λW = λμ(1  λμ)λW = λμ  λλW = λλ(μ  λ)W = 1μ  λ

Now, for the average number of customers waiting in queue (Lq):

We go back to the definition of L first:

L is the average number of customers in the system (This means the people waiting in the queue plus the one person that is being served (if there is one))

So,:

L = average waiting + average in service

or:

L = Lq + average in service

Fair so far. We are halfway there.

Now, for the average customers that is in service.

We know that the average number of customers that are being served is defined by p.

But why, a probability? Why p?

In an M/M/1 queue, the number of customers being served is either:

There is no other possibility.

So, the average number of customers in service become:

p (or ptotal) = 0 × pidle + 1 × pbusy

So, there we have p as the average number of customers that are being served. And the probability that there are no customers and the server is idle is P0 = 1  p . Simple.

So,

average in service = p

Plugging this back into our earlier structure:

L = Lq + pLq = L  pLq = p(1  p)  pLq = p  p + p2(1  p)

Finally:

Lq = p2(1  p)

Lastly, for the average waiting time in queue Wq:

This one is very symmetrical to W = Lλ from Little's law:

Wq = LqλWq = p2(1  p)λWq = p2λ(1  p)

Substituting λ = pμ,

Wq = p2pμ(1  p)Wq = pμ  μλμ

Finally:

Wq = pμ  λ

Example 1

Given arrival rate λ is 8 customers per hour, and the service rate μ is 12 customers per hour.

Find:

Solution:

(a) The utilization:

p = λμ = 812 = 0.66

(b) Probability that the server is empty (not being utilized):

1  p = 1  0.66 = 0.34

(c) Probability of 1 customer in the system n = 1.

P1 = (1  p)pn = (1  p)p = 0.66 × 0.34 = 0.2244

(d) Average number of customers in the system:

L = p(1  p) = 0.660.34 = 1.941

(e) Average waiting time of customers in the queue:

Lq = p2(1  p) = 0.43560.34 = 1.281

(f) Average time spent in the system:

From Little's law

L = λW  W = LλW = 1.9418 = 0.242

(g) Average waiting time in the queue:

Wq = LqλWq = 1.2818 = 0.1601

Short interpretation: server busy 66.7% of the time; on average 2 customers in system (1.333 waiting + 0.666 being served); each customer spends 15 min total, waiting 10 min.


Example 2

Given average waiting time in queue Wq = 16 hours or Wq = 0.166 hours, the service rate μ = 6 customers/hours,

Find:

(a) The arrival rate of customers:

From:

Wq = pμ  λ

and:

p = λμWq = λμ2  μλλ = Wq μ2  Wq μ λλ + Wq μλ = Wq μ2λ(1 + Wqμ) = Wq μ2λ = Wqμ2(1 + Wqμ)λ = 0.166 × 361 + (0.166 × 6)λ = 5.9761 + 0.996λ = 5.9761.996λ = 2.993  3 customers per hour

(b) Utilization rate:

p = λμ = 36 = 0.5

(c) Probability that the server is empty:

P0 = 1  p = 0.5

(d) Average number of customers in the system:

L = p(1  p) = 0.50.5 = 1

(e) Average waiting time of customers in the queue:

Lq = p2(1  p) = 0.250.5 = 0.5

(f) Average time spent in the system:

From:

L = λWW = LλW = 13 = 0.33

Interpretation: with those numbers, arrivals are half the service rate; average one customer in system (0.5 waiting, 0.5 in service); customers wait 10 minutes on average and spend 20 minutes total.


Case 2: M/M/1(N/FIFO)-- finite capacity queueing model

Short plain-English first: now the system can hold at most N customers (including the one in service).

If an arrival finds N customers already present, that arrival is blocked (lost). Everything else (Poisson arrivals, exponential service, FCFS), stays the same.


Key symbols/reminder


Two cases

p = 1, arrivals exactly equal to service

For the infinite M/M/1 queue, we reject ρ≥1 because the queue would blow up.

For the finite case, the queue cannot blow up, it's capped at N. So even if arrivals = service i.e. p = 1, the system stays stable because arrivals beyond N are rejected.

So, when p = 1,

Pn = P0 × pn = P0 (1n) = P0

All probabilities become equal.

But we still need them to sum to 1:

P0 + P1 +  + PN = 1

That's:

(N + 1)P0 = 1P0 = 1N + 1Pn = 1N + 1, n = 0, 1, , N

And for p < 1 it's all the more acceptable since the arrivals are slower than the service system, so the system stays stable.


Numerical solving.

Alright now since I am pressed for time, I will stop with the theoretical explanations here and skip ahead to how to solve numericals of the finite case using only 4 formulae.

One master formula:

Utilization for n customers:

Pn = pnk = 0Npk

One arrival formula:

Effective arrival:

λeff = λ(1  PN)

One average formula

Average number of customers in the system

L = n = 0NnPn

Little's law (same as infinite queue case)

W = Lλ

and:

Wq = Lqλeff

and:

Lq = L  (1  P0)

Example 1: p < 1 case.

Given arrival rate = 3 customers per hour, service rate = 5 customers per hour and max system capacity = 4 customers.

Find:

So, we have:

λ = 3
μ = 5
N = 4

(a) Utilization:

ρ = 35 = 0.6

(b) Utilization for all customers ranging from none (system empty) to the max system capacity (N):

From:

Pn = pnk = 0Npk

Computing the denominator first:

k = 040.6k = p0 + p1 + p2 + p3 + p4k = 040.6k = 1 + 0.6 + 0.36 + 0.216 + 0.1296 = 2.3056

So,

Pn = 0.6n2.3056

The blocking probability is PN = P4 = 0.05619 i.e. the probability of utilization of the server when any further arrivals in the queue will be lost/rejected.

(c) Effective arrival

λeff = λ(1  PN)λeff = 3(1  P4) = 3(1  0.05619)λeff = 2.8314

(d) Average number of customers in the system:

L = n = 0NnPn

Here n starts from zero and proceeds till N times.

So,

L = n = 04nPn = 0  P0 + 1  P1 + 2  P2 + 3  P3 + 4  P4L = 0 + 0.2601 + 2(0.1561) + 3(0.09365) + 4(0.05619)L = 1.07796

(d) Average time spent waiting by customers in the queue:

Lq = L  (1  P0) = 1.07796  (1  0.4336)Lq = 1.07796  0.5664Lq = 0.51156

(e) Average time spent in the system:

W = LλeffW = 1.077962.8314 = 0.3807 hr

(f) Average time spent in the queue:

Wq = LqλeffWq = 0.511562.8314Wq = 0.1807 hr

Example 2: p = 1 case

Given arrival rate = 4 customers per hour, service rate = 4 customers per hour and max system capacity = 3 customers.

Find:

So, we have:

λ = 4
μ = 4
N = 3

(a) Utilization:

ρ = 44 = 1

(b) Utilization for all customers ranging from none (system empty) to the max system capacity (N):

From:

Pn = pnk = 0Npk

Computing the denominator first:

k = 031k = p0 + p1 + p2 + p3 k = 041k = 1 + 1 + 1 + 1 + = 4

So,

Pn = 1n4

The blocking probability is PN = P3 = 0.25 i.e. the probability of utilization of the server when any further arrivals in the queue will be lost/rejected.

(c) Effective arrival

λeff = λ(1  PN)λeff = 4(1  P3) = 4(1  0.25)λeff = 3

(d) Average number of customers in the system:

L = n = 0NnPn

Here n starts from zero and proceeds till N times.

So,

L = n = 03nPn = 0  P0 + 1  P1 + 2  P2 + 3  P3 L = 0 + 0.25 + 2(0.25) + 3(0.25) L = 1.5

(d) Average time spent waiting by customers in the queue:

Lq = L  (1  P0) = 1.5  (1  0.25)Lq = 1.5  0.75Lq = 0.75

(e) Average time spent in the system:

W = LλeffW = 1.53 = 0.5 hr

(f) Average time spent in the queue:

Wq = LqλeffWq = 0.753Wq = 0.25 hr

M/M/1 (∞) vs M/M/1 (N) — Formula Comparison Table

Just as a final summary.

Concept M/M/1 (Infinite capacity) M/M/1 (Finite capacity, max = N)
Utilization ρ=λμ ρ=λμ
State probabilities Pn=(1ρ)ρn Pn=ρnk=0Nρk
Probability of empty system P0=1ρ P0=1k=0Nρk
Blocking probability Not applicable (no blocking) PN
Effective arrival rate λeff=λ λeff=λ(1PN)
Avg. number in system L=ρ1ρ L=n=0NnPn
Avg. number in queue Lq=ρ21ρ Lq=L(1P0)
Avg. time in system W=Lλ=1μλ W=Lλeff
Avg. waiting time in queue Wq=Lqλ=ρμλ Wq=Lqλeff
Stability requirement λ<μ (must hold) Always stable (capacity finite)
Little’s Law L=λW, Lq=λWq $L = \lambda_{\text{eff}} W $, $ L_q = \lambda_{\text{eff}} W_q$