Infnite Async Loops
What this preview is
Infnite Async Loops is a hard quant interview question on language knowledge in Rust, asked at Quant.
- Difficulty
- Hard
- Topic
- Language Knowledge
- Discipline
- Quant development
- Language
- Rust
- Companies
- 0
Understanding task scheduling in single-threaded Tokio with busy listeners
This is a hard Rust question that tests deep knowledge of async runtime behavior, specifically how Tokio's executor schedules tasks on a single thread when some tasks are in tight loops. The question probes whether you understand the difference between fairness in task scheduling and the mechanics of when control actually transfers between tasks.
To reason through this, you need to understand how Tokio's work-stealing scheduler operates, what happens when a task never yields the thread, and the role of await points in enabling preemption. The answer hinges on recognizing that a task continuously receiving Poll::Ready may never suspend—and what that means for other spawned tasks in a single-threaded runtime.
- Task scheduling and fairness in async executors
- The relationship between
Poll::Ready,Poll::Pending, and yields - Single-threaded vs. multi-threaded Tokio runtime behavior
- Busy-waiting and resource starvation in async code
Related practice
Unlock full access to getcracked
Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.