Skip to content
Opensource internals
  • Posts

Scheduler

entersyscall: How Go Hands the P to the Kernel and Gets It Back

Oct 21, 2026 21 min read Jay Hubbert

entersyscall marks the G as _Gsyscall but keeps its P, exitsyscall reacquires a P or parks the goroutine, and sysmon’s retake loop yanks the P away roughly 20 microseconds into a …

GoInternalsSchedulerSyscallsConcurrency

Read more →

Go's Scheduler Steals Half-Idle Cores: Work Stealing, Spinning and the Global Run Queue

Oct 21, 2026 15 min read Jay Hubbert

Each P owns a 256-entry run queue plus a global overflow queue; idle Ms spin, steal half a victim’s queue at a time, and only park after the delicate dance that avoids losing work.

GoInternalsSchedulerConcurrencyPerformance

Read more →

Go's Timers: A Per-P Heap and a Timer That Never Blocks a Thread

Oct 21, 2026 24 min read Jay Hubbert

Timers are heap entries owned by a P, checked by the scheduler at the top of every round; a sleeping goroutine parks on a timer attached to its own g, and no OS thread is ever …

GoInternalsTimersSchedulerConcurrency

Read more →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·