
Scheduler is a Key to Go
title: Eventually I feel the true Essence of Go published: true description: Scheduler is a Key to Go tags: go
The core Idea - Go Scheduler is a Key to an entire Go structure: std lib and an app architecture.
Long story short: I get into G/P/M model of the Go Scheduler, and found the back-bone model of the all Go programs: Separate Goroutine for each TCP connection. One Listening Goroutine with a "listening Socket", and bunch of others serving "connections Socket". Look at that model from the OS perspective and LRQ for P. Got aha moment of AUTO full-filling all CPU-cores with a Job and wrote the next post:
Eventually I feel the true Essence of Go
From the Scheduler mechanics I pick up the real essence of the TOOL - a server with multiple connections and automatic usage of all hardware-threads of a CPU cores. Only through the Scheduler I understood why the Go is really necessary. Go is a tool like an Axe, and I find what and how to chop wood by this axe. Go is a tool for creating a one executable file that starts well optimized server, and each connection to that server is handled by a light-weight UserSpace Thread.
The Idea of Go itself - to write a server that going to handle multiple TCP connections and automate the process of selecting next goroutine to be executed, and leaving for a while goroutines that stalled in waiting of Network response or any other kind of IPC activity. Here is a Root - to create a server where goroutine would handle a connection, and when to execute that goroutine the Go Runtime would decide, Scheduler if be precise.
This Idea become natural and could be literally touchable only after getting into the G/P/M model - where a Logical Processor P is an abstraction level between UserSpace Thread (a goroutine G) and OS Thread (M). Because each OS Thread M is halted/stopped when it waits for SystemCall to response, mean while P with it own G-swarm keep on "billowing". Thus Go - is a "swarm" or "club" of goroutings that pushed into CPU-cores by the Go Scheduler using P as middle slab abstraction of Logical Processor.
All essence of this model, all value of Go as a language is covered inside the Scheduler that allows bot NOT SO AWARE about how to handle new TCP connection cheap. As the algorithm minimize amount of expensive M (OS threads), substituting them by cheap G (Goroutines).
Go is not a modern C - how it use to be explained, Go is not a "Python". First of all Go is a cheap Goroutiens that are fit perfectly for serving HTTP requests. The aim of the Go is to reduce cost of a Concurrency Component on different platforms.
Uh... it was Tough! Love you mates. I love Go and William Kennedy and Kavya Joshi
gemmaI ported the whole Gemma-4 family — E2B, E4B, 12B, 31B, and the 26B-A4B MoE — to run on...
communityHey DEV, I'm Tobore. Let's actually connect. I've been on here for a while now, mostly writing and...
ai(yep, kinda clickbait, just for the funsies 😊) At the beginning of the year, I relaunched my...
aiMy laptop was sitting idle with the fan at full tilt. Nothing was running that I knew of. The culprit...
githubactionsI Built a Thing! TL;DR — Google Gemini-based Pull Request reviews and Issue Triaging for...
aiI've been hearing the word "harness" thrown around a lot lately. I assumed it just meant "the IDE" or...
Workflows from the Neura Market marketplace related to this DeepSeek resource