News for hackers. Stuff that matters.
Re:Why has CPU frequency ceased to grow? (2014) by tzahola on Wednesday February 21, 2018 @05:30AM (#16428423)
Your example will not run in parallel. The go runtime will schedule your goroutines concurrently, but they will be run by a single OS thread, and consequently on a single CPU core.

Once you execute truly on multiple CPU cores (by increasing GOMAXPROCS), you'll be having the same kind of race conditions in Go as in any other imperative language (inb4 Rust Evangelism Strike Force saying "except Rust").

Re:Why has CPU frequency ceased to grow? (2014) by boomlinde on Wednesday February 21, 2018 @06:02AM (#16428575)
> Once you execute truly on multiple CPU cores (by increasing GOMAXPROCS), you'll be having the same kind of race conditions in Go as in any other imperative language (inb4 Rust Evangelism Strike Force saying "except Rust").

Wrong. GOMAXPROCS defaults to the number of logical CPUs, IIRC since version 1.5. For example, I have four cores with 2 threads each, so goroutines will be executed on up to 8 threads unless I set GOMAXPROCS to something else or the application explicitly changes it using the runtime package.

And sure, you'll really have the same problems, but IMO channels and goroutines minimize the friction of implementing thread safe programs using CSP. GP seems a bit optimistic, agreed, but I think that there is at least some substance to the idea that go makes it easier to correctly utilize multiple cores.

Re:Why has CPU frequency ceased to grow? (2014) by zxcmx on Wednesday February 21, 2018 @05:42AM (#16428483)
GOMAXPROCS has defaulted to # of cores since 1.5.
Re:Why has CPU frequency ceased to grow? (2014) by quadcore on Wednesday February 21, 2018 @05:37AM (#16428453)
Wrong. Goroutines are not simply coroutines.

GOMAXPROCS defaults to number of cores.

Re:Why has CPU frequency ceased to grow? (2014) by tzahola on Wednesday February 21, 2018 @05:39AM (#16428466)
Prove it.

Prove it by replacing Sleep in your example with some number crunching, and show how it scales with the number of cores in your CPU.

Re:Why has CPU frequency ceased to grow? (2014) by ta2384428 on Wednesday February 21, 2018 @08:57AM (#16429427)
https://imgur.com/a/DNpw3

Running the following code.

https://play.golang.org/p/k_rRxNAyb0i

I can assure you that go runs across all processors by default.

https://docs.google.com/document/d/1At2Ls5_fhJQ59kDK2DFVhFu3...

Re:Why has CPU frequency ceased to grow? (2014) by grkvlt on Saturday February 24, 2018 @10:36AM (#16453649)
That's not what he's saying. He knows go can use all processors if GOMAXPROCS is set correctly, the argument seems to be that there will be race conditions just like any other threading, which seems pretty self evident to me: yes, multi-threaded code can have concurrency issues, film at 11...
Re:Why has CPU frequency ceased to grow? (2014) by gall0ws on Wednesday February 21, 2018 @06:00AM (#16428567)
Re:Why has CPU frequency ceased to grow? (2014) by gameswithgo on Wednesday February 21, 2018 @11:00AM (#16430357)
Dude you are wrong about this. Please stop.
Re:Why has CPU frequency ceased to grow? (2014) by iknowstuff on Wednesday February 21, 2018 @11:04PM (#16435071)
Except Rust!