On Wed, Dec 26, 2018 at 8:49 AM <[email protected]> wrote:
>
> I'm trying to understand more about the threads running in a golang 
> application.
> I ran the following endless loop
>
> package main
>
> import (
>     "fmt"
>     "os"
> )
>
> func main() {
>     fmt.Println("main running ",os.Getpid())
>     for{}
> }
>
>
> When I checked what threads are running I got the following
> [smonderer@schmil ~]$ ps a -T | grep test
> 17429 17429 pts/1    Rl+   14:36 ./test
> 17429 17430 pts/1    Sl+    0:00 ./test
> 17429 17431 pts/1    Sl+    0:00 ./test
> 17429 17432 pts/1    Sl+    0:00 ./test
> 17429 17433 pts/1    Sl+    0:00 ./test
> 17429 17434 pts/1    Sl+    0:00 ./test
> 18344 18344 pts/3    S+     0:00 grep --color=auto test
> [smonderer@schmil ~]$
>
> Can someone explain why there is more than one thread??

The Go runtime always starts a few threads, one to monitor the other
threads and a few to run the concurrent garbage collector.

Ian

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to