Hacker News new | ask | show | jobs
by hu3 1081 days ago
When I read async, I think about an event loop in a single thread.

Meanwhile when I read greenthreading, I think of lightweight threads like goroutines or Java's virtual threads.

Am I wrong?

1 comments

Right. Both of them are running on a single OS thread with application-layer context switching. Async's form of context switching is the event loop, greenthreading's is something analogous to OS threads.

Maybe it's inaccurate to say async is a type of greenthreading and better to say it's a form of application-layer context-switching comparable to greenthreading.