Simulate systems over timeLesson 41 of 76 · 9 min
A queue remembers earlier arrivals
Compute waiting times using arrival and service timelines.
A queue’s wait is not just its service duration. A customer may arrive while earlier work still occupies the server. For one first-come-first-served server, service starts at the later of the arrival time and the previous completion.
Each row is one sequence of one hundred customers, initially empty. Inter-arrival time is the gap between arrivals. With arrival rate λ and mean service work m, arriving work per time unit is λm. One server has capacity 1; if λm exceeds 1, backlog grows on average. The example starts below that load.
A steady state is a distribution of queue conditions that no longer changes with time; it requires stability and is not guaranteed by a finite run. At arrival rate 1.1 and mean service time 1, arriving work exceeds capacity. Compare longer horizons, keeping initial state and unfinished work explicit. Waits within a trace share queue state, so use independent trace summaries for error estimates.
For customer i, is arrival time, service duration, start time, finish time and wait. The previous customer's finish is .
- Arrival
- Service can start
- Finish and wait
Can waiting increase even when the service-time distribution stays unchanged?
Write a prediction (optional)
Seeded teaching simulation
Select Run Python below with the code unchanged.
A saved draft is open. To run the published example, open Tools and select Restore example. Recover draft brings your code back.
Execution error
Technical error details
Your result
Published example output
This result comes from the original Python. Your runs appear above. Build environment ↗
Mean customer wait (minutes): 3.054 P(customer wait > 5 minutes): 0.2201 Mean of final customer's wait: 3.619
Read the first result
Customers within one trace share queue state and are not independent samples. Use independent trace summaries for a run-level uncertainty calculation.
Try an edit
Replace arrival_rate, service_mean = .8, 1.0 with arrival_rate, service_mean = 1.1, 1.0 and run. Then replace trials, customers = 1000, 100 with trials, customers = 1000, 300. Select Run Python again. Compare Mean of final customer's wait at the longer and shorter horizons. The short run begins with an empty queue. Why can it understate how long overloaded queues will make later customers wait?
Scope. This is a finite single-server model with exponential arrivals and services, not a calibrated staffing recommendation.
Try a fresh case
Why are successive waiting times in one queue trace usually dependent?
Need a hint?
Hint 1
Track the previous completion time.
Hint 2
Ask what a slow service leaves for the next customer.