Member-only story
Priority-Based Task Scheduling: The Android Interview Topic Everyone Underestimates
Not a Medium Member? “Read For Free”
Picture a mid-range Android phone, throttling under heat, running an e-commerce app. In the space of one second, five things want the CPU at once:
- An analytics SDK flushing 80 tracking events to disk and network.
- Glide firing off 12 image decodes because the user just flung a RecyclerView.
- A foreground network call fetching inventory status for the item the user tapped.
- An FCM handler quietly parsing a silent sync payload.
- WorkManager kicking off routine database maintenance.
If your execution layer is a plain FIFO queue, the only task the user actually cares about — the inventory check — sits behind dozens of analytics writes and stale image decodes. The UI stutters, the network call blows its latency budget, and the user leaves.
That scenario is the entire argument for priority-based scheduling: naive FIFO queues buckle under contention, and priority queues are the architectural fix — the same fix that powers OkHttp’s Dispatcher, WorkManager's constraint engine, and Glide's image pipeline.









