Explain the G-M-P scheduling model in Go. What do G, M, and P represent, and how do they interact to handle work-stealing?

Last updated 20 June 2026

  • G is a goroutine (unit of work), M is an OS thread, and P is a logical processor holding a local run queue. The P count is set by GOMAXPROCS and an M must hold a P to run Gs.

  • When a G blocks in a syscall, its M detaches and the P is handed to another M so other goroutines keep running.

  • Work-stealing: a P with an empty queue steals half the Gs from another P (or checks the global queue) to keep all processors busy.

  • https://salestalentinc.com/software-development-recruiters/
  • https://bencheung.me/intern-newgrad-guide
  • https://www.jobfluent.com/feeds/jobs-london.xml
  • https://www.reddit.com/r/leetcode/comments/1e3ca3q/microsoft_senior_swe_interview_experience_with/
  • https://www.lockedinai.com/company-details/HPQ
  • https://www.reddit.com/r/rust/comments/1h15md8/goodbye_rust_i_wish_you_success_but_im_back_to_c/
  • https://www.reddit.com/r/golang/comments/1gfjnzm/since_when_is_senior_golang_developer_expected_to/
All Golang interview questions