CMP338 Simulation and Modeling

Simulation and ModelingUnit 312 min read

Queuing Systems: Models, Metrics & Applications

Unit 3 of Simulation and Modeling explores queuing theory fundamentals—arrival processes, service mechanisms, performance metrics (Little’s Law, utilization), and real-world applications in computer systems, banking, and logistics. Learn to model M/M/1, M/M/c, and priority queues, then analyze their efficiency under di

What is a Queuing System?

A queuing system (or waiting-line system) is a mathematical model of real-world scenarios where entities (customers, tasks, data packets) arrive, wait in a queue, receive service, and depart. It consists of three key components:

  1. Arrival process: How entities enter the system (e.g., customers at a bank, jobs in a CPU).
  2. Queue discipline: Rules for ordering entities in the queue (FIFO, LIFO, priority).
  3. Service mechanism: How entities are processed (e.g., single-server vs. multi-server).

Visual: Basic Queuing System Structure

flowchart LR
    A["Arrival Process\n(Poisson arrivals)"] --> B["Queue\n(Buffer)"]
    B --> C["Service Facility\n(Single/Multi-server)"]
    C --> D["Departure Process"]
    D -->|"Feedback"| A

Real-world analogy: A Khalti payment queue at a Daraz checkout.

  • Arrival: Customers (orders) arrive randomly (Poisson process).
  • Queue: Unpaid orders wait in a virtual queue.
  • Service: Khalti’s servers process payments one by one (single-server, M/M/1).
  • Departure: Paid orders leave the system.

Key Components of a Queuing System

Arrival Process (λ)0Queue Discipline (FIFO)1Service Mechanism (μ)2System Capacity (K)3
Core components of a queuing system (M/M/c/K notation)

1. Arrival Process

Describes how entities enter the system. The most common model is the Poisson process:

  • Arrivals are independent (one customer’s arrival doesn’t affect another’s).
  • Constant average arrival rate (λ = arrivals per unit time).
  • Exponential inter-arrival times (time between arrivals follows an exponential distribution).

Example: Ncell customer calls arrive at an average rate of λ = 12 calls/hour.

  • Probability of 0 calls in 5 minutes = (36.8% chance).

2. Service Mechanism

Describes how entities are served. Common types:

Type Description Example
Single-server One entity is served at a time (M/M/1). Bank teller, Pathao driver
Multi-server Multiple servers work in parallel (M/M/c). NTC call center (10 agents)
Finite queue Queue has a fixed capacity (M/M/1/K). Hospital emergency room (20 beds)
Infinite queue Queue can grow indefinitely (M/M/1). YouTube video uploads

Visual: M/M/1 vs. M/M/c

QueueServer 1Server 2Server c
M/M/1 (left) vs. M/M/c (right): Single vs. parallel servers

3. Queue Discipline

Rules for ordering entities in the queue:

  • FIFO (First-In-First-Out): Oldest entity is served first (most common).
  • LIFO (Last-In-First-Out): Latest entity is served first (rare in real systems).
  • Priority: High-priority entities jump the queue (e.g., emergency patients).
  • Random: Entities are served in random order (uncommon).

Example: NEPSE stock trading system uses priority queues for high-frequency traders.


Performance Metrics

Key metrics to evaluate queuing systems:

Metric Formula Meaning
Utilization (ρ) Fraction of time the server is busy (ρ < 1 for stability).
Average queue length (Lq) Expected number of entities waiting in the queue.
Average waiting time (Wq) Time an entity spends waiting before service.
Average system time (Ws) Total time in the system (waiting + service).

Little’s Law: Relates the three key metrics:

  • : Average number of entities in the system.
  • : Arrival rate.
  • : Average time an entity spends in the system.

Worked Example: Daraz Delivery Queue

  • Arrival rate (λ): 20 orders/hour.
  • Service rate (μ): 25 orders/hour (one delivery agent).
  • Utilization (ρ): .
  • Average queue length (Lq): orders waiting.
  • Average waiting time (Wq): hours = 9.6 minutes.

Visual: Daraz Delivery Queue Metrics

02.44.87.29.6Waiting Time (9.6 min)9.6Service Time (2.4 min)2.4Time (minutes)
Daraz Delivery Queue: 9.6 min wait vs. 2.4 min service (λ=20/hr, μ=25/hr)

Common Queuing Models

1. M/M/1 Queue

  • M: Markovian (Poisson arrivals, exponential service times).
  • M: Markovian service.
  • 1: Single server.

Steady-state probabilities: where .

Example: eSewa Customer Support

  • λ = 15 calls/hour, μ = 20 calls/hour.
  • ρ = 0.75.
  • Probability of 0 calls in the system: (25%).
  • Probability of ≥3 calls waiting: (42.19%).

2. M/M/c Queue

  • c: Multiple servers (e.g., NTC call center with 5 agents).

Utilization per server: . Average queue length: where is the probability of an empty system.

Example: NTC Call Center

  • λ = 30 calls/hour, μ = 10 calls/hour/agent, c = 4 agents.
  • ρ = 30 / (4 × 10) = 0.75.
  • Lq ≈ 1.875 calls waiting on average.

3. M/M/1/K Queue (Finite Capacity)

  • K: Maximum queue size (e.g., hospital with 10 beds).

