Learning paths / Under the scheduler

Under the scheduler

The GIL, virtual threads, a starved pool, preemption, and who gets the P.

Start: step 1

6 steps · progress is saved in this browser

  1. Why Python threads don't run in parallel (the GIL)Python · BasicsTwo threads crunch numbers. They take turns holding the GIL, so only one core is ever busy.
  2. threading vs multiprocessing vs asyncioPython · BasicsTwo jobs, each a network fetch and then CPU work. With threads, the fetches overlap but the CPU work takes turns on the GIL.
  3. Virtual threadsJava · AdvancedThree virtual threads share two real (carrier) threads. When one blocks, it steps off its carrier so another can run.
  4. When parallelStream starves the common poolJava · AdvancedA parallel stream of blocking calls fills the common pool. An unrelated quick task waits in line behind it.
  5. Can a busy loop starve other goroutines?Go · AdvancedOne P, and main spins in a loop with no function calls. The runtime still interrupts it, so the ticker gets its turns.
  6. Who gets the P when a goroutine blocks in a syscall?Go · Advancedmain blocks in read() on a plain pipe. Its OS thread waits in the kernel, and Go hands the P to another thread so the ticker keeps running.

All learning paths · All scenarios