‹ 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. osigurdson · · focus · HN ↗
      >> in terms of how things can end up happening in any thread

      Doesn't that describe pretty much any green thread style concurrency implementation.

      1. dlisboa · · focus · HN ↗
        No. Preemptive scheduling plus M:N mapping combination that Go has is not common in other major implementations.

        Other languages and their implementations of green threads usually have cooperative scheduling or M:1 mapping

        1. za3faran · · focus · HN ↗
          Java's virtual threads are M:N.
          1. ackfoobar · · focus · HN ↗
            >> Preemptive scheduling plus M:N mapping

            AFAIK, in the current implementation, Java's virtual threads yields only when they block (cooperative). But the spec allows a JVM to implement them as preemptive.

            1. gf000 · · focus · HN ↗
              Well, they do only yield on block and whatnot, but that's very much different from adding manual async/await keywords, I would say.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.