Live data from Hacker News

Go hits the concurrency nail on the head

eli.thegreenplace.net

51–60 of 318 posts

Re: Go hits the concurrency nail on the head

#51

Earlier quoted context omitted.

Hah! You must be in on another joke, because OP was referring to Rust ;) > Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. www.rust-lang.org edit: /s

Wooosh Edit: I made this post, but I thought afterwards, what if you were you being dense on purpose, and I didn't get the joke?

I think this thread is a nice reminder that it's really helpful to use /s when you're using sarcasm in written form.

Re: Go hits the concurrency nail on the head

#52
post #2

> Programming with threads is hard - it's hard to synchronize access to data structures without causing deadlocks; it's hard to reason about multiple threads accessing the same data, it's hard to choose the right locking granularity, etc. It's almost as if we need a language that has a focus on data races, concurrency and fearless threading.

Actually it's very easy to avoid data-structure related deadlocks: - avoid holding two locks simultaneously: that guarantees no deadlocks. - if you have to hold several locks, always acquire them in the same order in all scenarios. The "avoid holding multiple locks" rule also harmonizes very well with "minimize the durations/sizes of critical regions". That is, hold a lock over the minimum number of machine instructi…

[deleted]

Re: Go hits the concurrency nail on the head

#53
post #32

Earlier quoted context omitted.

Jefferson’s Timewarp did that with “virtual time” using optimistic rather than pessimistic concurrency constructs so popular today outside of transactions.

Have they moved on from Starship?

No connection with the band.

Re: Go hits the concurrency nail on the head

#54
> Programming with threads is hard - it's hard to synchronize access to data structures without causing deadlocks; it's hard to reason about multiple threads accessing the same data, it's hard to choose the right locking granularity, etc.

That's a list of problems that are specific to mutable state that is shared among threads.

As the old saying goes, "If it hurts, don't do it."

We've had ways of doing multithreaded code that are easier to reason about for decades. They really do work quite well. Why people doggedly insist on pretending they don't exist is a perennial mystery to me. Even if your programming language wasn't kind enough to include a better concurrency model in its standard library, there are always third-party libraries.

I realize my experience isn't universal, but, personally, I've discovered that there's precisely one scenario where I ever need to resort to code that involves mutexes: When the business requirements and the performance profiler have conspired to kidnap my children and hold them for ransom.

Re: Go hits the concurrency nail on the head

#55
post #16
post #3

According to the author Go make concurrent programming "the best experience, by far, compared to other popular programming languages today." I beg to differ. I fail to see why I should choose Go over Elixir/Erlang for concurrency. Elixir's cuncurrency mechanisms are at least as good — and I would argue better — than Go's, and Elixir as a language has an expressiveness that Go lacks.

How are the deployment, library ecosystem, build, and tooling stories for Elixir? Note I don't really care about the answer to the above, I just wish as a profession we could get past the tribalism and boosterism and have rational technical dicussions about things that matter as opposed to banal declarations about 'expressiveness' etc.

The article concludes: "If concurrency is central to your application, Go is the language to use."

If we as a profession are to "get past the tribalism and boosterism and have rational technical discussions", surely other languages/technicques like Pony, Haskell, Clojure, Kotlin, Scala/Java combined Akka etc. should be considered and discussed? The article reaches its conclusion much to easily.

With regards to expressiveness: Go is a lower level language and has fewer language constructs and abstractions than most other modern languages. This is by design, and many seem to appreciate that simplicity. I was simply stating a fact when I said Elixir was more expressive and did not intend to offend anyone. I seem to have done so regardless.

Re: Go hits the concurrency nail on the head

#56
post #17
post #10

Earlier quoted context omitted.

I agree Go is more popular than Elixir — but is it actually a popular language? At least I wouldn't consider it mainstream in the sense Java, C# and Python are.

Well, just ask the Toibe index: https://www.tiobe.com/tiobe-index/ It looks like Elixier ist by far less popular than the other discussed languages.

I personally prefer the RedMonk rankings [1] over TIOBE, since TIOBE's entirely about Google hits, which lags as an activity indicator by a few years, because sites for languages that have stopped being used stay around for years. Also, Google hits counts are really noisy, especially for languages that have names that are also words, like Go and Elixir. RedMonk uses recent GitHub and Stack Overflow activity as a proxy for popularity.

In this case though, Elixir is still way lower, at somewhere around 30th compared to Go's 14th.

[1] https://redmonk.com/sogrady/2018/08/10/language-rankings-6-1...

Re: Go hits the concurrency nail on the head

#57
post #2

> Programming with threads is hard - it's hard to synchronize access to data structures without causing deadlocks; it's hard to reason about multiple threads accessing the same data, it's hard to choose the right locking granularity, etc. It's almost as if we need a language that has a focus on data races, concurrency and fearless threading.

>It's almost as if we need a language that has a focus on data races, concurrency and fearless threading.

How Exciting!! How Exciting!!

Re: Go hits the concurrency nail on the head

#58
post #44
post #31

> I'm happy to go on record claiming that Go is the mainstream language that gets this really right. And it does so by relying on two key principles in its core design... The unmentioned third principle that it relies on is: "Curly braces, so it looks almost like C if you squint". That's what makes a language "mainstream" these days. It looks like Go is very good at concurrency, but from everything I've read, I don't…

Yeah, irritatingly. Erlang had this nailed years before. It's a bit too weird syntactically, and doesn't have the full force of Google pushing it, so it gets ignored :(

I think syntax actually matters a lot more then people tend to give credit for in a language's success. I suspect this is why functional languages have struggled to became very popular while languages with C like syntax have added some functional features instead.

The learning curve for imperative programming structure just seems easier for people to understand and work with.

Re: Go hits the concurrency nail on the head

#59

> Programming with threads is hard - it's hard to synchronize access to data structures without causing deadlocks; it's hard to reason about multiple threads accessing the same data, it's hard to choose the right locking granularity, etc. That's a list of problems that are specific to mutable state that is shared among threads. As the old saying goes, "If it hurts, don't do it." We've had ways of doing multithreaded…

> We've had ways of doing multithreaded code that are easier to reason about for decades. They really do work quite well. Why people doggedly insist on pretending they don't exist is a perennial mystery to me.

Not a single one was mentioned during my CS undergrad; shared-memory threads were, many times. I think simple ignorance is the answer.

Re: Go hits the concurrency nail on the head

#60
post #31

> I'm happy to go on record claiming that Go is the mainstream language that gets this really right. And it does so by relying on two key principles in its core design... The unmentioned third principle that it relies on is: "Curly braces, so it looks almost like C if you squint". That's what makes a language "mainstream" these days. It looks like Go is very good at concurrency, but from everything I've read, I don't…

You’re mentioning functional languages. That’s not for everyone or every usecase. (I love Erlang.)

So, in the world of concurrency, are imperative languages good for every person and every use case? :-)

My intention was not to single out functional languages. Those were just the first languages I thought of with the best concurrency support.

(I don't think it's mere coincidence, though, that so many concurrency-aware languages are functional. If concurrency is a major concern, perhaps one should consider that "mainstream" or even "imperative" might not necessarily be a hard requirement.)

How about Occam or Crystal, then, which use CSP and are imperative yet don't have curly braces?

Post reply on HN