‹ BackHN Continuity

Thread

Go Concurrency Distilled

402 points · 187 comments · chmaynard

  1. SamInTheShell · · focus · HN ↗
    The concurrency and threading in Go just feels like magic compared to every other language. I'm a goroutine addict and I refuse to be rehabilitated.

    Just from observations over the years, I don't think there's any other language quite like this, in terms of how things can end up happening in any thread.

    1. hank1931 · · focus · HN ↗
      How about Erlang or Elixir using BEAM?

      Supposedly WhatsApp scaled to serving over 1 billion users with Erlang and BEAM.

      RabbitMQ, used by Reddit, uses Erlang and BEAM.

      Discord uses Elixer and BEAM.

      I just traveled down the BEAM rabbit hole. Fascinating story. The Ericsson Computer Science Laboratory cranked out some amazing products in the early 1990's.

      Their goal was five nines of reliability for Ericsson telephone switches.

      According to Joe Armstrong (an interesting fellow from Ericsson), the AXD301 ATM switch achieved nine nines over a nine-month period using Erlang and BEAM in 2002. That calculates out to 24 milliseconds of downtime.

      1. SamInTheShell · · focus · HN ↗
        I looked at BEAM about a year or so ago, similar conversation here. I don't think BEAM is the same when you start looking at what part of code is executing in which thread. There's tradeoffs depending on what you're solving for, like Go makes it really simple to distribute your work across threads concurrently, but when you start looking at integrating with stuff, you run into having to do tricks to do things with unshare (ref: docker/podman/containers...) and you haven't been able to integrate into libnss since they started using some "unused linux signal" for concurrency controls (PAM used that signal).
        1. nesarkvechnep · · focus · HN ↗
          Since you’re talking about threads in the context of the BEAM, you might want to give it a deeper look. There are no threads there, at least not OS threads on the developer’s disposal.
          1. Joel_Mckay · · focus · HN ↗
            How the OTP handles Erlang/Elixir parallelism is kind of interesting. =3

            <a href="https:&#x2F;&#x2F;blog.stenmans.org&#x2F;theBeamBook&#x2F;#_concurrency_parallelism_and_preemptive_multitasking" rel="nofollow">https:&#x2F;&#x2F;blog.stenmans.org&#x2F;theBeamBook&#x2F;#_concurrency_parallel...

          2. SamInTheShell · · focus · HN ↗
            I don&#x27;t have a use case where anything in my toolbox isn&#x27;t already sufficient enough to solve, it wouldn&#x27;t be worth while. Maybe if I cared to work at some big place or specifically Ericsson, but there&#x27;s better things to be doing with my time. There&#x27;s plenty of problems that can be solved with tools like uv&#x2F;Python&#x2F;PyWebView.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.