-
Book Overview & Buying
-
Table Of Contents
Practical Systems Programming in Go
By :
The Go program execution process begins with Go source code, which is then compiled and linked using go build. This creates a statically linked binary. The OS loader then executes this binary, which in turn triggers the Go runtime initialization. Once the Go runtime is set up, it starts the main() function. From here, the runtime system manages several key components. Let's look at Figure 4.1, which shows the progression starting from Go source code files at the top and moving down to the runtime system:

Figure 4.1 – How a Go program is executed
The garbage collector is responsible for memory management and works with the memory allocator to handle the heap and stack. Goroutines and the scheduler manage concurrent execution, allowing for efficient use of system resources. Goroutines can interact with the system calls layer to perform I/O operations, network communication, and file access. main() can also directly interact with goroutines and...