HN Reader

NewTopBestAskShowJob

Ask HN: Easiest and hardest concurrency models to use correctly?

score icon9
comment icon3
3 days agoby pkkm
There's a lot of options for concurrency. In Python alone, you can use threads with shared memory, threads with queues, processes with queues, concurrent.futures, asyncio, trio, or AnyIO. Java now has a preview of structured concurrency and virtual threads in addition to regular threads. There's also the CSP model of Go, as well as the actor model and supervision trees of Erlang/OTP. Software transactional memory seems to be popular in the purely functional world but rare outside of it.

I'm curious about your experiences with these concurrency models - which are easy to get right, and which are endless sources of bugs? I'm particularly interested in use cases where there are lots of long-running connections and correctness matters more than performance: chat servers, MMORPG servers, IoT central systems, etc.