On Fri, Mar 26, 2021 at 08:54:23PM -0000, Stuart Henderson wrote:
> On 2021-03-26, Richard Ulmer <[email protected]> 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)
> 
> 

FWIW, I also get two threads on two of my four CPUS (i7), running March
23rd's snapshot (amd64) with a never-before-installed go-1.16.2.

-- 
 

Reply via email to