Blocking probability: Probability a new arrival is rejected.

Example: Kathmandu Traffic Light System

  • Assume a single "server" (green light) with:
    • λ = 20 cars/minute, μ = 25 cars/minute, K = 5 cars.
  • ρ = 20/25 = 0.8.
  • Probability of blocking (6th car arrives when 5 are waiting): (26.2%).

Applications in Real World

1. E-Commerce: Daraz Order Fulfillment

  • Queuing model: M/M/c (multiple warehouses = servers).
  • How it works:
    • Orders arrive as Poisson processes (λ).
    • Warehouses process orders at rate μ per server.
    • Goal: Minimize (delivery delay) by optimizing (number of warehouses).
  • Real impact: Daraz uses priority queues for high-value orders (e.g., electronics) to reduce .

2. Telecom: Ncell Network Traffic

  • Queuing model: M/M/1 (base station tower as a single server).
  • How it works:
    • Calls arrive at rate λ (e.g., 50 calls/hour/tower).
    • Tower processes calls at rate μ (e.g., 60 calls/hour).
    • Problem: If ρ > 1, calls are dropped (network congestion).
  • Real impact: Ncell uses dynamic ρ monitoring to reroute calls during peak hours (e.g., 6–9 PM).

3. Banking: Khalti Transaction Processing

  • Queuing model: M/M/c (multiple Khalti servers).
  • How it works:
    • Transactions arrive as Poisson (λ = 1000 transactions/hour).
    • Servers process at μ = 500 transactions/hour/server.
    • Optimization: Khalti scales (servers) during Diwali sales to keep < 2 seconds.

4. Healthcare: Patan Hospital Emergency Room

  • Queuing model: M/M/1/K (finite beds, K = 20).
  • How it works:
    • Patients arrive at λ = 15/hour.
    • Doctors serve at μ = 10/hour.
    • Critical metric: (patients turned away due to full beds).
  • Real impact: Hospital uses priority queues (triage system) to reduce for critical cases.

Worked Example: Pathao Driver Assignment

Scenario: Pathao has 10 drivers (servers) in Kathmandu. Riders request rides at an average rate of λ = 12 rides/hour. Each driver can accept μ = 2 rides/hour.

RequestDriver Pool (5)DispatchCustomer
Pathao’s M/M/c/K system: 5 drivers (c=5), max 10 requests (K=10)
  1. Calculate utilization per driver (ρ): (Each driver is busy 60% of the time.)

  2. Average number of riders waiting (Lq): For M/M/c, use the formula: First, compute : Plugging in values: Now, :

  3. Average waiting time (Wq):

Conclusion: Pathao’s system is efficient, with riders waiting only 1.6 minutes on average. To reduce wait times further, Pathao could:

  • Increase (hire more drivers).
  • Optimize (train drivers to accept rides faster).

Advantages and Disadvantages of Queuing Systems

Advantages Disadvantages
Predictable performance: Metrics like and help plan resources. Complexity: Requires statistical knowledge (Poisson, exponential distributions).
Cost-effective: Optimizes server usage (e.g., Ncell call centers). Delays: Long queues increase customer dissatisfaction (e.g., Daraz delivery delays).
Scalability: Can model systems with varying (servers). Assumptions: Real systems often violate Markovian properties (e.g., bursty traffic).
Decision support: Helps prioritize (e.g., emergency patients in hospitals). Implementation cost: Requires simulation tools (e.g., AnyLogic, MATLAB).

Exam Tip

What Examiners Look For

  1. Correct notation: Always define , , , , and clearly.
  2. Model selection: Identify whether the system is M/M/1, M/M/c, or M/M/1/K and justify your choice.
  3. Little’s Law: Use it to relate , , and . Many questions test this directly.
  4. Numerical accuracy: Show all steps in calculations (e.g., computing for M/M/c).
  5. Real-world tie-ins: Relate queuing theory to Nepalese examples (e.g., NTC, Khalti, Daraz) to earn extra marks.

Common Pitfalls

  • Ignoring stability: If , the queue grows infinitely—always check .
  • Wrong formula: Mixing up and , or and .
  • Unit mismatches: Ensure and are in the same time units (e.g., per hour, per minute).

Sample Exam Question

*"A bank has a single teller (M/M/1) with arrival rate λ = 10 customers/hour and service rate μ = 12 customers/hour. Calculate:

  1. The utilization factor (ρ).
  2. The average number of customers in the queue (Lq).
  3. The average waiting time (Wq). Assume the bank opens at 9 AM. If 5 customers arrive by 9:05 AM, what is the probability that all are served by 9:10 AM?"*

Solution Outline:

  1. .
  2. .
  3. hours = 25 minutes.
  4. Probability all 5 are served by 9:10 AM:
    • Time available: 5 minutes.
    • Service time per customer: minutes.
    • Probability all 5 finish in 5 minutes: 0 (since 5 × 5 = 25 minutes > 5 minutes).
    • Correction: Use exponential service times. Probability a customer is served in ≤5 minutes: . For 5 independent customers: (63%).

Based on the PU BE Computer (PU) syllabus for Simulation and Modeling (CMP338), unit 3.

Discussion

Loading…