Simulate M/M/1 and verify the utilisation wall
CodingIntermediate⏱ 1 hourAI Systemssimulationqueueinglittle's lawutilisation
Problem
Implement the closed forms for M/M/1 and a discrete-event simulation of the same queue, then check they agree.
theoretical_mm1(lam, mu)returning , , and .simulate_mm1(lam, mu, n_requests, seed)returning the same four quantities measured from a first-come-first-served simulation.
Measure from the simulation independently — as the time-average occupancy — rather than computing it as . Little's law should then fall out of the measurements as a check, instead of being assumed.
Implement it, then check the implementation against something you can verify independently.
Write it
Solve it here8 tests · Python runs in your browser
⌘/Ctrl + ↵ to run · limit 90s · draft saved in this browser
8 tests will run against your code. The first run downloads the Python runtime — several megabytes, once per browser.
Hints
Hints — 0 of 2 revealed
Solution
Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.
Related problems
All problems| Solved | Problem | Field | Type | Difficulty | Time |
|---|---|---|---|---|---|
| Simulate distance contrast run | Classical ML | Coding | 30 min | ||
| Apply Little's law to a serving target | LLM Ops | Proof | 30 min | ||
| Balls into bins, with one choice and with two run | AI Systems | Coding | 1 hour | ||
| Cache hit rates under Zipf popularity run | AI Systems | Coding | 1 hour | ||
| Derive the M/M/1 queue from detailed balance | AI Systems | Proof | 1 hour |