News for hackers. Stuff that matters.
Re:Go concurrency isn't parallelism: Real world lessons with... by spullara on Saturday February 07, 2015 @11:55AM (#9014495)
I think that the default of single threaded is going to bite them hard in the long run. I've already discovered libraries that were never tested with MAXGOPROCS > 1 that are not thread safe. They should default it to at least 2 to make sure these bugs are shaken out.
Re:Go concurrency isn't parallelism: Real world lessons with... by bdarnell on Saturday February 07, 2015 @12:04PM (#9014540)
The go race detector (go test -race) is actually really good at finding these kinds of issues, regardless of GOMAXPROCS. I've gotten a lot more value from running my tests with the race detector in a single process than running the tests with multiple processes and hoping to encounter thread-safety issues in a debuggable way.
Re:Go concurrency isn't parallelism: Real world lessons with... by spullara on Saturday February 07, 2015 @02:28PM (#9015034)
Seems like you should probably never run the tests with -race. Is there a downside from that being the default?
Re:Go concurrency isn't parallelism: Real world lessons with... by bdarnell on Saturday February 07, 2015 @02:45PM (#9015073)
The only real downside is that it slows things down quite a bit (30s vs 12s for a full test run in my current project; I've seen both better and worse ratios in other projects). I've also seen a project that made heavy use of generated code and a race-enabled build would choke on the very large source files. But overall I agree that it seems worthwhile to make -race the default.
Re:Go concurrency isn't parallelism: Real world lessons with... by sarnowski on Saturday February 07, 2015 @02:27PM (#9015031)
Actually that is exactly the case in a library of mine[0]. Its not a bug of my code directly but due to non-POSIX compliance of Linux that triggers only with multiple threads (setuid does set the uid only for the executed thread and not for the others of the same process - unlike the manual page and POSIX states). Its a cornercase but I also explicitly raise the GOMAXPROCS in the test case to trigger it[1].

[0] https://github.com/sarnowski/mitigation

[1] https://github.com/sarnowski/mitigation/blob/master/mitigati...

Re:Go concurrency isn't parallelism: Real world lessons with... by saurik on Saturday February 07, 2015 @10:36PM (#9016333)
(context for others, where you reported this)

https://code.google.com/p/go/issues/detail?id=1435

It is fair to claim that this is "non-POSIX compliance of Linux": the underlying system call interface of an operating system is not something subject to a standard. The mapping from the POSIX-compliant C library to the underlying system calls is allowed to be quite complex, and in fact most of the high-level POSIX functions map to system calls designed for much more general use cases, or arguments with different kinds of struct packing.

You really just should not have been coding directly against the system calls of the operating system: that isn't portable; and later in the discussion, this was specifically addressed ("The syscall package is not for general use. It has no documentation. That's not going to change. When we have a working Setuid etc they will be made available as part of package os."). What sucks is that they seem to have never gotten around to implementing os.Setuid.

Re:Go concurrency isn't parallelism: Real world lessons with... by BuckRogers on Tuesday February 10, 2015 @11:18AM (#9028081)
You should assume Go's creators thought of this. There are performance implications, as it adds overhead if it's not necessary. Most people when writing libraries will decide if it's necessary or useful enough to use CPU multithreading. Single core is common in cloud servers. This is a really bad idea that will never happen.
Re:Go concurrency isn't parallelism: Real world lessons with... by dilap on Saturday February 07, 2015 @12:00PM (#9014526)
Yes! They know it's bad (the documentation says something like "we'll do something smarter later"), but even just a default of 2 would be much better IMO.