Recover Little's law from an event log
CodingIntermediate⏱ 1 hourAI Systemslittle's lawevent logoccupancymeasurement
Problem
Given arrival and departure timestamps for a set of requests, reconstruct the three quantities in Little's law and verify the identity numerically.
number_in_system(arrivals, departures, times)— occupancy at each queried instant, with an item present on .time_average_number(arrivals, departures)— the exact time-average occupancy over with the last departure, computed from the area identity rather than by sampling.littles_law_check(arrivals, departures)— returning , , and the residual .
The residual should be zero to machine precision, not merely small.
Implement it, then check the implementation against something you can verify independently.
Write it
Solve it here7 tests · Python runs in your browser
⌘/Ctrl + ↵ to run · limit 60s · draft saved in this browser
7 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 |
|---|---|---|---|---|---|
| Apply Little's law to a serving target | LLM Ops | Proof | 30 min | ||
| Prove Little's law on a finite horizon | AI Systems | Proof | 1 hour | ||
| Simulate M/M/1 and verify the utilisation wall run | AI Systems | Coding | 1 hour |