Pick a depth. Each prompt opens in your AI pre-loaded with the lesson. Click a row to preview the prompt.
The scheduler is the hidden arbiter of every concurrent program — it decides who runs next, for how long, and when preemption happens. In a preemptive scheduler (OS threads, Go runtime, JVM), the running task can be interrupted at any point; you must assume any shared variable can change between two lines of code. In a cooperative scheduler (async/await, Node.js event loop), the running task yields only at explicit await points — between yields, nothing else runs, which makes some concurrency bugs impossible but means one infinite loop freezes everything. Understanding which scheduler governs your code tells you what guarantees you have and what bugs are even possible.
Two flavors:
Preemptive (OS threads, most modern runtimes): the scheduler interrupts a running task at any point and switches. The running task has no say in it. Safe, but you must assume any variable can change underneath you.
Cooperative (async/await, coroutines): the running task has to explicitly yield (usually via await). Between yields, nothing else runs. Predictable — but one misbehaving task can freeze everything.
await boundaries, not between arbitrary lines.