Go runtime ஆனது பல goroutines-ஐ சிறிய எண்ணிக்கையிலான OS threads-இல் multiplex செய்யும் ஒரு scheduler-ஐ உள்ளடக்கியுள்ளது. இந்த M:N scheduling (N OS threads-இல் M goroutines) ஆனதே goroutines-ஐ மிகவும் மலிவாகவும், Go-வின் concurrency-ஐ மிகவும் scalable-ஆகவும் ஆக்குகிறது. அதைப் புரிந்துகொள்வது goroutine performance-ஐ விளக்குகிறது.
G-M-P model
G (Goroutine) — your concurrent task (lightweight, ~2KB stack to start)
M (Machine) — an OS thread (the actual thread the OS schedules)
P (Processor) — a logical processor / scheduling context; holds a queue of runnable Gs
(the number of P's = GOMAXPROCS, default = number of CPU cores)
The scheduler runs G's on M's, coordinated through P's:
Each P has a local run queue of goroutines; an M must hold a P to run G's.
