QuizNot attempted
Microtask starvation
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- The browser drains the whole microtask queue before it renders or takes the next task, so new microtasks keep it from ever reaching rendering
- After every task the event loop drains the microtask queue until it is EMPTY, including microtasks queued while draining, so an endless chain never lets the loop reach rendering or input
- each
setTimeoutcallback is a separate task, and the browser can render between tasks. - Not 'timers run on another thread': timer callbacks run on the main thread too, only the countdown is elsewhere.
- Not '1 call per second': nested timers are clamped to about 4ms, not 1s.
- Not OS CPU priority: it is event-loop ordering, the OS scheduler isn't involved.