2 ms·
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
by hu3 3y 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?
- hot_gril 3y agoRight. 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.