On 2021-03-26, Richard Ulmer <maillists.rul...@mailbox.org> wrote:
> Hi,
> it seems to me like Go (from the lang/go port) does not utilize more
> than one CPU core on OpenBSD. Let's take this program, which may be run
> with `go run main.go`:
>
>       package main
>       func main() {
>               go work()
>               work()
>       }
>       func work() {
>               for i := 1; ; {
>                       i *= 1
>               }
>       }
>
> The `go` directive starts a new goroutine, which I would expect to be
> put into it's own process here. However, using htop(1) I can see, that
> only one of my two cores gets load. Running the same program on Linux,
> two cores are utilized.
>
> Can someone explain to me why this is happening? Is there any way to
> make the program use both cores of my CPU?
>
> Best Regards,
> Richard Ulmer
>
>

It works for me (checked using top and pressing H to show threads).

Is your system actually dual-core or is it single core with hyperthreading?
(it's always worth including dmesg when asking a question, that would have
shown this)


Reply via email to