Execution — bi-11-scheduling
Steps extracted from CONCEPTS.md. Read the concepts first; this file is the doing.
Record results in observation.md; tick checkpoints in verification.md.
6. Lab
- Priority inversion experiment. Post work at several
scheduler.postTaskpriorities plussetTimeoutandMessageChannel. Register a click handler. Measure ordering and input delay under a synthetic main-thread load. Predict the ordering first. - Yield-cost curve. Take a 200 ms computation. Chunk it yielding every 0.5/5/50 ms via
MessageChannel, then viascheduler.yield(). Plot total time and p75 input delay. Find where each curve turns. - rAF vs timer. Animate with both under load. Measure frame alignment and dropped frames.
- Continuation priority. Construct a case where
MessageChannelyielding loses to unrelated tasks andscheduler.yield()does not. This is the experiment that proves why the API exists. - Throttling. Measure timer behaviour in a hidden tab and a hidden cross-origin iframe.
Deliverable: the two plots from (2) and (4), plus a recommendation you would give a platform team about which yielding primitive to standardise on — including its failure mode.
7. Failure Lab
- Recursive
queueMicrotask— freeze the tab. Confirm the debugger cannot break in cleanly, and explain why in terms of the checkpoint. - Starve rendering with a chain of high-priority tasks. Find where anti-starvation kicks in.
- Write a long task that delays a click by >300 ms. Reduce it to <50 ms without making the total work faster. State exactly what you changed.
8. Debugging Exercise
- Perfetto with
toplevel+blink+cc: identify task boundaries, the microtask checkpoint, and the rendering opportunity in one trace. - Find a long task and attribute it to a task queue/source.
- Correlate a
TRACE_EVENTname from the trace back to its source (bi-01, rung 3 → rung 1). - Observe a frame that produced no rendering. Explain why not.