After some thought about Golang and Schedulers, comparing with a Ruby scheme I made a next conclusion:
The purpose of the Golang is to combine HTTP server with Business logic in bounds of one OS Process.
Where as in Ruby, Python, PHP - HTTP server is a separate Process that requires expensive IPC.
Golang model changes focus from the Process to Threads - because Threads are execution pathes, Process are more metadata structures that comprises shared data environment among several Threads. And Golang invents ultra light Threads called Goroutines - that allows to reduce cost of injecting new extcution path into the game.
The key part of Golang is Scheduler that take a time-sharing burden of the programmer's shoulders. Now it is easy to write IO-bond programs, because Go Scheluer will manage all these suspended Goroutines automatically.
Go solves a problem that rouse in 1960-1970 in the Mainframes: Optimal usage of CPU during IO-bound tasks, when a program just waits for an user input. Now it is the same condition - program just waits a response from the network.
P.S. It is an overview of a language roots, back in 2009 Golang has it's architecture for that purpose, those times it was a common solution to separate HTTP server from the framework by a socket- or something like that. Today there are a plenty technologies to run all components in one process.
For me it is an explanation of the Standard library model in the Golang.
Top comments (0)