Go Runtime Scheduler Deep Dive
Understanding how Go's M:N threading model manages goroutines and system threads
Runtime scheduler distributes the go-routines onto the available system threads.
M x n
, where M is a shit ton of go routines, and N can be 16 threads, 24, 32, I’m assuming based on cores. Again not sure what the exact difference between threads and cores is.
Go’s Runtime Scheduler: ![[Pasted image 20250816174810.png]]
- Process = Isolated context with own memory, stack, program code
- Thread = Sequence of execution within a process, shares memory/code (but seperate program counter, registers, stack) with other threads in same process
In Golang’s scheduler, each processor will have a local queue.