4 ms·
The big win for go over c is the goroutines - cheap and easy multithreading built right into the language.
by Devilboy 14y ago
The big win for go over c is the goroutines - cheap and easy multithreading built right into the language.
- gouranga 14y agoI agree entirely - they are great, but in all the Go I've written (which totals about 50kloc so far as a porting project), I haven't actually used them past anything I would have done with zmq in C.
- luriel 14y agoGoroutines are great, but I'm not convinced they are the greatest advantage over C. Go cleans up and fixes pretty much every issue C had, and improves it in many non-obvious areas, from the syntax to the type system. And when porting an existing project I'm not surprised if goroutines would come up that often given that they probably don't have any equivalent in the original design.
- jamwt 14y agozeromq or coroutine libraries like libtask (by a go author!) have greatly reduced this advantage.
- gouranga 14y agolibtask looks really cool. Thanks for posting. I suppose that begs the question: if you can built it in the language, should it really be a part of the implementation?
- luriel 14y agoPlan 9's libthread ( http://man.cat-v.org/plan_9/2/thread http://man.cat-v.org/plan_9/2/thread ) provides similar CSP-style concurrency to Go. Yet, the authors, after using it for many years, and after having used and built systems where it was part of the language (eg., Inferno/Limbo) decided it was important enough to make it part of the language for it to be usable. There are also other language features that make it much more usable and that are missing from C, like garbage collection. I know Rob Pike and Russ Cox have discussed this several times, it might be worth watching this talk by rob about the history of Go's concurrency model you can find here: http://go-lang.cat-v.org/talks/ http://go-lang.cat-v.org/talks/ And Russ Cox's article also about this: http://swtch.com/~rsc/thread/ http://swtch.com/~rsc/thread/ I'm not sure either covers exactly the reasons why it is a great advantage to make it part of the language, but they are still interesting background.
- gouranga 14y agoThanks for the information - I will have a good read this evening :)