‹ BackHN Continuity

Thread

Go Concurrency Distilled

402 points · 187 comments · chmaynard

  1. voidfunc · · focus · HN ↗
    Ive been writing Go for over a decade and I still feel like I never quite "got" channels. Every time I use them I need to go consult the manual, and none of the patterns feel obvious which is weird considering the rest of the language feels very obvious.

    Too many years of Java and managing Threads and Runnables probably rotted my brain.

    1. za3faran · · focus · HN ↗
      Arguably, Java's virtual (green) threads managed through structured concurrency and futures is a superior approach.
      1. Mawr · · focus · HN ↗
        Arguably, being 10 years late to the party is pretty bad.

        Just how Go adding generics to the language didn't magically fix the billions lines of non-generic Go code, adding virtual threads to Java didn't update its entire ecosystem to take advantage of them.

        Meanwhile, the entire Go ecosystem from the beginning took advantage of goroutines, so all code you'll ever interact with will have excellent support for them.

        1. za3faran · · focus · HN ↗
          I find that very debatable. Spring Boot, for instance, is just one config line away from automatically using virtual threads in its handlers:

              spring.threads.virtual.enabled=true
          
          We also see library implementations switching to them.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.