←back to thread

320 points willm | 2 comments | | HN request time: 0.429s | source
Show context
nromiun ◴[] No.45107370[source]
It was supposed to bring massive concurrency to Python. But as with any async implantation in any language it is too easy to deadlock the entire system. Did you forgot to sprinkle enough `await`? Your code is blocked somewhere, good luck hunting for it.

In contrast preemptive green threads are too easy. Be it IO or CPU load all threads will get their slice of CPU time. Nothing is blocked so you can debug your logic errors instead of deadlocks everywhere.

Async works in JS so well because the entire language is designed for it, instead of async being just bolted on. You can't even run plain `sleep` to block, you need setTimeout.

replies(2): >>45108565 #>>45112238 #
1. KingOfCoders ◴[] No.45112238[source]
What I find funny is Java started with green threads, then moved away to system threads, then back again.
replies(1): >>45112499 #
2. nromiun ◴[] No.45112499[source]
Maybe massive concurrency was not that big of a feature back then. But these days everyone wants to support a million connections at a time. Green threads and async tasks can do that without breaking a sweat, unlike OS threads. Also, Java virtual threads are still cooperative. Maybe they will move to preemption in time like Go did.

Some time ago I tried to run just 10k OS threads on a small PC and it just crashed. So clearly OS threads have not improved much.