A mobile UI must redraw roughly every 16.67 ms to hold 60 fps — that budget is the entire life of one frame:
frame_budget = 1000 / 60 ≈ 16.67 ms
dropped_frames(task) = ⌊cost_ms / 16.67⌋ − 1 (task run on the main thread)
Unlike a fixed-cost visualisation, this lab treats task arrival and task cost as random processes, the way real queueing theory analyses schedulers: new tasks arrive as a Poisson process (exponential inter-arrival times, mean rate λ) and each task's cost is drawn from an exponential distribution with the configured mean. Routed to the main thread, that is a textbook M/M/1 queue — one server, unbounded FIFO queue. Routed to the pool, it is an M/M/c queue — a single shared FIFO queue feeding c identical parallel servers, exactly the model used to size real thread-pool executors:
M/M/1: ρ = λ/μ L_q = ρ²/(1−ρ) W_q = L_q/λ
M/M/c: a = λ/μ ρ = a/c L_q = C(c,a)·ρ/(1−ρ) W_q = L_q/λ
Erlang-C: C(c,a) = [aᶜ/c!·1/(1−ρ)] / [ Σ_{k=0}^{c−1} aᵏ/k! + aᶜ/c!·1/(1−ρ) ]
The theoretical ρ and L_q boxes are computed live, directly from these closed-form formulas, from whichever destination is currently receiving new tasks. The simulation runs completely independently — its own discrete-time stepping with real exponential random draws — so the "measured utilization" and observed queue length in the diagram are an empirical check against the formula, not the formula's output. They should track each other closely once enough tasks have passed through (a fresh reset starts both from zero and lets you watch them converge).
- Mean task cost — the average of the exponential service-time distribution (e.g. JSON parsing, a DB query, image decoding).
- Mean spawn rate λ — the average of the exponential inter-arrival distribution feeding whichever destination is selected below.
- Worker pool size c — number of parallel servers sharing the pool's single incoming queue (join-the-shared-queue, not per-worker queues).
- If ρ ≥ 1 the queue is theoretically unstable (it grows without bound) — the readout flags UNSTABLE and the diagram's queue is capped for rendering, exactly as a real device would eventually run out of memory for backlogged work.
Note on realism: the original 3D version of this simulator used a deterministic task cost and a fixed spawn interval (not random), which makes its "frame budget" math simpler but not a faithful queueing-theory model — real task costs and real arrival timings vary. This 2D lab instead implements the actual M/M/1 / M/M/c stochastic model that queueing theory (and real thread-pool capacity planning) is built on, verified numerically against the Erlang-C formula above.