seniorGolang

Explain the Go Scheduler's M:P:G model.

Updated Apr 28, 2026

Short answer

The Go runtime uses an M:P:G model to multiplex millions of Goroutines onto a limited number of OS threads.

Deep explanation

M represents an OS Machine (thread). P represents a Processor (context/runqueue). G represents a Goroutine. The number of Ps is determined by GOMAXPROCS. Each P holds a local queue of Gs and is attached to an M. If an M blocks on an OS system call, the P detaches and binds to a different M. If a P's queue empties, it 'work steals' half the Gs from another P's local queue.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Golang interview questions

View all →