Get the latest tech news

Understanding the Go Runtime: The Scheduler


In the previous article we explored how Go’s memory allocator manages heap memory — grabbing large arenas from the OS, dividing them into spans and size classes, and using a three-level hierarchy (mcache, mcentral, mheap) to make most allocations lock-free. A key detail was that each P (processor) gets its own memory cache. But we never really explained what a P is, or how the runtime decides which goroutine runs on which thread. That’s the scheduler’s job, and that’s what we’re exploring today.

None

Get the Android app

Or read this on Hacker News

Read more on:

Photo of runtime

runtime

Photo of scheduler

scheduler

Related news:

News photo

Show HN: I made a zero-copy coroutine tracer to find my scheduler's lost wakeups

News photo

Understanding the Go Runtime: The Memory Allocator

News photo

PromptSpy is the first known Android malware to use generative AI at runtime