It appears (on OSX at least) the minimum number of threads a Go process will be 5. You need to understand that there are multiple threads for usually the following reasons: signal handling, GC collection, monitoring, OS events, timers, and others. The number of threads is going to vary based on number of CPUs in the system, and also the platform. GOMAXPROCS limits the number of OS threads used to run user level code, it does not control the number of threads used to run “internal/runtime” code.
> On Sep 16, 2018, at 10:53 PM, Patrick Smith <pat42sm...@gmail.com> wrote: > > Probably those are threads, not processes. Try 'pstree -T'. Also, I believe > the variable name is GOMAXPROCS, with an S at the end. > > On Sun, Sep 16, 2018 at 8:35 PM <the.warl0ck.1...@gmail.com > <mailto:the.warl0ck.1...@gmail.com>> wrote: > package main > > import ( > "log" > "time" > ) > > func main () { > log.Println("sleep 30s") > time.Sleep(30 * time.Second) > } > When I start it with go run main.go, it shows multiple child process in > pstree: > > Anyone know what's happening? Limiting GOMAXPROC does not help here. > I'm using go version go1.11 linux/amd64 > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com > <mailto:golang-nuts+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.