I have a C++ application that using GO API to perform some tasks using cgo. The go code is built into a static library which is linked to the C++ application. While running the application and analyzing on htop, I see multiple threads spawned because of go runtime.
Questions I want to ask: -
- Why the go runtime spawns so many go routines when I am using single go routine as mutator thread (confirmed with the pid of the C++ code and Go code).
- If I use the GO API at the start of my application, will the GC will be called at the later stage of application when no GO API’s are called. (considering I am not storing any reference to the go code).
- If there is a signal while the process is executing, and C++ applications have installed the its own handlers. How does Go handles it.
- Is there a way to completely turn off the GO runtime and make it release all the resources acqurired by these idle threads that the go has created.