Why this matters
Every checkout line, help desk, and ride queue is a small system you can model. Once you can work out when each customer starts service and how long they wait, you can answer real questions: who waits longest, and when is the line at its worst? This is the everyday side of simulation.
The idea
A queue is a line of customers waiting for a service. To analyze it, track each customer with a few timestamps.
The key rule is when service starts:
- If the register is free (no queue), service starts the moment the customer arrives.
- If someone is ahead, service starts when that previous customer finishes.
From there:
- Service end time = service start time + service duration.
- Waiting time = service start time − arrival time.
So a customer who arrives to an empty register waits 0 minutes, while one who arrives behind a busy register waits until everyone ahead has cleared. The queue is longest during the stretch when the most people are simultaneously waiting.
Picture it
flowchart TD
A[Customer arrives] --> Q{Anyone ahead?}
Q -->|No| S1[Service starts at arrival time]
Q -->|Yes| S2[Service starts when previous customer finishes]
S1 --> E[End time = start + service duration]
S2 --> E
E --> W[Waiting time = start time - arrival time]
Worked example
A store serves each customer in 40 minutes, and customers 1–4 arrive 20 minutes apart (at 0, 20, 40, 60). Customer 1 arrives to an empty register, so service starts at 0 and waiting time is 0. Customer 2 arrives at 20 but customer 1 is busy until 40, so service starts at 40, a 20-minute wait. Customer 3 arrives at 40, waits until 80 to start (40 min wait), and customer 4 arrives at 60 but starts at 120, waits 60 min and finishes at 160, so 100 minutes from arrival to done. The longest wait is customer 4's, and the queue is longest from 60 to 80 minutes, when customers 2, 3, and 4 are all in line.
Your turn
Try the practice questions: pick the right formula for each timestamp and reason about a worked queue.
Recap
- A queue is a waiting line; analyze it with arrival, start, and end times.
- Service starts at arrival if free, otherwise when the previous customer finishes.
- End = start + service duration; waiting time = start − arrival.