What's the usage of the 6 threads when I start to run an exe file generated by go install?

I wrote the code below and generated an exe file by running “go install” in windows.

func main() {						
   go func(){for ;true; {fmt.Println("1")}}()						
   for ; true; {						

Then I run the exe file and monitor the running process by a tool. As you can see, there are 6 threads running. I guess some of them are for GC, what concrete usage of the 6 threads? (I know M goroutines can be mapped to N the system kernel threads dynamically)

The Go runtime starts threads for many reasons - to run your goroutines, for blocking file I/O, for GC, and maybe for other reasons I don’t know. As far as I know the threads aren’t permanently dedicated to either of these purposes. The execution tracer can probably answer what each thread does if you run it on your specific example.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.