Go রানটাইমে একটি শিডিউলার অন্তর্ভুক্ত রয়েছে যা অনেক গোরুটিনকে কম সংখ্যক OS থ্রেডে মাল্টিপ্লেক্স করে। এই M:N শিডিউলিং (M গোরুটিন N OS থ্রেডে) গোরুটিনগুলিকে এত সাশ্রয়ী এবং Go এর সমসাময়িকতাকে এত স্কেলেবল করে তোলে। এটি বোঝা গোরুটিন পারফরম্যান্স ব্যাখ্যা করে।
The 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.
