Frame-Budget Queueing Lab: M/M/1 vs M/M/c
A 2D queueing-theory model of a mobile app's main thread and background worker pool: Poisson task arrivals and exponential service times, with live M/M/1 and M/M/c (Erlang-C) formulas verified in real time against a running discrete-time simulation.
Every mobile app balances the same trade-off: work done on the UI thread blocks the next frame, while work handed to a background thread pool runs in parallel without ever touching the screen. This lab models that trade-off with genuine queueing theory instead of a fixed-cost visualisation: tasks arrive as a Poisson process and each one's cost is drawn from an exponential distribution, so the main thread behaves as a textbook M/M/1 queue and the worker pool as an M/M/c queue with a single shared queue feeding c parallel servers. Live readouts show the closed-form theoretical utilization (ρ) and mean queue length (L_q, from the Erlang-C formula) side by side with the same quantities measured directly from the running simulation, so you can watch an empirical scheduler converge to its analytic prediction in real time — while a spinning app-icon freezes exactly when the main thread is busy, visualizing "jank" under the same 16.67 ms frame-budget arithmetic that GCD dispatch queues, Android Executors and Kotlin coroutine dispatchers are built around.
A 2D queueing-theory model of a mobile app's main thread and background worker pool: Poisson task arrivals and exponential service times feed an M/M/1 queue (main thread) or a shared M/M/c queue (worker pool), with live Erlang-C and M/M/1 formulas verified in real time against a running discrete-time simulation.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install