On Fri, 28 Jun 2019 at 20:10, Song Liu <songliubraving@xxxxxx> wrote: > There should be a master thread, no? Can we do that from the master thread at > the beginning of the execution? Unfortunately, no. The Go runtime has no such concept. This is all that is defined about program start up: https://golang.org/ref/spec#Program_initialization_and_execution Salient section: Package initialization—variable initialization and the invocation of init functions—happens in a single goroutine, sequentially, one package at a time. An init function may launch other goroutines, which can run concurrently with the initialization code. However, initialization always sequences the init functions: it will not invoke the next one until the previous one has returned. This means that at the earliest possible moment for Go code to run, the scheduler is already active with at least GOMAXPROCS threads. -- Lorenz Bauer | Systems Engineer 6th Floor, County Hall/The Riverside Building, SE1 7PB, UK www.cloudflare.com